WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Feature request: Get user birthday and location

[Resolved] Feature request: Get user birthday and location

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Nextendweb

    @nextendweb

    Hi!

    Please update to version 1.4.43. Then read this documentation: http://www.nextendweb.com/knowledgebase/question/how-can-i-make-custom-calls-when-a-visitor-log-in-with-facebook-connect

    So you have to register an action to the register/login action and then you can save any user data what you want:

    $user_info = wp_get_current_user();
    update_user_meta( $user_info->ID, 'location', 'here comes the location from facebook');

    When I log in with FB connect, it does not update any user meta. What am I doing wrong?

    Added this code in my functions.php:

    function my_fb_login_function($user_profile, $facebook){
    
    	$curr_user = wp_get_current_user();
    
    	if( $curr_user->ID == 1 ) { // Just for admin
    		update_user_meta( $curr_user->ID, 'gender', $user_profile["gender"] );
    	}
    }
    add_action( 'nextend_fb_user_logged_in', 'my_fb_login_function'  );

    Plugin Author Nextendweb

    @nextendweb

    Sorry, I forgot something. You have to specify the add_action parameter count.

    add_action( 'nextend_fb_user_logged_in', 'my_fb_login_function',10,2);

    10 is the priority – this is the default
    2 is the number of parameters. I have updated the tutorial.

    One more suggestion:

    if( $curr_user->ID == 1 ) { // Just for admin
    if(isset($user_profile["gender"]) ){
    update_user_meta( $curr_user->ID, 'gender', $user_profile["gender"] );
    }
    }

    This will check if that array key exist or not. This prevent notices 🙂

    Also I would really appreciate if you could insert your final function(with the user meta fill outs) into our knowledgebase: http://www.nextendweb.com/knowledgebase/48

    Others may user your solution too. Thank you! 🙂

    Plugin Author Nextendweb

    @nextendweb

    Also in version 1.4.45, I have added a new filter, which allow you to get more data from your user. Check this topic for more info: http://www.nextendweb.com/knowledgebase/question/how-can-i-get-extended-facebook-permissions-for-other-fields

    Hi 🙂
    Thank you for your help.
    There is still one problem.
    nextend_fb_user_logged_in – not working.
    but the same code with nextend_fb_user_account_linked actions works fine.

    what could we do?

    Plugin Author Nextendweb

    @nextendweb

    Do you use with this?

    add_action( 'nextend_fb_user_logged_in', 'my_fb_login_function',10,2 );

    I tried and the login worked for me fine. Also when your account already connected and you logged it and then hit the facebook login again, the action won’t get fired. In this case no login happens…

    I have found the problem…
    I was trying to get user id before user logs in. The function is called before log in happens… Maybe I could get user ID from your plugin within $user_profile array? In $user_profile array is an ID wich is FB ID. Maybe we can get other ID named wp_id or somehow…
    Then we could update user meta 🙂

    Thanks!

    Plugin Author Nextendweb

    @nextendweb

    You are right! I have modified the calls and added the wp user id parameter. Calls documentation

    Hello!
    Thanks for great plugin you developed. I need get more fb user’s data and show it in the wordpress backend profile. The knowledge base of Nextend website appears error. I can’t find any information about how I complete my needs.
    Could you help me?

    Thanks!

    Hello!
    same problem as m615926
    cannot reach this link
    please help us!

    Thanks!

    esmi

    @esmi

    Forum Moderator

    @emc666: If you require assistance then, as per the Forum Welcome, please post your own topic.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘[Resolved] Feature request: Get user birthday and location’ is closed to new replies.