Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Support

Agency theme: TypeError when using email form

Started by Les Moore 3 years ago · 5 replies · 388 views
3 years ago

I hope someone can help. On Agency, as per documentation I have installed Grav 1.7.26 and Form 6.0.0. I am having problems when sending emails using the Agency contact form, on send I get the Crikey message:

TypeError
Argument 1 passed to Grav\Plugin\EmailPlugin::isAssocArray() must be of the type array, null given, called in /home/donordirect/public_html/user/plugins/email/email.php on line 105

The section in my email.php is:

$this->grav->fireEvent('onEmailSend', new Event(['params' => &$params, 'vars' => &$vars]));

if ($this->isAssocArray($params)) {

$this->sendFormEmail($form, $params, $vars);
} else {
foreach ($params as $email) {
$this->sendFormEmail($form, $email, $vars);

Line 105 is: if ($this->isAssocArray($params)) {

Anyone recognise the error? Thanks :)

3 years ago

@les.moore,

A few questions:

  • What do you mean with:

    On Agency, as per documentation I have installed Grav 1.7.26 and Form 6.0.0.

    • What "documentation" are you referring to?
    • I hope you didn't downgrade Grav and Form plugin...
      I noticed you are using an older version of Email plugin.
  • Is you email configuration OK? Does the same email.yaml work fine on other sites?
  • Can you debug and read the value of variable $params?

I've installed skeleton Agency, upgraded Grav ($ bin/gpm selfupgrade) and plugins ($ bin/gpm update).

Submitting the contact form does not throw any errors.

I do notice that version 3.2.0 of the Email plugin is different from yours. Code if ($this->isAssocArray($params)) { is on line 112.

3 years ago

@les.moore,

TXT
dependencies:
    - { name: grav, version: '>=1.7.32' }
    - { name: form, version: '>=6.0.0' }

These are minimal versions requirements: Anything equal of bigger than.

Maybe I should simply reinstall…

Considering the email plugin is configured correctly, installing the latest version of Grav would be my first suggestion.

3 years ago

Thank you @pamtbaau . I deleted and reinstalled Grav, and uploaded the Agency template, so good so far. I updated Grav, Agency and the email plug in. Created a new mail user and successfully sent a test email. However, on sending an email via the Agency form, got exactly the same 'missing array' error message as the first time.

However, I now see you started by installing the Agency skeleton package. I will try again from that starting process and let you know how I get on.

3 years ago

@les.moore, When using the Agency skeleton, don't forget to edit module 01.home/_contact/form.md and add:

TWIG
- email:
    subject: "[Site Contact Form] {{ form.value.name|e }}"
    body: "{% include 'forms/data.html.twig' %}"

Else you're not only getting no error, but also no email...

Suggested topics

Topic Participants Replies Views Activity
Support · by Thomas, 1 week ago
3 92 3 hours ago
Support · by Anna, 3 days ago
2 94 24 hours ago
Support · by Justin Young, 1 day ago
1 62 1 day ago
Support · by Duc , 1 week ago
2 98 6 days ago
Support · by Colin Hume, 1 week ago
2 91 6 days ago