Hi @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/
Hey,
Thank you for your quick reply! 🙂
I added the code to my theme’s functions.php, and replaced ’54’ with the name of the field (I can’t find the ID number anywhere), but that specific field still shows up in profiles/edit fields.
I use the KLEO theme (BuddyPress is integrated), could it be because of that?
Or is there a different way to find the field’s ID number? 🙂
I really appreciate your help, I didn’t expect such a fast and detailed reply! 😀
I use the KLEO theme (BuddyPress is integrated), could it be because of that?
Normally, no.
But as you use a premium theme, don’t except much help here. You also payed for support. If the snippet doesn’t work for you ( i tested it successfully with Twentythirteen before publishing), you have to get in contact with the theme author or read his doc about customization (if exist).
To get the field ID, see it from where the field is created, in xprofile admin. If you hover the delete button, you can see it at the bottom left corner of your browser.
You can also go into the DB and check for it in the bp_xprofile_fields table.
NOTE:
When you get a snippet, the first thing to do is to use it “as is” to test it – this means also “understanding how it works”, not to apply what you think is better. 🙄
And only when the test is ok, you can modify it or try to do so. 😉
Hi,
Again thanks for your quick reply.
Yes, I used the snippet ‘as is’, and then tried to use the field name instead of the ID.
Field name obviously didn’t work, although you could use it too, according to this page:
https://codex.buddypress.org/getting-started/guides/displaying-extended-profile-fields-on-member-profiles/
But I found the profile field ID, and now it works!
Thank you so much :D.
(Yes, KLEO has premium support. But they are very, very slow. I opened a few tickets 1-2 weeks ago, still no replies. Found the answer in the meantime though 😛 ).
You’re welcome ! Glas you got it to work. 😉
But they are very, very slow.
Time is not money for everybody or better said, money is not time for some merchants.