<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[BuddyPress] [1801] trunk: Added "Admin Options"
menu to buddybar when viewing a user as a site admin.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>1801</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2009-09-06 23:42:31 +0000 (Sun, 06 Sep 2009)</dd>
</dl>
<h3>Log Message</h3>
<pre>Added "Admin Options" menu to buddybar when viewing a user as a site admin. The menu includes "Edit User's Profile", "Change User's Avatar", "Mark as Spammer", "Delete User".</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpactivityphp">trunk/bp-activity.php</a></li>
<li><a href="#trunkbpcorebpcorecatchuriphp">trunk/bp-core/bp-core-catchuri.php</a></li>
<li><a href="#trunkbpcorebpcoreclassesphp">trunk/bp-core/bp-core-classes.php</a></li>
<li><a href="#trunkbpcorephp">trunk/bp-core.php</a></li>
<li><a href="#trunkbpfriendsphp">trunk/bp-friends.php</a></li>
<li><a href="#trunkbpgroupsphp">trunk/bp-groups.php</a></li>
<li><a href="#trunkbpxprofilebpxprofiletemplatetagsphp">trunk/bp-xprofile/bp-xprofile-templatetags.php</a></li>
<li><a href="#trunkbpxprofilephp">trunk/bp-xprofile.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpactivityphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity.php (1800 => 1801)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity.php        2009-09-06 14:11:09 UTC (rev 1800)
+++ trunk/bp-activity.php        2009-09-06 23:42:31 UTC (rev 1801)
</span><span class="lines">@@ -381,6 +381,7 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'wpmu_delete_user', 'bp_activity_remove_data' );
</span><span class="cx"> add_action( 'delete_user', 'bp_activity_remove_data' );
</span><ins>+add_action( 'make_spam_user', 'bp_activity_remove_data' );
</ins><span class="cx">
</span><span class="cx"> /* Ordering function - don't call this directly */
</span><span class="cx"> function bp_activity_order_by_date( $a, $b ) {
</span></span></pre></div>
<a id="trunkbpcorebpcorecatchuriphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-catchuri.php (1800 => 1801)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-catchuri.php        2009-09-06 14:11:09 UTC (rev 1800)
+++ trunk/bp-core/bp-core-catchuri.php        2009-09-06 23:42:31 UTC (rev 1801)
</span><span class="lines">@@ -129,8 +129,7 @@
</span><span class="cx">                         $bp_uri = array_merge( array(), $bp_uri );
</span><span class="cx">                 }
</span><span class="cx">         }
</span><del>-
-
</del><ins>+        
</ins><span class="cx">         if ( !isset($is_root_component) )
</span><span class="cx">                 $is_root_component = in_array( $bp_uri[0], $bp->root_components );
</span><span class="cx">
</span><span class="lines">@@ -240,7 +239,15 @@
</span><span class="cx">         // we are redirecting to an accessable page, so skip this check.
</span><span class="cx">         if ( $bp_no_status_set )
</span><span class="cx">                 return false;
</span><del>-                
</del><ins>+
+        /* If this user has been marked as a spammer and the logged in user is not a site admin, redirect. */
+        if ( isset( $bp->displayed_user->id ) && bp_core_is_user_spammer( $bp->displayed_user->id ) ) {
+                if ( !is_site_admin() )
+                        bp_core_redirect( $bp->root_domain );
+                else
+                        bp_core_add_message( __( 'This user has been marked as a spammer. Only site admins can view this profile.', 'buddypress' ), 'error' );
+        }
+
</ins><span class="cx">         // If this user does not exist, redirect to the root domain.
</span><span class="cx">         if ( !$bp->displayed_user->id && $bp_unfiltered_uri[0] == BP_MEMBERS_SLUG && isset($bp_unfiltered_uri[1]) )
</span><span class="cx">                 bp_core_redirect( $bp->root_domain );
</span></span></pre></div>
<a id="trunkbpcorebpcoreclassesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-classes.php (1800 => 1801)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-classes.php        2009-09-06 14:11:09 UTC (rev 1800)
+++ trunk/bp-core/bp-core-classes.php        2009-09-06 23:42:31 UTC (rev 1801)
</span><span class="lines">@@ -241,8 +241,8 @@
</span><span class="cx">                 
</span><span class="cx">                 like_escape($search_terms);        
</span><span class="cx">
</span><del>-                $total_users_sql = apply_filters( 'bp_core_search_users_count_sql', "SELECT DISTINCT count(u.ID) as user_id FROM " . CUSTOM_USER_TABLE . " u LEFT JOIN {$bp->profile->table_name_data} pd ON u.ID = pd.user_id WHERE pd.value LIKE '%%$search_terms%%' ORDER BY pd.value ASC", $search_terms );
-                $paged_users_sql = apply_filters( 'bp_core_search_users_sql', "SELECT DISTINCT u.ID as user_id FROM " . CUSTOM_USER_TABLE . " u LEFT JOIN {$bp->profile->table_name_data} pd ON u.ID = pd.user_id WHERE pd.value LIKE '%%$search_terms%%' ORDER BY pd.value ASC{$pag_sql}", $search_terms, $pag_sql );
</del><ins>+                $total_users_sql = apply_filters( 'bp_core_search_users_count_sql', "SELECT DISTINCT count(u.ID) as user_id FROM " . CUSTOM_USER_TABLE . " u LEFT JOIN {$bp->profile->table_name_data} pd ON u.ID = pd.user_id WHERE u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND pd.value LIKE '%%$search_terms%%' ORDER BY pd.value ASC", $search_terms );
+                $paged_users_sql = apply_filters( 'bp_core_search_users_sql', "SELECT DISTINCT u.ID as user_id FROM " . CUSTOM_USER_TABLE . " u LEFT JOIN {$bp->profile->table_name_data} pd ON u.ID = pd.user_id WHERE u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND pd.value LIKE '%%$search_terms%%' ORDER BY pd.value ASC{$pag_sql}", $search_terms, $pag_sql );
</ins><span class="cx">
</span><span class="cx">                 $total_users = $wpdb->get_var( $total_users_sql );
</span><span class="cx">                 $paged_users = $wpdb->get_results( $paged_users_sql );
</span></span></pre></div>
<a id="trunkbpcorephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core.php (1800 => 1801)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core.php        2009-09-06 14:11:09 UTC (rev 1800)
+++ trunk/bp-core.php        2009-09-06 23:42:31 UTC (rev 1801)
</span><span class="lines">@@ -354,6 +354,25 @@
</span><span class="cx"> add_action( 'wp', 'bp_core_setup_nav', 2 );
</span><span class="cx"> add_action( 'admin_menu', 'bp_core_setup_nav', 2 );
</span><span class="cx">
</span><ins>+
+/********************************************************************************
+ * Screen Functions
+ *
+ * Screen functions are the controllers of BuddyPress. They will execute when their
+ * specific URL is caught. They will first save or manipulate data using business
+ * functions, then pass on the user to a template file.
+ */
+
+
+/********************************************************************************
+ * Action Functions
+ *
+ * Action functions are exactly the same as screen functions, however they do not
+ * have a template screen associated with them. Usually they will send the user
+ * back to the default screen after execution.
+ */
+
+
</ins><span class="cx"> /**
</span><span class="cx"> * bp_core_action_directory_members()
</span><span class="cx"> *
</span><span class="lines">@@ -378,6 +397,105 @@
</span><span class="cx"> add_action( 'wp', 'bp_core_action_directory_members', 2 );
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * bp_core_action_set_spammer_status()
+ *
+ * When a site admin selects "Mark as Spammer/Not Spammer" from the admin menu
+ * this action will fire and mark or unmark the user and their blogs as spam.
+ * Must be a site admin for this function to run.
+ *
+ * @package BuddyPress Core
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ */
+function bp_core_action_set_spammer_status() {
+        global $bp;
+        
+        if ( !is_site_admin() || bp_is_home() || !$bp->displayed_user->id )
+                return false;
+
+        if ( 'admin' == $bp->current_component && ( 'mark-spammer' == $bp->current_action || 'unmark-spammer' == $bp->current_action ) ) {
+                /* Get the functions file */
+                require( ABSPATH . 'wp-admin/includes/mu.php' );
+                
+                if ( 'mark-spammer' == $bp->current_action )
+                        $is_spam = 1;
+                else
+                        $is_spam = 0;
+
+                /* Get the blogs for the user */
+                $blogs = get_blogs_of_user( $bp->displayed_user->id, true );
+        
+                foreach ( (array) $blogs as $key => $details ) {
+                        /* Do not mark the main or current root blog as spam */
+                        if ( 1 == $details->userblog_id || BP_ROOT_BLOG == $details->userblog_id )
+                                continue;
+                
+                        /* Update the blog status */
+                        update_blog_status( $details->userblog_id, 'spam', $is_spam );
+                
+                        /* Fire the standard WPMU hook */
+                        do_action( 'make_spam_blog', $details->userblog_id );
+                }
+        
+                /* Finally, mark this user as a spammer */
+                update_user_status( $bp->displayed_user->id, 'spam', $is_spam, 1 );
+                
+                if ( $is_spam )
+                        bp_core_add_message( __( 'User marked as spammer. Spam users are visible only to site admins.', 'buddypress' ) );
+                else
+                        bp_core_add_message( __( 'User removed as spammer.', 'buddypress' ) );
+                        
+                do_action( 'bp_core_action_set_spammer_status' );
+                
+                bp_core_redirect( wp_get_referer() );
+        }
+}
+add_action( 'wp', 'bp_core_action_set_spammer_status', 3 );
+
+/**
+ * bp_core_action_delete_user()
+ *
+ * Allows a site admin to delete a user from the adminbar menu.
+ *
+ * @package BuddyPress Core
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ */
+function bp_core_action_delete_user() {
+        global $bp;
+        
+        if ( !is_site_admin() || bp_is_home() || !$bp->displayed_user->id )
+                return false;
+        
+        if ( 'admin' == $bp->current_component && 'delete-user' == $bp->current_action ) {
+                $errors = false;
+                
+                if ( bp_core_delete_account( $bp->displayed_user->id ) ) {
+                        bp_core_add_message( sprintf( __( '%s has been deleted from the system.', 'buddypress' ), $bp->displayed_user->fullname ) );
+                } else {
+                        bp_core_add_message( sprintf( __( 'There was an error deleting %s from the system. Please try again.', 'buddypress' ), $bp->displayed_user->fullname ), 'error' );
+                        $errors = true;
+                }
+                
+                do_action( 'bp_core_action_set_spammer_status', $errors );
+                
+                if ( $errors )
+                        bp_core_redirect( $bp->displayed_user->domain );
+                else
+                        bp_core_redirect( $bp->loggedin_user->domain );
+        }
+}
+add_action( 'wp', 'bp_core_action_delete_user', 3 );
+
+
+/********************************************************************************
+ * Business Functions
+ *
+ * Business functions are where all the magic happens in BuddyPress. They will
+ * handle the actual saving or manipulation of information. Usually they will
+ * hand off to a database class for data access, then return
+ * true or false on success or failure.
+ */
+
+/**
</ins><span class="cx"> * bp_core_get_user_domain()
</span><span class="cx"> *
</span><span class="cx"> * Returns the domain for the passed user:
</span><span class="lines">@@ -956,8 +1074,37 @@
</span><span class="cx">         return apply_filters( 'bp_core_get_userlink_by_username', bp_core_get_userlink( $user_id, false, false, true ) );
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+/**
+ * bp_core_is_user_spammer()
+ *
+ * Checks if the user has been marked as a spammer.
+ *
+ * @package BuddyPress Core
+ * @param $user_id int The id for the user.
+ * @return int 1 if spammer, 0 if not.
+ */
+function bp_core_is_user_spammer( $user_id ) {
+        global $wpdb;
+        
+        return apply_filters( 'bp_core_is_user_spammer', (int) $wpdb->get_var( $wpdb->prepare( "SELECT spam FROM " . CUSTOM_USER_TABLE . " WHERE ID = %d", $user_id ) ) );
+}
</ins><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * bp_core_is_user_deleted()
+ *
+ * Checks if the user has been marked as deleted.
+ *
+ * @package BuddyPress Core
+ * @param $user_id int The id for the user.
+ * @return int 1 if deleted, 0 if not.
+ */
+function bp_core_is_user_deleted( $user_id ) {
+        global $wpdb;
+        
+        return apply_filters( 'bp_core_is_user_spammer', (int) $wpdb->get_var( $wpdb->prepare( "SELECT deleted FROM " . CUSTOM_USER_TABLE . " WHERE ID = %d", $user_id ) ) );         
+}
+
+/**
</ins><span class="cx"> * bp_core_format_time()
</span><span class="cx"> */
</span><span class="cx"> function bp_core_format_time( $time, $just_date = false ) {
</span><span class="lines">@@ -1328,21 +1475,24 @@
</span><span class="cx"> * @uses is_site_admin() Checks to see if the user is a site administrator.
</span><span class="cx"> * @uses wpmu_delete_user() Deletes a user from the system.
</span><span class="cx"> */
</span><del>-function bp_core_delete_account() {
</del><ins>+function bp_core_delete_account( $user_id = false ) {
</ins><span class="cx">         global $bp;
</span><span class="cx">
</span><ins>+        if ( !$user_id )
+                $user_id = $bp->loggedin_user->id;
+
</ins><span class="cx">         /* Make sure account deletion is not disabled */
</span><del>-        if ( 1 == (int)get_site_option( 'bp-disable-account-deletion' ) )
</del><ins>+        if ( ( 1 == (int)get_site_option( 'bp-disable-account-deletion' ) && !is_site_admin() ) )
</ins><span class="cx">                 return false;
</span><span class="cx">
</span><del>-        /* Site admins should not be allowed to delete their accounts */
-        if ( is_site_admin() )
</del><ins>+        /* Site admins should not be allowed to be deleted */
+        if ( is_site_admin( bp_core_get_username( $user_id ) ) )
</ins><span class="cx">                 return false;
</span><span class="cx">
</span><span class="cx">         require_once( ABSPATH . '/wp-admin/includes/mu.php' );
</span><span class="cx">         require_once( ABSPATH . '/wp-admin/includes/user.php' );
</span><span class="cx">
</span><del>-        return wpmu_delete_user( $bp->loggedin_user->id );
</del><ins>+        return wpmu_delete_user( $user_id );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -1514,8 +1664,8 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'wpmu_delete_user', 'bp_core_remove_data', 1 );
</span><span class="cx"> add_action( 'delete_user', 'bp_core_remove_data', 1 );
</span><ins>+add_action( 'make_spam_user', 'bp_core_remove_data', 1 );
</ins><span class="cx">
</span><del>-
</del><span class="cx"> /**
</span><span class="cx"> * bp_load_buddypress_textdomain()
</span><span class="cx"> *
</span></span></pre></div>
<a id="trunkbpfriendsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-friends.php (1800 => 1801)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-friends.php        2009-09-06 14:11:09 UTC (rev 1800)
+++ trunk/bp-friends.php        2009-09-06 23:42:31 UTC (rev 1801)
</span><span class="lines">@@ -703,6 +703,7 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'wpmu_delete_user', 'friends_remove_data', 1 );
</span><span class="cx"> add_action( 'delete_user', 'friends_remove_data', 1 );
</span><ins>+add_action( 'make_spam_user', 'friends_remove_data', 1 );
</ins><span class="cx">
</span><span class="cx"> function friends_clear_friend_object_cache( $friendship_id ) {
</span><span class="cx">         if ( !$friendship = new BP_Friends_Friendship( $friendship_id ) )
</span></span></pre></div>
<a id="trunkbpgroupsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups.php (1800 => 1801)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups.php        2009-09-06 14:11:09 UTC (rev 1800)
+++ trunk/bp-groups.php        2009-09-06 23:42:31 UTC (rev 1801)
</span><span class="lines">@@ -2565,6 +2565,7 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'wpmu_delete_user', 'groups_remove_data_for_user', 1 );
</span><span class="cx"> add_action( 'delete_user', 'groups_remove_data_for_user', 1 );
</span><ins>+add_action( 'make_spam_user', 'groups_remove_data_for_user', 1 );
</ins><span class="cx">
</span><span class="cx"> function groups_clear_group_object_cache( $group_id ) {
</span><span class="cx">         wp_cache_delete( 'groups_group_nouserdata_' . $group_id, 'bp' );
</span></span></pre></div>
<a id="trunkbpxprofilebpxprofiletemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-xprofile/bp-xprofile-templatetags.php (1800 => 1801)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-xprofile/bp-xprofile-templatetags.php        2009-09-06 14:11:09 UTC (rev 1800)
+++ trunk/bp-xprofile/bp-xprofile-templatetags.php        2009-09-06 23:42:31 UTC (rev 1801)
</span><span class="lines">@@ -564,7 +564,7 @@
</span><span class="cx">                 }
</span><span class="cx">                 
</span><span class="cx">                 if ( $groups[$i]->fields )
</span><del>-                        echo '<li' . $selected . '><a href="' . $bp->loggedin_user->domain . $bp->profile->slug . '/edit/group/' . $groups[$i]->id . '">' . $groups[$i]->name . '</a></li>';
</del><ins>+                        echo '<li' . $selected . '><a href="' . $bp->displayed_user->domain . $bp->profile->slug . '/edit/group/' . $groups[$i]->id . '">' . $groups[$i]->name . '</a></li>';
</ins><span class="cx">         }
</span><span class="cx">         
</span><span class="cx">         do_action( 'xprofile_profile_group_tabs' );
</span><span class="lines">@@ -654,7 +654,7 @@
</span><span class="cx">         function bp_get_avatar_delete_link() {
</span><span class="cx">                 global $bp;
</span><span class="cx">                 
</span><del>-                return apply_filters( 'bp_get_avatar_delete_link', wp_nonce_url( $bp->loggedin_user->domain . $bp->profile->slug . '/change-avatar/delete-avatar/', 'bp_delete_avatar_link' ) );
</del><ins>+                return apply_filters( 'bp_get_avatar_delete_link', wp_nonce_url( $bp->displayed_user->domain . $bp->profile->slug . '/change-avatar/delete-avatar/', 'bp_delete_avatar_link' ) );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx"> function bp_get_user_has_avatar() {
</span></span></pre></div>
<a id="trunkbpxprofilephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-xprofile.php (1800 => 1801)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-xprofile.php        2009-09-06 14:11:09 UTC (rev 1800)
+++ trunk/bp-xprofile.php        2009-09-06 23:42:31 UTC (rev 1801)
</span><span class="lines">@@ -225,6 +225,46 @@
</span><span class="cx"> add_action( 'admin_menu', 'xprofile_setup_nav', 2 );
</span><span class="cx">
</span><span class="cx">
</span><ins>+/**
+ * xprofile_setup_adminbar_menu()
+ *
+ * Adds an admin bar menu to any profile page providing site admin options for that user.
+ *
+ * @package BuddyPress XProfile
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ */
+function xprofile_setup_adminbar_menu() {
+        global $bp;
+        
+        if ( !$bp->displayed_user->id )
+                return false;
+        
+        /* Don't show this menu to non site admins or if you're viewing your own profile */
+        if ( !is_site_admin() || bp_is_home() )
+                return false;
+        ?>
+        <li id="bp-adminbar-adminoptions-menu">
+                <a href=""><?php _e( 'Admin Options', 'buddypress' ) ?></a>
+                
+                <ul>
+                        <li><a href="<?php echo $bp->displayed_user->domain . $bp->profile->slug ?>/edit/"><?php printf( __( "Edit %s's Profile", 'buddypress' ), attribute_escape( $bp->displayed_user->fullname ) ) ?></a></li>
+                        <li><a href="<?php echo $bp->displayed_user->domain . $bp->profile->slug ?>/change-avatar/"><?php printf( __( "Edit %s's Avatar", 'buddypress' ), attribute_escape( $bp->displayed_user->fullname ) ) ?></a></li>
+                        
+                        <?php if ( !bp_core_is_user_spammer( $bp->displayed_user->id ) ) : ?>
+                                <li><a href="<?php echo $bp->displayed_user->domain ?>admin/mark-spammer/" class="confirm"><?php _e( "Mark as Spammer", 'buddypress' ) ?></a></li>
+                        <?php else : ?>
+                                <li><a href="<?php echo $bp->displayed_user->domain ?>admin/unmark-spammer/" class="confirm"><?php _e( "Not a Spammer", 'buddypress' ) ?></a></li>
+                        <?php endif; ?>
+                        
+                        <li><a href="<?php echo $bp->displayed_user->domain ?>admin/delete-user/" class="confirm"><?php printf( __( "Delete %s", 'buddypress' ), attribute_escape( $bp->displayed_user->fullname ) ) ?></a></li>
+                        
+                        <?php do_action( 'xprofile_adminbar_menu_items' ) ?>
+                </ul>
+        </li>
+        <?php
+}
+add_action( 'bp_adminbar_menus', 'xprofile_setup_adminbar_menu', 20 );
+
</ins><span class="cx"> /********************************************************************************
</span><span class="cx"> * Screen Functions
</span><span class="cx"> *
</span></span></pre>
</div>
</div>
</body>
</html>