Title: Custom PHP Code   Social Login
Last modified: August 21, 2016

---

# Custom PHP Code Social Login

 *  Resolved [sgpagek](https://wordpress.org/support/users/sgpagek/)
 * (@sgpagek)
 * [12 years ago](https://wordpress.org/support/topic/custom-php-code-social-login/)
 * Hello,
 * I am creating a custom PHP code in my site with the purpose to generate a specific
   message for each user. So let’s say my DB is like this:
    —————————- | User | 
   Message | —————————– | ABC | Hi, DEF! | | XYZ | Hellooo!! | —————————– I want
   it so that when user ABC logs in with his fb connect, the specific message is
   displayed (Hi, DEF!).
 * By using your plugin, can you advise me on how to do this cross check? To do 
   this, I will need to get the id/email + password of the logged in user and cross-
   check this with the information in the database to then extract the correct message.
   However, I do not know whether you store the id/email + password or if you do,
   how you store them. Can you please help me on this?
 * I know that in wp_users table you have the following fields:
    – user_login – 
   user_pass – user_nicename – user_email – user_url – user_registered – user_activation_key–
   user_status – display_name May I know what do you fill for each of these fields
   when someone logs in with the FB connect?
 * Thanks! Your prompt reply would be greatly appreciated.
 * Kind Regards,
    Pascal Gekko
 * [https://wordpress.org/plugins/loginradius-for-wordpress/](https://wordpress.org/plugins/loginradius-for-wordpress/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [loginradius](https://wordpress.org/support/users/loginradius/)
 * (@loginradius)
 * [12 years ago](https://wordpress.org/support/topic/custom-php-code-social-login/#post-4919772)
 * Hi Pascal,
 * You can get logged in user information using following code if user is successfully
   logged in. Once you get user_id, it can be used to get Social ID Provider.
 *     ```
       <?php
       global $current_user;
       get_currentuserinfo();
   
        echo 'Username: ' . $current_user->user_login . "\n";
        echo 'User email: ' . $current_user->user_email . "\n";
        echo 'User first name: ' . $current_user->user_firstname . "\n";
        echo 'User last name: ' . $current_user->user_lastname . "\n";
        echo 'User display name: ' . $current_user->display_name . "\n";
        echo 'User ID: ' . $current_user->ID . "\n";   
   
       echo 'User ID: ' . $current_user->ID . "\n";  
   
       //getting Social ID Provider  
   
       echo get_user_meta($current_user->ID, 'loginradius_provider', 'true');
       ?>
       ```
   
 * Note: You should modify this code according to your requirements.
    LoginRadius
   Plugin uses following 2 function to create user ( Registration ) and for logging
   in.
 * Follow these steps to look those functions.
    1.Login to your Ftp. 2.Open file
   root_dir\wp-content\plugins\loginradius-for-wordpress\LoginRadius.php. 3.In this
   file search function login_radius_create_user
 * This function handles registration process using Social ID Providers.
    All the
   code for inserting user information in wp_users and wp_usermeta tables is available
   in this function.
 * 4.Search for function login_radius_login_user
    This function is used for login
   process.
 * On the pages you want to show message you can get user information using above
   code and check Social ID Provider. Now you can display message according to your
   custom Table.
 * Hope this helps you!

Viewing 1 replies (of 1 total)

The topic ‘Custom PHP Code Social Login’ is closed to new replies.

 * ![](https://ps.w.org/loginradius-for-wordpress/assets/icon-256x256.png?rev=2389582)
 * [Authentication by LoginRadius](https://wordpress.org/plugins/loginradius-for-wordpress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/loginradius-for-wordpress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/loginradius-for-wordpress/)
 * [Active Topics](https://wordpress.org/support/plugin/loginradius-for-wordpress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/loginradius-for-wordpress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/loginradius-for-wordpress/reviews/)

## Tags

 * [custom](https://wordpress.org/support/topic-tag/custom/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [sql](https://wordpress.org/support/topic-tag/sql/)

 * 1 reply
 * 2 participants
 * Last reply from: [loginradius](https://wordpress.org/support/users/loginradius/)
 * Last activity: [12 years ago](https://wordpress.org/support/topic/custom-php-code-social-login/#post-4919772)
 * Status: resolved