Hide activities of the administrator
-
Googled around, an older examples won’t work with the current version of BuddyPress 2.4.3. How to make sure that the activities of the Administrator isn’t recorded or not shown, sitewide / plugins / etc….
Prefer to add this in: bp-custom.php
Thank yo in advance.
Code what i had found:
<?php // Don’t record activity by the site admins or show them as recently active function my_admin_stealth_mode(){ if ( is_site_admin() ) { global $bp; remove_action(‘wp_head’,’bp_core_record_activity’); delete_user_meta($bp->loggedin_user->id, ‘last_activity’); } ?>
Here’s another code, this removes the activity of the currently logged in user itself from the page, this still works:
But obviously it wont hide the administrator’s activity in the users perspective!<?php //filter on pre_user_query add_action( 'pre_user_query', 'devb_exclude_loggedin_user', 201 ); function devb_exclude_loggedin_user( $query ) { //don't modify the query if the user is not logged in if ( !is_user_logged_in() ) return; //do not hide users inside the admin if ( is_admin() && !defined('DOING_AJAX') ) return; $qv = $query->query_vars; global $wpdb; //hide $query->query_where .= $wpdb->prepare(" AND {$wpdb->users}.ID !=%d ", get_current_user_id()); } ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Hide activities of the administrator’ is closed to new replies.