• Resolved paledirectory

    (@paledirectory)


    I’m running buddypress and appbuddy on my app, but I don’t see a way to add a profile or log out button to my menus. All profiles are linked directly to a particular user, but I need a link that will dynamically redirect users to their profile according to their username. Can anyone help?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter paledirectory

    (@paledirectory)

    Update: I just found this code from the creators on github and I’d imagine it will work, but I’m not sure where to add it:

    <?php
    // Add BuddyPress profile to sidebar. Should check if appwoo is active, or double profiles will show.
    // Author: Scott Bolinger https://apppresser.com
    add_action( 'appp_left_panel_before', 'ion_bp_profile', 99 );
    function ion_bp_profile() {
    	if( !is_user_logged_in() )
    		return;
    	$user         = wp_get_current_user();
    	$display_name = isset( $user->display_name ) ? $user->display_name : '';
    	$user_email   = isset( $user->user_email ) ? $user->user_email : '';
    	$user_first   = isset( $user->user_firstname ) ? $user->user_firstname : '';
    	$user_last    = isset( $user->user_lastname ) ? $user->user_lastname : '';
    	$profile_link = bp_loggedin_user_domain( '/' );
    	echo '<div class="item menu-profile">';
    	if ( $user_email ) {
    		echo '<a class="ajaxify" href="' . $profile_link . '">' . get_avatar( $user_email, 50 ) . '</a>';
    	}
    	if ( $user_first || $user_last ) {
    		$name = $user_last;
    		$name = $user_first ? $user_first .' '. $name : $name;
    		echo '<h2 class="item-title"><a class="ajaxify" href="' . $profile_link . '">'. $name .'</a></h2>';
    	} elseif ( $display_name ) {
    		echo '<h2 class="item-title"><a class="ajaxify" href="' . $profile_link . '">@'. $display_name .'</a></h2>';
    	}
    	echo '<p>Welcome back!</p></div>';
    }

    Source: https://gist.github.com/scottopolis/a1441db2f961964b23ccd012431245d4

    Thread Starter paledirectory

    (@paledirectory)

    The good people at Apppresser recently made an article on how to do this, and it’s much easier than initially thought. For anyone else encountering this issue, you simply place “me” as an arbitrary placeholder for your users. Read the full article here:
    https://v3docs.apppresser.com/article/377-buddypress-profile-links

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How do I link buddypress users to their profile?’ is closed to new replies.