0

bit lost here

We have a newsletter signup page which has a form created using profiles. When the user submits the information it should create a contact (then a civirule will add a new activity when the user gets added to the newsletter signups group)

At first, the issue that we were seeing was, when not logged in (when logged in, it all works fine), when civirules was trying to add the user to the group it would say "source_contact_id is not a valid integer" Disabling the civirule gets you to the success page but doesn't fix the underlying issue.

When logged in the contact is created properly The newsletter page responds as so: First Name tester Last Name test Email [email protected]

And adds the contact info to the contact

When not logged in it returns: First Name Last Name Email

And doesn't add any contact info to the contact The civi url would be for example: ?page=CiviCRM&q=civicrm/profile/view&reset=1&id=123456&gid=12

So in short, if the form is filled in and the user is logged in, everything works as it should. If it is an anonymous user the contact gets created but the name & email isn't created Permissions are set up with anonymous being able to edit/create profiles and even just giving permission to everything doesn't help... There's no errors either...

Please help!!!

1 Answer 1

0

The symptoms I thought there were, weren't there, the contact was being created correctly, my method of testing was wrong...

The problem is a bug in civirules, when creating an activity when not logged in, it doesn't have the "source_contact_id" parameter available for the API (when you look at an activity, it's the bit that says "added by"...

My solution (we're on wordpress) was to add if(!is_user_logged_in()){ $parameters["source_contact_id"]=1; } before the API call in the plugin.

I've reported the issue over here https://github.com/CiviCooP/org.civicoop.civirules/issues/152 and will build in the method of being able to set a default contact for activities if the user isn't logged in (which I'll pr on the git repo), my fix is wordpress specific, hacky and needed to be done quickly

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.