Here is code for function to auto befriend BP friends if they exis on blog and t
-
You guys might need to clean this up, basically what this does id auto befriend a new user signing up via FB, if any of his FB friends already are users on the blog as well… Please include sometime as a possible feature… you might have to check the BP friends functions to see if they were updated as this was written for BP 1.8.
$friendsSql = "SELECT <code>identifier</code> FROM <code>{$wpdb->base_prefix}wsluserscontacts</code> WHERE user_id = {$userId} AND <code>provider</code> = 'Facebook'"; $friendsSql = $wpdb->get_col( $friendsSql,0 ); $friends_list = implode(',',$friendsSql); $friendIds = "SELECT DISTINCT <code>user_id</code> FROM <code>wp_usermeta</code> WHERE (<code>meta_key</code> = 'facebook' AND <code>meta_value</code> IN ({$friends_list}) ) OR (<code>meta_key</code> = 'facebook_uid' AND <code>meta_value</code> IN ({$friends_list}) ) OR (<code>meta_key</code> = 'Facebook' AND <code>meta_value</code> IN ({$friends_list}) )"; $friendIds = $wpdb->get_col($friendIds, 0); //echo '1111'; foreach ( $friendIds as $fId ) { $friendship_status = BP_Friends_Friendship::check_is_friend( $userId, $fId ); if ( 'not_friends' == $friendship_status ) { friends_add_friend($userId, $fId, false); bp_core_delete_notifications_by_item_id( $fId, $userId, $bp->friends->id, 'friendship_request' ); } }
https://www.ads-software.com/plugins/wordpress-social-login/
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Here is code for function to auto befriend BP friends if they exis on blog and t’ is closed to new replies.