bp_activity_admin_menu()

Add the Activity top-level menu link when viewing single activity item.

Description

Return

(null) Null if user does not have access to editing functionality.

Source

File: bp-activity/bp-activity-adminbar.php

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
function bp_activity_admin_menu() {
    global $wp_admin_bar;
 
    // Only show if viewing a single activity item.
    if ( ! bp_is_single_activity() ) {
        return;
    }
 
    // Only show this menu to super admins
    if ( ! bp_current_user_can( 'bp_moderate' ) ) {
        return;
    }
 
    $activity_edit_link = add_query_arg( array(
        'page' => 'bp-activity',
        'aid' => bp_current_action(),
        'action' => 'edit'
    ), bp_get_admin_url( 'admin.php' ) );
 
    // Add the top-level Edit Activity button.
    $wp_admin_bar->add_menu( array(
        'id'    => 'activity-admin',
        'title' => __( 'Edit Activity', 'buddyboss' ),
        'href'  => esc_url( $activity_edit_link ),
    ) );
}

Changelog

Changelog
Version Description
BuddyPress 2.6.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.