How to hide "Base" group in the edit profile panel?
Being that my site is Username only (I have changed Name to Username in General Settings), I only have that field in Base and other fields in a different group.
How can I hide the Base group in “edit profile” so the user can’t change his username?
Simply, create a child theme, copy the members/single/profile/ edit.php to
Now modify it slightly,
Like put his before the first line of edit.php
<?php bp_profile_group_tabs(); ?>
<p><b>Your Username is your identity and We hate to see you changing your identity, so our computer has decided to disable editing it for you.Please Edit all other data in your profile as you wish
and at the end of Edit.php put this line
Now go and check your profile page.
please let me know if it works or not
Unfortunately, I get parse errors when using the provided code and I’m not PHP savvy enough to debug it (I’m learning PHP as I go along).
You are most welcome. That may be a mismatch of tags.
get the complete code for edit.php here
hope it helps
Wow, thank you Brajesh, it works like a charm.
What gave me the errors is that I didn’t put the <?php endif; ?> in the right place.
Thanks again, I really appreciate it.
Dang, I have to reopen this thread, one thing was solved but another problem was created.
Brajesh’s code solved my “user can’t edit his name field” but I then realized that the registration page only showed the profile name field (which I renamed Username) which was the only field I had in profile group 1.
My problem now is that I need extra fields upon registration but I still want the name field hidden or not editable in the edit profile screen.
Is there something I can change in Brajesh’s code (or new code altogether) that will accomplish this?
how about this one then
<?php global $bp;
At the top of edit.php and removing the old code.
but please note, the base field will be never editable and will not be shown, when ever user will click on edit base field, he will be redirected to edit the second groups field.
let me know what do you think
Hi Brajesh and thanks for the quick response.
I think your code is great but my problem is that the registration page only show whatever fields that are in group 1 (default BP function) and I need a few extra fields to be filled out in the signup page, any way around this such as showing the group 2 fields in register?
hey, you are most welcome.
well, you will need to edit registration.php
here is my take on it.
it will list all the fields from all the profile groups,and allow users to fill them. so please beware of it.
If you want to restrict to 1 or two profile groups, change the argument from
In my edited code and it will work
And a little bit detail, I have removed the argument for bp_has_profile( ), so it lists all profile groups and then put then collected field ids in an array, which is passed via
hidden field ‘signup_profile_field_ids`
Thank you, everything works fantastically well and I’m really grateful that you went out of your way to help me out.
p.s. I read other similar questions on these forums and I hope this thread will help out other members.
Thanks for the code Brajesh! I just had one question. I’ve defined different profile field groups for different user types. I want to restrict the visibility of these filed groups to only those users (e.g. users of type A get to see only those profile fields for user type A). My problem is that when I use your code
<?php global $bp;
it shows the same profile fields for all user types. I guessed it was because 1 is the base profile group ID and tried changing the if loop to
if(bp_get_current_profile_group_id()==ID number of group)
bp_core_redirect($bp->displayed_user->domain.”profile/edit/group/ID number of group”);
but now it shows me only the ‘Editing base profile’ screen
Is this code correct?
You must be logged in to reply to this topic.