Members’ privacy: how can I hide members’ profiles?
-
Hi everybody
I am thinking of creating a social network in which members (and their profiles as well) will be visible
ONLY to other members who are already logged in, like in Facebook or Linked-In.
I don’t want visitors to bump into my website and see a list of members.I know that there have been talks of introducing plug-ins that would address this problem, but it seems that no such plug-ins have yet materialized.
So, can anyone suggest me how to modify the relevant BP code or any other action that can help me solve this problem?
-
`
the thing you want to hide
`I know I`m tooting my own horn here , but my BuddyBuilder theme enables you to allow user access to individual BP components and WP pages/posts depending on logged-in/logged-out status. It also provides an optional Site Lockdown feature with/without a Splashpage on the frontpage, and an optional custom redirect page if Site Lockdown is enabled. See the bottom of the right-hand column on this page for all the Privacy features available: http://buddylite.com/buddybuilder-options/
Yes, pcwriter, I have visited the website, it offers quite a few worthwhile solutions, thanks a lot.
Hi there nit3watch
Thanks a million for the reply.
However (sorry, I am just a beginner), where precisely can I find this function, is_user_logged_in() , in which folder and in which file exactly?And it seems to me that with the son to be released BP 1.3, there will be the in-built option to hide members’ profile from visitors (just like in Facebook or Linked-In), am I right?
I’ve been using S2member. Works Great! I think you’ll find it does what you need, and then some.
yeh George I too would like to know where to place that code tweek that nit3watch mentioned, I’m trying to keep my members profiles from being viewed by the public and tried with no avail to find where to write that edit.
The file you want to edit is members/single/home
Make sure you edit the file in your child-theme, not bp-default, or you will lose your changes when you update Buddypress.
Add the following just after the opening padder div tag (change the text to suit your site/users):`
`
Then add this to close the conditional just before the closing padder div tag:
``
thanks for the reply @pcwriter
If you don’t mind I need a little more assistance with this (as I’m not code savvy)
how do I find this ‘child-theme’ you mention
do I go to cpanel..? or in my admin (dashboard)Also, I do not want to restrict ‘members’ viewing, only their ‘profiles’
You have to create a child theme by yourself.
follow this steps. https://codex.buddypress.org/theme-development/building-a-buddypress-child-theme/
hi nailaping thanks for the reply
ok im gonna attempt to this, although this may seem simple for some, believe me this is a big deal for me so ill need this broken downok i go to cpanel, logged in..now where do i go to begin the child theme construction..?
Home Directory
Web Root (public_html/www)
Public FTP Root (public_ftp)
or
Document Root for: ?Where are your main site files located Kenny?
Looking through those folders would answer the question. On a Web server you can only serve public site files from one directory the web root variously referred to as ‘www’, ‘public_html’. All your WP files are in there WP themes are held in the directory ‘themes’ under ‘wp-content’ you must create a new folder called whatever you like in that you create a file named style.css and in that file you add the text shown in the guide and from this point on you need to follow the guide explicitly.
You might be wise to allocate a little time to a quick read of some of the basics in the WP codex which may help your understanding of how WP works ( child themes are a WP construct)
by jove i think ive got it !!
put pcwriters code in and hey presto
I edited in ‘code edit’ instead of edit..is this right?
well it worked anyway lol
big thanks !!
just realised I need to restrict my members activity posts to registered users..
using hindsight if I use the same code and principle in: members/single/activity/permalinks
this will prevent non-members from viewing registered/logged-in members posts right..?
or am I jumping the gun a bit here
* update* – just tried it..didn’t work
maybe I need to edit in: members/single/activity.php..? is this right anyone? thanks
bump
Derived from the above link, I use the following in a bp-custom.php file to exclude users that are not logged in from seeing the activity or members areas.
function sh_walled_garden()
{
global $bp;if( bp_is_register_page() || bp_is_activation_page() || bp_is_page( BP_FORUMS_SLUG ) || bp_is_page( BP_GROUPS_SLUG ) )
return;if( ! bp_is_blog_page() && ! is_user_logged_in() )
bp_core_redirect( $bp->root_domain .'/'. BP_REGISTER_SLUG );
}
add_action( 'get_header', 'sh_walled_garden' );
In bp-custom.php the above needs to be placed in a plain text file with “ at the end of the file….@pinhit Kenny this is what I mentioned on your other thread and is now an example of where there are too many posts revolving around the same question . This solution (read the whole thread linked to above for full understanding) will work to limit access to directories or in the version above it permits access to specific pages and if not in that list of allowed directs to the signup page. I think this is your best solution rather than to try and restrict drilled down aspects of pages.
I’ll close the other thread as it is redundant now.
In case it helps there are options to the above you could try; you can add:
bp_is_directory() to allow access to all the main BP dir pages ‘Activity’, ‘Members’, ‘Blogs’, ‘Groups’ but trying to drill down any further on links in those pages would result in redirecting to register page:
`if( bp_is_register_page() || bp_is_activation_page() || bp_is_directory() )`
thanks for the reply guys
Is there way of using the above code to simply display a notice along the lines of ‘you must be logged in to view this content’
as apposed to redirecting them to the register page, as I don’t really want that great big wordpress logo staring at them lolSo as I see it, I have to create the bp-custom.php file to place the code in right ?
If you want to do that then you’re best to revert back to the code example that was given on one of the other threads and work on the individual files.
Or try removing the concatenated slug for the register page and just redirect to whatever is shown as your home or index page.
Yes bp-custom.php doesn’t exist it has to be created, this code should also work in functions.php.
you mean this code example right ?
`
`
Then add this to close the conditional just before the closing padder div tag:``
ok, if you could just let me know what file/s to edit I’ll be able to have a go at it
thanks
* oh this is to hide the members details on the members ‘page’ by the way, as the original post was closed.
similar to this: http://swapbbm.com/members/
bump
did you not manage to this kenny?
@joshal99 It worked but it didnt do exactly what I wanted specifically.
What I wanted to do was to achieve something like the activity wall on this site: http://www.swapbbm.com
unfortunately the above code hides the whole of the activity stream and to date no-one has managed to help me nail this issue.
Just email them and ask them how they achieved it? I would
- The topic ‘Members’ privacy: how can I hide members’ profiles?’ is closed to new replies.