-
Author
-
February 12, 2014 at 09:27 #10890jaybiniParticipant
I want to display ***** in profile tab when user is not a friend for example,
Pin: *******
i already made the tab to be shown only to friends but i want also for public to know there is this field but it cannot be accessed until ur a friend with the other memberFebruary 13, 2014 at 11:10 #10944AbeKeymasterHi, You need to filter that value somehow. There is this filter you can hook into:
bp_get_the_profile_field_valueUse it something like:
add_filter(‘bp_get_the_profile_field_value’, ‘my_value_filter’);
function my_value_filter($value, $type, $id) {
//do your conditions here
return $value;
}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.February 13, 2014 at 12:19 #10946jaybiniParticipanti don’t know how to write the conditions, for example can u make the content of “name” be **** for public users and appears for friends
thank youFebruary 17, 2014 at 22:25 #11044AbeKeymasterHi, This is outside the scope of this support forum. Please hire a developer if you are doing changes to the theme that implies coding.
The below code hides the “I am a” field for non-friendsCOPY CODEadd_filter('bp_get_the_profile_field_value', 'my_value_filter', 10, 3); function my_value_filter($value, $type, $id) { $field = new BP_XProfile_Field( $id ); $field_name = $field->name; if ($field_name == "I am a" && !kleo_bp_is_friend() && !bp_is_my_profile() ) { return '***'; } return $value; } function kleo_bp_is_friend() { global $bp; if ( 'is_friend' == friends_check_friendship_status( $bp->loggedin_user->id, $bp->displayed_user->id ) ) { return true; } return false; }
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. -
AuthorPosts
The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.