0

I'm using Simplenews module for sending newsletter to the registered users. When a user creates a new account he/she will be automatically subscribed to a newsletter which can be seen in admin/people/simplenews.

However, when user registers via social network he/she is not subscribed to newsletter. When I visit admin/people/simplenews I can see only the users registered in normal way; users registered through a social network cannot be seen.

I'm using HybridAuth for Twitter & Google+ login and Fboauth for Facebook login. In simplenews configuration, I've used silent setting. What can I do to make users sign up to a newsletter on social network registration?

1

The reason users aren't signed up is due to how simplenews works. It does the work of newsletter signup by modifying the Drupal core registration form to capture the newsletters (or setting them automatically in case of the silent option) then takes that data to sign users up following account creation.

For both HybridAuth & FBOauth, they subvert this process with their own forms to do authentication with a 3rd party. Both HybridAuth & FBOauth however, provide their own API hooks to take action upon user registration (hook_hybridauth_user_insert() & hook_fboauth_user_save() respectively). You can implement their hooks in a custom module to do the same work HybridAuth does to signup users automatically.

1

Finally got the solution with help of instructions given in the above answer. I just simply called the simplenews_subscribe_user() inside hook_hybridauth_user_save().

function my_module_fboauth_user_save($account, $fbuser) {
  simplenews_subscribe_user($account->mail, 15, $confirm = FALSE, $source = 'automatically', NULL);
}

I don't whether this method is a correct procedure to solve above problem. But it works for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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