This topic has 20 replies, 11 voices, and was last updated 9 years by gurpreetsaggu.
-
Author
-
August 5, 2013 at 20:08 #1167angelgallegosParticipant
Hi,
Do you know how can we hide Admin from member loop (most recent, new members and most popular) on homepage and in search results?
Also, how can we prevent users to see Admin profile?
Thanks.
August 5, 2013 at 22:51 #1173SQadminKeymasterHi,
To hide Admin profile you could add this snippet to your sweetdate-child/functions.php:COPY CODE/* Hide admin */ add_action('bp_init', 'kleo_private_admin'); function kleo_private_admin(){ global $bp; if(is_super_admin()) { remove_action("wp_head","bp_core_record_activity"); //id SM is on, remove the record activity hook //then remove the last activity, if present delete_user_meta($bp->loggedin_user->id, 'last_activity'); } } add_action('bp_ajax_querystring','kleo_exclude_users',20,2); function kleo_exclude_users($qs=false,$object=false) { //list of users to exclude $excluded_user='1';//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 listing friends?, 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; }
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionAugust 6, 2013 at 10:35 #1175angelgallegosParticipantHi,
It seems to work to hide Admin from that members loops except popular members, where it is still appearing.
Also, it appears on groups, because Admin create groups… It could be solved if normal users when trying to view admin profile are redirected to their profiles, how can I do that?
Thanks again.
August 7, 2013 at 16:11 #1195SQadminKeymasterHi,
This shows a 404 error on the admin page:COPY CODE// Hide admin profile pages add_action( 'wp', 'hide_profile_template', 1 ); function hide_profile_template() { global $bp; if(bp_is_profile AND $bp->displayed_user->id == 1 AND $bp->loggedin_user->id != 1) : global $wp_query; $wp_query->set_404(); status_header(404); include(locate_template('404.php')); exit; endif; }
For groups just create the groups with another user.
CheersHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionAugust 8, 2013 at 11:07 #1209angelgallegosParticipantHi,
I get an unknown error and I have to restore my sweetchild theme functions.php when I try to add the second code (Admin 404).
Do you know why?
Thanks again, awesome work!
August 8, 2013 at 11:20 #1211SQadminKeymasterHi,
I have modified the above file. The editor transformed some characters.
CheersHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionOctober 6, 2013 at 13:56 #3924notimeParticipantI added the administration code with perfect results, did just what I wanted, I was wondering if this code can be adapted to hide users/members without a paid membership? Which is a good feature for sites that have paid memberships for showing profiles.
October 13, 2013 at 03:36 #4303mpaxtonParticipantWhat would keep the above code from working? I have adapted it to the sweetdate_child theme functions.php, which is all the code that is in that file, other than the standard comments. After doing so, the administrators are still showing in the general member search.
October 14, 2013 at 17:15 #4354SQadminKeymasterHi,
That code hides only the admin with user ID = 1 by default
You need to modify this to match your ids:
$excluded_user=’1′;//comma separated ids of users whom you want to excludeHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionNovember 3, 2013 at 07:28 #5771apine0322ParticipantHow can I remove the admin account from the total member count? If I have 2 members (admin and a free member) it shows 2 members, even though the admin profile is blocked. How can I remove the admin profile so it only says 1 member?
November 4, 2013 at 14:05 #5846SQadminKeymasterHi,
That is a default Buddypress function: bp_total_member_count() that gets all membersHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionNovember 7, 2013 at 15:53 #6189BottossoParticipantHi
I put the code below in my sweetdate-child functions, the problem was solved in members page and “Latest registered members” but the admin user still appear in “Top Members” Please find below the screenshot.
http://cl.ly/image/1Y0S0o1F1C1P
Many Thanks
November 8, 2013 at 19:55 #6279SQadminKeymasterHi, We checked and the admin doesn’t appear. Make sure you login as that admin user and have the codes added to your sweetdate-child/functions.php
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionDecember 15, 2013 at 05:58 #8283rogerboseParticipantThe functions.php file in the sweetdate-child/functions.php, does it need to be blank, or a copy of the functions.php from the sweetdate/ folder?
Also I am seeing the admin photo and profile in the widget that shows (Newest, Active, Popular). I see the photo and profile in the popular, but not in the active.
December 16, 2013 at 12:59 #8346AbeKeymasterHi, the functions.php should be blank, just as you have it when you install the child theme. That widget is buddypress default. Try searching a solution on buddypress forums
Cheers
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.March 3, 2014 at 05:09 #11765robfudge@hotmail.comParticipantThis fix does not hide the admin user from the “Quick profile navigation” for me.
July 17, 2014 at 16:51 #22885collandiParticipantIt works fine with the Members list – but not in the widgets:
– who is online
and
– Recently active members
How can I hide the admin from these widgets?July 21, 2014 at 15:55 #23057AbeKeymasterThose widgets come from Buddypress and we can’t edit them. Try to find a solution on Buddypress forums
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.December 6, 2014 at 14:21 #37878gurpreetsagguParticipantPlease ignore the previous comment. its working like charm 🙂
-
AuthorPosts
The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.