bp_member_type_wprole_metabox( WP_Post $post )
Generate profile type WP Role Meta box
Description
Parameters
- $post
-
(Required)
Source
File: bp-core/admin/bp-core-admin-functions.php
function bp_member_type_wprole_metabox( $post ) { global $wp_roles; $all_roles = $wp_roles->role_names; //remove bbPress roles unset($all_roles['bbp_keymaster']); unset($all_roles['bbp_spectator']); unset($all_roles['bbp_blocked']); unset($all_roles['bbp_moderator']); unset($all_roles['bbp_participant']); $selected_roles = get_post_meta($post->ID, '_bp_member_type_wp_roles', true); $selected_roles = (array) $selected_roles; ?> <p><?php _e( 'Users of this profile type will be auto-assigned to the following WordPress roles (includes existing users):', 'buddyboss' ); ?></p> <p> <label for="bp-member-type-roles-none"> <input type='radio' name='bp-member-type[wp_roles][]' id="bp-member-type-roles-none" value='' /> <?php _e( '(None)', 'buddyboss' ) ?> </label> </p> <?php empty( $selected_roles[0] ) ? $selected_roles = array('subscriber') : '' ; if( isset($all_roles) && !empty($all_roles) ){ foreach($all_roles as $key => $val){ ?> <p> <label for="bp-member-type-wp-roles-<?php echo $key ?>"> <input type='radio' name='bp-member-type[wp_roles][]' id="bp-member-type-wp-roles-<?php echo $key ?>" value='<?php echo $key;?>' <?php echo in_array($key, $selected_roles) ? 'checked' : ''; ?> /> <?php echo $val; ?> </label> </p> <?php } } }
Changelog
Version | Description |
---|---|
BuddyBoss 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.