How to delete user roles?

$wp_roles = new WP_Roles(); // create new role object $wp_roles->remove_role(‘name_of_role’); If you need to check the name_of_role use $wp_roles->get_names(); you will get an array of name_of_role => Nicename of Role Alternatively, you could use the global object $wp_roles global $wp_roles;

BuddyPress Xprofile check if user can view field [closed]

I found the answer to this question with support from the members from the BuddyPress forum. The function that I needed was xprofile_get_field_data(). Here my code: <?php $hidden_fields = bp_xprofile_get_hidden_fields_for_user(); ?> <?php if(xprofile_get_field_data(‘field_name’) && !in_array(xprofile_get_field_id_from_name(‘field_name’), $hidden_fields)) : ?> <p><?php echo xprofile_get_field_data (‘field_name’); ?></p> <?php endif; ?>

Show buddypress notification in the frontend [closed]

Put the following code in your functions.php. If you want a demo i can show you. // my custom notification menu www.cityflavourmagazine.com function my_bp_adminbar_notifications_menu() { global $bp; if ( !is_user_logged_in() ) return false; echo ‘<li id=”top-notification”>’; _e( ‘Alerts’, ‘buddypress’ ); if ( $notifications = bp_core_get_notifications_for_user( $bp->loggedin_user->id ) ) { ?> <span><?php echo count( $notifications ) … Read more