Search Results for 'bpfr_hide_profile_edit'
-
AuthorSearch Results
-
October 24, 2016 at 8:50 am #260210
In reply to: Hide xProfile fields from EDIT
danbpParticipant– Single profile page. From show tab and from EDIT tab (see snippet)
– From dashboard profile edit page: not possible – normally BP users shouldn’t have access to profile dashboard. They can manage their profile from front-end.
– From custom profile fields. (see snippet)
– From tabs every where. (see snippet)Almost any described areas, as example
function bpfr_hide_profile_edit( $retval ) { // remove field from edit tab if( bp_is_profile_edit() ) { $retval['exclude_fields'] = '54'; // ID's separated by comma } // allow field on register page if ( bp_is_register_page() ) { $retval['include_fields'] = '54'; // ID's separated by comma } // hide the field on profile view tab if ( $data = bp_get_profile_field_data( 'field=54' ) ) : $retval['exclude_fields'] = '54'; // ID's separated by comma endif; return $retval; } add_filter( 'bp_after_has_profile_parse_args', 'bpfr_hide_profile_edit' );
August 20, 2015 at 10:50 pm #243428danbpParticipantYou could also use one of these snippet in bp-custom
December 17, 2014 at 6:20 pm #230718In reply to: [Resolved] Hide possibility to change 'Base' name
danbpParticipantWhen BP is installed and xProfile is activated, the original WP profile settings are not accessible to user.
The WP register process use only username, password and email and BuddyPress add by default a Name field as base for other extended profile fields.
In short this means that username and name fields can contain a same information(a name, a pseudonym, a first or/and a last name). The plugin you mention is best for a WP install where user had choosen first/last name as output on post, comments, etc Once BP is activated, this became a little different.
Now to the initial question.
The CSS trick is a very inelegant solution as it lets everybody knowing how BP works to surround this invisibility. You’re also loosing any flexibility if you want to show some fields privately for example.You can do this properly with a little snippet, as explained here:
Here’s an example which let you hide fields or fiels group to members, but not to site admin
function bpfr_hide_profile_field_group( $retval ) { if ( bp_is_active( 'xprofile' ) ) : // hide profile group/field to all except admin if ( !is_super_admin() ) { //exlude fields, separated by comma $retval['exclude_fields'] = '1'; //exlude groups, separated by comma $retval['exclude_groups'] = '1'; } return $retval; endif; } add_filter( 'bp_after_has_profile_parse_args', 'bpfr_hide_profile_field_group' );
Add it to bp-custom.php or your child-theme functions.php
Of course you can also choose to show a field or group, but remove the possibility for the user to edit it later. Simply add more conditionnal to the function.
Here another example:
function bpfr_hide_profile_edit( $retval ) { // remove field from edit tab if( bp_is_user_profile_edit() ) { $retval['exclude_fields'] = '54'; // ID's separated by comma } // allow field on register page if ( bp_is_register_page() ) { $retval['include_fields'] = '54'; // ID's separated by comma } // hide the field on profile view tab if ( $data = bp_get_profile_field_data( 'field=54' ) ) : $retval['exclude_fields'] = '54'; // ID's separated by comma endif; return $retval; } add_filter( 'bp_after_has_profile_parse_args', 'bpfr_hide_profile_edit' );
Hope to be clear.
December 15, 2014 at 8:45 pm #230638In reply to: Making Certain Xporfile fields ReadOnly or Locked
danbpParticipantAdd this snippet to your child-theme functions.php or bp-custom.php
function bpfr_hide_profile_edit( $retval ) { // remove field from edit tab if( bp_is_profile_edit() ) { $retval['exclude_fields'] = '2'; // field ID's separated by comma } // allow field on register page if ( bp_is_register_page() ) { $retval['include_fields'] = '2'; // field ID's separated by comma } // hide the field on profile view tab if ( $data = bp_get_profile_field_data( 'field=2' ) ) : $retval['exclude_fields'] = '2'; // field ID's separated by comma endif; return $retval; } add_filter( 'bp_after_has_profile_parse_args', 'bpfr_hide_profile_edit' );
August 23, 2014 at 8:49 am #188312danbpParticipantHi @ww2boy,
Yes ! 😉 Give this a try. Add it to child theme’s functions.php or bp-custom.php
function bpfr_hide_profile_edit( $retval ) { // remove field from edit tab if( bp_is_profile_edit() ) { $retval['exclude_fields'] = '54'; // ID's separated by comma } // allow field on registration page if ( bp_is_register_page() ) { $retval['include_fields'] = '54'; // ID's separated by comma } // hide the filed on profile view tab if ( $data = bp_get_profile_field_data( 'field=54' ) ) : $retval['exclude_fields'] = '54'; // ID's separated by comma endif; return $retval; } add_filter( 'bp_after_has_profile_parse_args', 'bpfr_hide_profile_edit' );
Codex reference:
https://codex.buddypress.org/plugindev/using-bp_parse_args-to-filter-buddypress-template-loops/ -
AuthorSearch Results