New
PeoplePress is here. Community building for WordPress, reimagined. Fast, modern, and built for the communities you've always wanted to run.
See it live

BuddyDev

Search

Replies

  • Keymaster
    (BuddyDev Team)
    Posts: 25513

    Oops. It seems I have been messing it.

    Please keep using your own for now. It does causes double query but is still better than my suggestion.

    I will share better code later today.

    regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25513

    Hi Timothy,
    Your code will work fine. By using my previous suggestion, you can avoid extra database query for fetching post type entries(We already fetch them for .

    PS:- Please use my updated code. In the previous code even I used an inefficient internal method.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25513

    Hi Diana,
    Thank you for the reply.
    yes, you are right about it.

    We need to maintain the same hierarchy as in the plugin.

    PS:- Thank you for the email.

    Best regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25513

    Hi Kristian,
    Thank you for teh question.

    Please change this line

    
    
    $new_excluded = array_merge( $excluded, $user_ids );
    
    

    to

    
    $other_ids = array( 1,2,3,4,5); //update it with correct ids
    
    $new_excluded = array_merge( $excluded, $user_ids, $other_ids );
    
    

    That should do it.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25513

    Hi Timothy,
    At the moment, we don’t have an API for retrieving the Avatar URL for member type. It is an isolated module.

    There is a way to get the avatar url efficiently(there are other option but that does not uses proper caching).

    I wrote a custom function that you may use

    
    
    /**
     * Get avatar associated with a member type.
     *
     * @param string $member_type member type.
     * @param string $thumb_type thumbnail type(thumb|full).
     *
     * @return string
     */
    function mtp_custom_get_avatar_url( $member_type, $thumb_type = 'thumb' ) {
    
    	$mtp_object = bpmtp_get_member_type_entry( $member_type );
    
    	if ( ! $mtp_object ) {
    		return '';
    	}
    
    	$post_id = $mtp_object->post_id;
    
    	if ( ! $post_id ) {
    		return '';
    	}
    
    	$avatar_url = '';
    
    	switch ( $thumb_type ) {
    		case 'thumb':
    			$avatar_url = get_post_meta( $post_id, '_bp_member_type_associated_avatar_thumb_url', true );
    			break;
    
    		case 'full':
    			$avatar_url = get_post_meta( $post_id, '_bp_member_type_associated_avatar_full_url', true );
    
    			break;
    	}
    
    	return $avatar_url;
    }
    
    

    Once you have put it in your theme’s functions.php or bp-custom.php in wp-content/plugins. you can use it to get the url of the avatar image.

    Hope that helps.

    Regards
    Brajesh

    • This reply was modified 7 years, 7 months ago by Brajesh Singh. Reason: Code updated
  • Keymaster
    (BuddyDev Team)
    Posts: 25513
    This reply has been marked as private.
  • Keymaster
    (BuddyDev Team)
    Posts: 25513

    Hi Mic,
    Thank you.

    I am glad you found that option 🙂

    The Content is the actual content shown on the tab page. It is used in case you add a new Tab or add a new sub tab. When you visit that sub tab, the content is shown.

    If a plugin allows passing user id in the shortcode, you can use their shortcode to show displayed user specific content on the profile tab.

    Hope that clarifies.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25513

    Hi Mic,
    I am sorry I could not test it earlier. Will do on Monday(tomorrow) and post an update.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25513
    This reply has been marked as private.
  • Keymaster
    (BuddyDev Team)
    Posts: 25513

    Hi Rick,
    I am sorry, we have been unable to reply in time on forum due to office move and have been trying to resolve most issues last week.

    About your issue:- There is a solution if the users are being registered on sub sites and not on the main site. In order to add a user to a specific sub site, we need to know if they registered on it or not. If they are registering on the main site, we can not automate(if we do, all new users will be added to the main site).

    If you are letting users register on sub sites(the registration form is on the sub site), then we may have an option. We can

    
    user_register
    

    and add user to the current sub site.

    Regards
    Brajesh