BP_Members_Admin::row_actions( array|string $actions = '', object|null $user = null )

Add a link to Profile in Users listing row actions.

Description

Parameters

$actions

(Optional) WordPress row actions (edit, delete).

Default value: ''

$user

(Optional) The object for the user row.

Default value: null

Return

(null|string|array) Merged actions.

Source

File: bp-members/classes/class-bp-members-admin.php

1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
public function row_actions( $actions = '', $user = null ) {
 
    // Bail if no user ID.
    if ( empty( $user->ID ) ) {
        return;
    }
 
    // Setup args array.
    $args = array();
 
    // Add the user ID if it's not for the current user.
    if ( $user->ID !== $this->current_user_id ) {
        $args['user_id'] = $user->ID;
    }
 
    // Add the referer.
    $wp_http_referer = wp_unslash( $_SERVER['REQUEST_URI'] );
    $wp_http_referer = wp_validate_redirect( esc_url_raw( $wp_http_referer ) );
    $args['wp_http_referer'] = urlencode( $wp_http_referer );
 
    // Add the "Extended" link if the current user can edit this user.
    if ( current_user_can( 'edit_user', $user->ID ) || bp_current_user_can( 'bp_moderate' ) ) {
 
        // Add query args and setup the Extended link.
        $edit_profile      = add_query_arg( $args, $this->edit_profile_url );
        $edit_profile_link = sprintf( '<a href="%1$s">%2$s</a>',  esc_url( $edit_profile ), esc_html__( 'Extended', 'buddyboss' ) );
 
        /**
         * Check the edit action is available
         * and preserve the order edit | profile | remove/delete.
         */
        if ( ! empty( $actions['edit'] ) ) {
            $edit_action = $actions['edit'];
            unset( $actions['edit'] );
 
            $new_edit_actions = array(
                'edit'         => $edit_action,
                'edit-profile' => $edit_profile_link,
            );
 
        // If not available simply add the edit profile action.
        } else {
            $new_edit_actions = array( 'edit-profile' => $edit_profile_link );
        }
 
        $actions = array_merge( $new_edit_actions, $actions );
    }
 
    return $actions;
}

Changelog

Changelog
Version Description
BuddyPress 2.0.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.