Search Results for 'Hide Admin'
-
Search Results
-
I found some code it hide admin profiles from other users and I’d like the same functionality but only for ‘subscribers’ I’d still like all other users to appear.
function hide_admin_profiles() { // Bail if this is not a profile. if ( ! bp_is_user_profile() ) return; if ( ! is_super_admin() ) { if ( is_super_admin( bp_displayed_user_id() ) ) { wp_redirect( home_url() ); exit; } } } add_action( 'init', 'hide_admin_profiles' );I have the following in my functions.php already that might have a usable variable or array already.
It hides the designated roles from the members loop.<?php add_action('bp_ajax_querystring','bpdev_exclude_users',20,2); function bpdev_exclude_users($qs=false,$object=false){ //list of users to exclude $excluded_user=join(',',bpdev_get_subscriber_user_ids());//comma separated ids of users whom you want to exclude if($object!='members')//hide for members only return $qs; $args=wp_parse_args($qs); //check if we are searching for friends list etc?, do not exclude in this case if(!empty($args['user_id'])) return $qs; if(!empty($args['exclude'])) $args['exclude']=$args['exclude'].','.$excluded_user; else $args['exclude']=$excluded_user; $qs=build_query($args); return $qs; } function bpdev_get_subscriber_user_ids(){ $users=array(); $subscribers= get_users( array( 'role' => 'subscriber' ) ); if(!empty($subscribers)){ foreach((array)$subscribers as $subscriber) $users[]=$subscriber->ID; } return $users; } ?>I have installed buddypress and bbpress both in my website http://dreamhomeguide.in where users can create topics on different forums. Now when admin replies any topic other users can easily check the profile page of admin. Is there any way by which I can hide the profile page of admin from other users?
hi everyone, just wondering if anyone knows how to hide data from public view? As i cannot see any great way to implement a membership id number (using membership plugin from wpmu as well), i am pulling in the userid field and displaying on the profile page.
I want only the user and admins to see this userid, i do not want other users to see each others user ids. Here is what i have within member-header.php within child theme so far and works, except hiding from all members.
<?php bp_displayed_user_id(); echo bp_displayed_user_id(); ?>thank you in advance.
I want to hide admin’s activities from all activity feeds in buddypress. I wrote custom code but its not works for me. I copy paste below two codes in wp-content/theme/mytheme/functions.php or wp-content/plugins/bp-custom.php (i was create bp-custom.php file). Kindly help me
Code1:
<?php add_action(“plugins_loaded”,”bpdev_init_sm_mode”); function bpdev_init_sm_mode(){ if(is_site_admin()) remove_action(“wp_head”,”bp_core_record_activity”); //id SM is on, remove the record activity hook } ?>Code2:
<?php // hide admin's activities from all activity feeds function bpfr_hide_admin_activity( $a, $activities ) { // ... but allow admin to see his activities! if ( is_site_admin() ) return $activities; foreach ( $activities->activities as $key => $activity ) { // ID's to exclude, separated by commas. ID 1 is always the superadmin if ( $activity->user_id == 1 ) { unset( $activities->activities[$key] ); $activities->activity_count = $activities->activity_count-1; $activities->total_activity_count = $activities->total_activity_count-1; $activities->pag_num = $activities->pag_num -1; } } // Renumber the array keys to account for missing items $activities_new = array_values( $activities->activities ); $activities->activities = $activities_new; return $activities; } add_action( 'bp_has_activities', 'bpfr_hide_admin_activity', 10, 2 ); ?>I have created a hidden group. The probelm is that when it is done being created, I cannot find it anywhere on the front-end, even if I am an admin. Even in “My Groups”, it has me listed as being a member of 4 groups, but only shows me 3. The hidden one is missing. The only way to access the group is to know the direct URL to the group page. Why is this? How can I see it as an admin or see it as a group member. To hide it completely seem ludicrous. Is that how it is supposed to be?
How we can don’t show certain member roles in the Member widget from BuddyPress? We use the following code for the member overview page, that’s working, but not for the widget.
`/*-----------------------------------------------------------------------------------*/ /* Buddypres don't show roles /*-----------------------------------------------------------------------------------*/ function get_user_ids_by_role($role){ $users=array(); $founded_users = get_users( array( 'role' => $role ) ); if(!empty($founded_users)){ foreach((array)$founded_users as $user) $users[]=$user->ID; } return $users; } function exclude_by_role( $exclude_roles, $implode = true ) { $memberArray = array(); foreach ( $exclude_roles as $exclude_role ) { $memberArray = array_merge($memberArray, get_user_ids_by_role($exclude_role) ); } if( !$implode ) return $memberArray; $theExcludeString = implode( ",", $memberArray ); return $theExcludeString; } add_action('bp_ajax_querystring','bp_exclude_byroles',20, 2); function bp_exclude_byroles($qs=false,$object=false){ if($object!='members') //hide for members only return $qs; $args = wp_parse_args($qs); //check if we are searching for friends list etc?, do not exclude in this case if(!empty($args['user_id'])) return $qs; $excluded_roles = array( 'administrator','employer' ); // you can add roles here $exclude = exclude_by_role( $excluded_roles ); if(!empty($args['exclude'])) $args['exclude']=$args['exclude'].','.$exclude; else $args['exclude'] = $exclude; $qs = build_query($args); return $qs; }'