Support » Plugin: WordPress Social Login » Does this work with existing registered BuddyPress users?

Viewing 15 replies - 16 through 30 (of 36 total)
  • bbPress vote here. I would *really* like it if it were compatible out of the box (haven’t tried yet, but the default new user categories – different between the WordPress and bbPress sections – are what makes me think it won’t work right out of the box).

    Now, if you could confirm that a new user would be given both the WordPress and bbPress default groups automatically, that would probably be what makes it 99% compatible.

    Thread Starter Tux Kapono

    (@tux-kapono)

    @miled, a friendly inquiry re if this is still on the road map? Just checking to see if I should keep checking.

    Plugin Author Miled

    (@miled)

    yea it is.. um just.. procrastinating

    Henry

    (@henrywright-1)

    Miled – great to hear BuddyPress compatibility is on the roadmap. I’ve tried many social connect plugins none of which work fully with BuddyPress. My +1 here!

    looking forward to the BuddyPress addition, thanks @miled. Can you post in here when the new update is ready? I guess we’ll get notified in the backend as well…

    And one more question, will wsl be compatible with WP + BP + bbPress combined 🙂 ?

    Still brewing the coffee @miled. Let me know if you need a tester.

    another vote here

    Another vote for Buddy Press support.
    I’ve recently coded a filter function to use wsl_image if Buddy Press returns default avatar. Will be more than happy to share the code upon request.

    @makbeta

    Yes, please share your code in this thread! Looking forward to using it on a production site currently in the works. Thank you ahead of time!

    Just testing on my localhost BP install and first discovered Yahoo test just goes to a blank login page. BP 1.7.2

    Gets my vote for BP!

    Anonymous User 7669681

    (@anonymized-7669681)

    I am working on transforming my website at work and having a social network login is crucial to be compatible with BuddyPress and bbPress!
    Z

    here’s the code I’ve used successfully to fix my issue:

    add_filter( 'bp_core_fetch_avatar', 'bfg_bp_core_fetch_avatar', 15, 2 );
    /**
     * bfg_bp_core_fetch_avatar()
     *
     * Modifieds the BuddyPress avatar with WP Social Login avatar if default avatar is rendered
     *
     *
     * @param string $bp_avatar Avatar image returned by BuddyPress
     * @param array $args Determine the output of this function
     * @return string Formatted HTML <img> element, or raw avatar URL based on $html arg
     */
    
    	function bfg_bp_core_fetch_avatar($bp_avatar, $args = '') {
    
    	 	$params = wp_parse_args( $args, array(
    			'item_id'    => false,
    			'object'     => $def_object, // user/group/blog/custom type (if you use filters)
    			'type'       => $def_type,   // thumb or full
    			'avatar_dir' => false,       // Specify a custom avatar directory for your object
    			'width'      => false,       // Custom width (int)
    			'height'     => false,       // Custom height (int)
    			'class'      => $def_class,  // Custom <img> class (string)
    			'css_id'     => false,       // Custom <img> ID (string)
    			'alt'        => '',    	     // Custom <img> alt (string)
    			'email'      => false,       // Pass the user email (for gravatar) to prevent querying the DB for it
    			'no_grav'    => false,       // If there is no avatar found, return false instead of a grav?
    			'html'       => true,        // Wrap the return img URL in <img />
    			'title'      => ''           // Custom <img> title (string)
    		) );
    		extract( $params, EXTR_SKIP );
    		//modify only user's avatars and
    		if(!empty ($bp_avatar) && $object == 'user' && get_option('wsl_settings_users_avatars')) {
    
    			if(empty($email) && !empty($item_id)) {
    				$email = get_userdata($item_id)->user_email;
    			}
    
    			if($item_id || $email) {
    
    				if(is_default_gravatar($email)) {
    					$user_thumbnail = get_user_meta ($item_id, 'wsl_user_image', true);
    
    				  if ($user_thumbnail !== false && strlen(trim($user_thumbnail)) > 0) {
    	          $user_thumbnail = preg_replace ('#src=([\'"])([^\\1]+)\\1#Ui', "src=\\1" . $user_thumbnail . "\\1", $bp_avatar);
    	          if (!is_ssl()) {
    							$user_thumbnail = str_replace('https', 'http', $user_thumbnail);
    						}
    						return $user_thumbnail;
    	        }
    				}
    
    			}
    		}
    
    		return $bp_avatar;
    
    	}
    
    	//given user e-mail tests if gravatar exits or a default image is rendered
    	//returns true if default image is going to be used, false if a valid gravatar image exists
    	function is_default_gravatar($email) {
    		// Craft a potential url and test its headers
    		$hash = md5(strtolower(trim($email)));
    		$uri = 'http://www.gravatar.com/avatar/' . $hash . '?d=404';
    		$headers = @get_headers($uri);
    		return !preg_match("|200|", $headers[0]);
    
    	}

    Hope this helps.

    @makbeta
    I tried your functions.php snippet and it does seem to me to work.
    Default avatar is still being used, despite Social Login shows avatars from the likes of Facebook and Instagram.
    Are you using the latest BuddyPress or have any other thoughts why your code might not work?

    Martin,
    My code is running on the latest version of the BuddyPress and works without a hitch in my install.

    To debug your issues I would suggest first trying to see if the function is being called at all. Put print "I'm here" in bfg_bp_core_fetch_avatar().
    If the function is being called then I would jump to see what is_default_gravatar() returns on your user. If you site is secure you might want to modify the $url to start with https:// rather than http://

    Hope this helps to get you started.

    The issue was in the Basic Settings as I discovered.
    I needed to change the avatar to ‘Display users avatars from social networks when available’ so your code is now working as I thought it should have.
    Much good in the world now, thank you 🙂

Viewing 15 replies - 16 through 30 (of 36 total)
  • The topic ‘Does this work with existing registered BuddyPress users?’ is closed to new replies.