modify buddpress adminbar only in admin pages

You ca use the conditional tag is_admin() to check if you are on the front-end or back-end like this: function bp_adminbar_currentsite_menu() { global $bp; if (!is_admin()){ ?> <li> <!– Insert your link url or relative url, and your link text below –> <a href=”http://EXAMPLE.COM”>EXAMPLE LINK TEXT</a> </li> <?php } } // Call The Function Above … Read more

Delete user account – If user has attachments uploaded then redirect (with a message) [closed]

I got it: function custom_get_count_before_delete() { global $bp, $wpdb; $user_id = $bp->loggedin_user->id; return $wpdb->get_var( $wpdb->prepare( ” SELECT COUNT(DISTINCT p.ID) FROM $wpdb->posts p WHERE p.post_author = %d AND p.post_status=”inherit” AND p.post_type=”attachment””, $user_id ) ); } function custom_check_delete_account() { global $bp; if ( $bp->current_component == ‘settings’ && $bp->current_action == ‘delete-account’ ) { if ( $count = custom_get_count_before_delete() … Read more