Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to hide "Base" group in the edit profile panel?


  • Gene53
    Participant

    @gene53

    Hi,

    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?

    Cheers,

    Gene

Viewing 12 replies - 1 through 12 (of 12 total)

  • Brajesh Singh
    Participant

    @sbrajesh

    Simply, create a child theme, copy the members/single/profile/ edit.php to

    yourchild-theme/members/single/profile/edit.php

    Now modify it slightly,

    Like put his before the first line of edit.php

    <?php if(bp_get_current_profile_group_id()==1):?>
    <ul class="button-nav">
    <?php bp_profile_group_tabs(); ?>
    </ul>
    <div class="clear"></div>
    <?php
    locate_template(array("members/single/profile/profile-loop.php"),true);?>
    <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 :)
    </b>
    </p>
    <?php
    else:?>

    and at the end of Edit.php put this line

    <?php endif;?>

    Now go and check your profile page.

    please let me know if it works or not


    Gene53
    Participant

    @gene53

    Thanks Brajesh,

    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).

    Cheers,

    Gene


    Brajesh Singh
    Participant

    @sbrajesh

    hi Gene

    You are most welcome. That may be a mismatch of tags.

    get the complete code for edit.php here

    http://bpdev.pastebin.com/SP6eWZDq

    hope it helps


    Gene53
    Participant

    @gene53

    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.

    Gene


    Gene53
    Participant

    @gene53

    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?

    Thanks,

    Gene


    Brajesh Singh
    Participant

    @sbrajesh

    hi Gene

    how about this one then

    <?php global $bp;
    if(bp_get_current_profile_group_id()==1)
    bp_core_redirect($bp->displayed_user->domain."profile/edit/group/2");
    ?>

    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 :)


    Gene53
    Participant

    @gene53

    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?

    Thanks,

    Gene


    Brajesh Singh
    Participant

    @sbrajesh

    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.

    http://bpdev.pastebin.com/RLreXE7X

    If you want to restrict to 1 or two profile groups, change the argument from

    bp_has_profile( )

    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`


    Gene53
    Participant

    @gene53

    Hi Brajesh,

    Thank you, everything works fantastically well and I’m really grateful that you went out of your way to help me out.

    Thanks again,

    Gene

    p.s. I read other similar questions on these forums and I hope this thread will help out other members.


    Brajesh Singh
    Participant

    @sbrajesh

    no problem, You are most welcome :)


    sdpkelkar
    Member

    @sdpkelkar

    Hi.
    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;
    if(bp_get_current_profile_group_id()==1)
    bp_core_redirect($bp->displayed_user->domain.”profile/edit/group/2″);
    ?>

    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?

    Cheers


    mistercyril
    Participant

    @mistercyril

    @sdpkelkar

    Hello, did you ever find the solution for this?

    Thanks,
    C.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘How to hide "Base" group in the edit profile panel?’ is closed to new replies.
Skip to toolbar