bp_get_group_member_demote_link

Generate a URL for demoting a user to member.

Description

(string) bp_get_group_member_demote_link( (int) $user_id = 0, (bool) $group = false ); 

Returns (string)

Parameters (2)

0. $user_id — Optional. (int)
ID of the member to demote. Default: current member in a member loop.
1. $group — Optional. (bool) => false
Group object. Default: current group.

Usage

  1. if ( !function_exists( 'bp_get_group_member_demote_link' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-groups/bp-groups-template.php'; 
  3.  
  4. // ID of the member to demote. Default: current 
  5. // member in a member loop. 
  6. $user_id = -1; 
  7.  
  8. // Optional. Group object. Default: current group. 
  9. $group = false; 
  10.  
  11. // NOTICE! Understand what this does before running. 
  12. $result = bp_get_group_member_demote_link($user_id, $group); 
  13.  

Defined (1)

The function is defined in the following location(s).

/bp-groups/bp-groups-template.php  
  1. function bp_get_group_member_demote_link( $user_id = 0, $group = false ) { 
  2. global $members_template, $groups_template; 
  3.  
  4. if ( empty( $group ) ) { 
  5. $group =& $groups_template->group; 
  6.  
  7. if ( !$user_id ) { 
  8. $user_id = $members_template->member->user_id; 
  9.  
  10. /** 
  11. * Filters a URL for demoting a user to member. 
  12. * @since 1.0.0 
  13. * @since 2.5.0 Added the `$group` parameter. 
  14. * @param string $value URL to use for demoting a user to member. 
  15. * @param object $group Group object. 
  16. */ 
  17. return apply_filters( 'bp_get_group_member_demote_link', wp_nonce_url( bp_get_group_permalink( $group ) . 'admin/manage-members/demote/' . $user_id, 'groups_demote_member' ), $group );