Created
April 12, 2018 09:08
-
-
Save seventhqueen/70a8131d9643988200dafe3959f6fde8 to your computer and use it in GitHub Desktop.
Check if user used Facebook login on KLEO Wordpress theme
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Check if user used Facebook login | |
* | |
* @param int $user_id The user ID to check. | |
* @return bool | |
*/ | |
function sq_is_facebook_user( $user_id = null ) { | |
if ( ! is_user_logged_in() ) { | |
return false; | |
} | |
if ( ! $user_id ) { | |
$current_user = wp_get_current_user(); | |
if ( isset( $current_user->ID ) ) { | |
$user_id = $current_user->ID; | |
} else { | |
return false; | |
} | |
} | |
if ( get_user_meta( $user_id, '_fbid', true ) !== false ) { | |
return true; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment