Answers.Body: <p>The symptoms I thought there were, weren't there, the contact was being created correctly, my method of testing was wrong...</p>
  
  <p>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"...</p>
  
  <p>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.</p>
  
  <p>I've reported the issue over here <a href="https://github.com/CiviCooP/org.civicoop.civirules/issues/152" rel="nofollow noreferrer">https://github.com/CiviCooP/org.civicoop.civirules/issues/152</a> 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</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-12T09:21:05.850Z
Answers.LastActivityDate: 2017-05-12T09:21:05.850Z
Answers.UserDisplayName: Chris
Body: <p>bit lost here</p>
  
  <p>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)</p>
  
  <p>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.</p>
  
  <p>When logged in the contact is created properly
  The newsletter page responds as so:
  First Name
  tester
  Last Name
  test
  Email
  test@example.org</p>
  
  <p>And adds the contact info to the contact</p>
  
  <p>When not logged in it returns:
  First Name
  Last Name
  Email</p>
  
  <p>And doesn't add any contact info to the contact
  The civi url would be for example: ?page=CiviCRM&amp;q=civicrm/profile/view&amp;reset=1&amp;id=123456&amp;gid=12</p>
  
  <p>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 &amp; 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...</p>
  
  <p>Please help!!!</p>
  
Tags: <wordpress><profile><4.6>
Title: Create profile not creating contact properly unless logged in on wordpress with civicrm 4.6
ThreadText: # Create profile not creating contact properly unless logged in on wordpress with civicrm 4.6
  
  (Asked by: username_0 on 2017-05-09)
  
  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
  test@example.org
  
  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!!!
  
  **Tags:** wordpress, profile, 4.6
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2017-05-12. Score: 0 | Accepted answer
  
  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
  
  
  ---
  
  