BuddyDev

Search

Using edit group link code with Nouveau

  • Participant
    Level: Yogi
    Posts: 1117
    calu on #43239

    Hi there, I wan’t to use this code to add edit group links, but this is for Legacy.

    ´profile-loop.php´ for BuddyPress bp-legacy with edit group link

    https://gist.github.com/sbrajesh/0ea24b0cafacaa098dbf8d61e5eda8be

    All though it is actually working with Nouveau, I would like to add it to Nouveau’s ´profile-loop.php´ but I don’t know where to put in the code.

    Can you help?

    Is it possible to add eg a pencil SVG icon in this line, instead of plain text ´Edit´

    ´printf( ” Edit %s”, bp_get_the_profile_group_name() );´

    Regards
    Carsten

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #43279

    Hello Casten,

    Thank you for posting here. Please try the following code:

    
    add_filter( 'bp_get_the_profile_group_name', function ( $name ) {
    
    	if ( ! bp_is_my_profile() && ! is_super_admin() ) {
    		return $name;
    	}
    
    	global $group;
    
    	if ( bp_is_user_profile() && ! bp_is_user_profile_edit() ) {
    		$edit_link = bp_displayed_user_domain() . bp_get_profile_slug() . '/edit/group/' . $group->id;
    		$name      = sprintf( '<a href="%s">%s</a>', $edit_link, $name );
    	}
    
    	return $name;
    } );
    
    

    Please give a try

    Regards
    Ravi

You must be logged in to reply to this topic.

This topic is: not resolved