Drupal user create

alviso - February 26, 2009 - 15:27
Project:Drupal for Facebook
Version:5.x-2.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi Dave,

I have the need for the user created in Drupal to be able to log on to Drupal itself.
I can see that the password is generated with user_password() and - for me at least - the email remains empty.
I would like to notify the facebook user about her drupal credentials.
If I read the code correctly it could be sent as a facebook email?

Can you please comment.
Thanks,
Peter

#1

Dave Cohen - February 27, 2009 - 06:28

Drupal for Facebook supports a couple options... One is to create local accounts automatically (as you are doing), the alternative is to have the users register or login using Drupal's forms.

When creating the accounts automatically it calls user_save(), defined by Drupal. I messed around with some code to send the user a message via facebook, but for lack of testing, I disabled it. Look in fb_user.module for the call to user_save. Then look a little further down for if (FALSE). Change that to if (TRUE) to enable the code. Let me know if it works for you.

Alternatively, you could add some code to do this to your own module. Implement hook_fb(), the all-purpose hook. Drupal for Facebook calls hook_fb with op FB_OP_PRE_USER before the local account is created, giving you a chance to change things about the user, and call it with op FB_OP_POST_USER right after creating the user, so you could send a message there.

I would like, eventually, to integrate Drupal for Facebook with the Notifications API. Something I mention in this post: http://www.dave-cohen.com/node/3033

#2

alviso - March 2, 2009 - 09:54

Thanks for the explanation, I will be testing your suggestions and report back here.
Peter

 
 

Drupal is a registered trademark of Dries Buytaert.