wordpressbuddypress

Change the title "Gallery" in Buddypress/MediaPress to "Videos & Audio"


The default heading in the menu for the photos in Buddypress is "Gallery". I'm using the MediaPress to upload Video and Audio also. I'd like "Gallery" to say "Videos & Audio". Here's a link to the image: Image of Gallery title

function rename_mediapress_profile_tab() {
    $name = sprintf(__(‘Videos & Audio <span>%d</span>’, ‘mediapress’), mpp_get_total_gallery_for_user());
    buddypress()->members->nav->edit_nav( array( ‘name’ => __( $name, ‘mediapress’ ) ), ‘videos & audio’ );
    }
    add_action( ‘bp_actions’, ‘rename_mediapress_profile_tab’ );

Solution

  • It appears that the issue lies with the following line:

    buddypress()->members->nav->edit_nav( array( 'name' => __( $name, 'mediapress' ) ), 'videos & audio' );
    

    $name is already a dynamic, formatted string that includes content translated through sprintf(__('...', 'mediapress'), ...).

    Additionally, the slug should be 'mediapress' instead of 'videos & audio'.

    Here is the corrected code:

    function rename_mediapress_profile_tab() {
        // Define the new tab name with the total count of galleries
        $name = sprintf(__('Videos & Audio <span>%d</span>', 'mediapress'), mpp_get_total_gallery_for_user());
        
        // Edit the nav tab for MediaPress (replace 'mediapress' with the actual slug if it's different)
        buddypress()->members->nav->edit_nav(array('name' => $name), 'mediapress');
    }
    add_action('bp_actions', 'rename_mediapress_profile_tab');