Private Profiles
-
I want only subscribers to have access to member profiles. How do I ensure only subscribers can view member profiles?
-
I am interested in this as well:
– the BASIC profile-information about the user should be publicly visible.
– the DETAILED profile-information about the user should only be visible for registered users.
any chance to get this implemented into the official release of BP 1.1 (prior to Jeff Sayre´s Privacy-Plugin) ?
Many thanks,
One way is to use the “is_user_logged_in()” function in the profile loop (normally, “profile-loop.php” in the member theme).
You need to use that in conjunction with (bp_get_the_profile_group_name() == “BASIC”), where BASIC is the base profile group name you specified in the BP dashboard settings, to test whether you’re on the BASIC profile.
No, this sort of privacy change isn’t going to get into BP 1.1.
@Reboot Now – for the non-programming readers, such as myself, could you suggest some code that could be dropped in?
To be clear, the core privacy component will offer users the ability to decide which pieces of their core-created data they want to make available to which users (or groups of users). It will not offer a mechanism to hide data from people who are not “subscribers” as subscriber is not a BuddyPress user classification or level.
For more details, I’ve created a new thread about my plugin.
This is a little risky for a non-programmer, but here is some code that would replace the profile-loop.php file in the skeleton member theme. Note that this theme is deprecated in the new parent-child theme setup. It is also not a sophisticated privacy component like the one Jeff is working on. It simply omits everything except the base profile fieldset when a non-member views the profile.
This is from my own installation, but I have removed some pieces (mostly formatting) to simplify things a bit. I haven’t tested it in the simplified form.
It assumes that “Base” is the base profile group name you specified in the BP dashboard settings.
<?php
/*
* /profile/profile-loop.php
* This file loops through the profile field groups, and then each profile field to
* display the profile information that a user has entered.
*
* Loaded by: 'profile/index.php' (via the xprofile_get_profile() template tag)
*/
?>
<?php if ( bp_has_profile() ) : ?>
<?php while ( bp_profile_groups() ) : bp_the_profile_group(); ?>
<?php if ( (bp_get_the_profile_group_name() == "Base") || ( is_user_logged_in() ) ) : ?>
<div class="info-group">
<?php if ( bp_group_has_fields() ) : ?>
<h4><?php bp_the_profile_group_name() ?></h4>
<table class="profile-fields">
<?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?>
<?php if ( bp_field_has_data() ) : ?>
<tr<?php bp_field_css_class() ?>>
<td class="label">
<?php bp_the_profile_field_name() ?>
</td>
<td class="data">
<?php bp_the_profile_field_value() ?>
</td>
</tr>
<?php endif; ?>
<?php endwhile; ?>
</table>
<?php else : ?>
<h4><?php bp_the_profile_group_name() ?></h4>
No info yet.
<?php endif; ?>
</div>
<?php endif; ?>
<?php endwhile; ?>
<?php if ( !is_user_logged_in() ) : ?>
<p class="not-a-member">You need to log in to see full member profiles.</p>
<?php endif; ?>
<?php else: ?>
<div id="message" class="info">
<p><?php _e( 'Sorry, this person does not have a public profile.', 'buddypress' ) ?></p>
</div>
<?php endif;?>Thanks Reboot Now – and wordpressfan for suggesting it in the first place. Will definitely look into giving this code a try prior to future BP work as this is very important for privacy, especially for children, who will potentially be a significant part of a site I am working on. Membership will be verified to ensure protection of the children’s private information while allowing them to participate fully in the community.
Maybe someone could take this and turn it into a plugin…?
@Jeff Sayre – your plugin is also useful as it gives a universal (i.e. WP not just BP) and individual-focussed privacy option, which is also very important. good work!
Me too! An privacy option is very important. This http://devbox.computec.de/2009/06/buddypress-xprofile-privacy-plugin/ does not work with 1.1
Edit: it does work! But user must select before. But privacy fields like birthday etc. should never be visible for guest. Maybe with an click to activate, but at the moment thats not good.
The solution you linked to does not work with BP 1.1 because it relies on a core function that is now deprecated. It also relies on hacking a core file, which is never a good idea.
My Privacy Component will be out soon.
Ha, faster :o) Jap, the plugin works to 50%, but the changes in bp core will this version not support. We will wait for your plugin, before i will not go online with the (beta :p) page.
- The topic ‘Private Profiles’ is closed to new replies.