groups_promote_member( int $user_id, int $group_id, string $status )

Promote a member to a new status within a group.

Description

Parameters

$user_id

(Required) ID of the user.

$group_id

(Required) ID of the group.

$status

(Required) The new status. 'mod' or 'admin'.

Return

(bool) True on success, false on failure.

Source

File: bp-groups/bp-groups-functions.php

2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
function groups_promote_member( $user_id, $group_id, $status ) {
 
    if ( ! bp_is_item_admin() )
        return false;
 
    $member = new BP_Groups_Member( $user_id, $group_id );
 
    // Don't use this action. It's deprecated as of BuddyPress 1.6.
    do_action( 'groups_premote_member', $group_id, $user_id, $status );
 
    /**
     * Fires before the promotion of a user to a new status.
     *
     * @since BuddyPress 1.6.0
     *
     * @param int    $group_id ID of the group being promoted in.
     * @param int    $user_id  ID of the user being promoted.
     * @param string $status   New status being promoted to.
     */
    do_action( 'groups_promote_member', $group_id, $user_id, $status );
 
    return $member->promote( $status );
}

Changelog

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