Skip to:
Content
Pages
Categories
Search
Top
Bottom

Change Group Member Slug


  • MonkimoE
    Participant

    @monkimoe

    Hello world,

    I want change group member slug:
    mydomain.com/group/group-name/members
    to
    mydomain.com/group/group-name/fans

    I already change all “members” text to “fans” in my language .po file.
    But the site url still have /members on it.

    http://i.imgur.com/cIzLKNB.png

    I already try with bp-custom.php
    define( 'BP_MEMBERS_SLUG', 'fans' );
    still not working

    Any guide for this?

    Thank you.

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

  • Security
    Participant

    @shivam-kumar

    try checking using an incognito or private window after adding the above line your site and browser may be loading a cached version of your site due to which you won be able to see the changes
    Thanks


    MonkimoE
    Participant

    @monkimoe

    Hi, I already try that with different browser, also clear my browser cache.
    But still not working.

    Is that a correct code in bp-custom.php to achieve what I need?

    Thank you.


    Security
    Participant

    @shivam-kumar

    hi try this just retype each quotes sign manually in the above code, i am asking you to do this cos you would have copied the code from some site which brings changes in the unicode characters used, use the quotes sign which is found by the side of enter key in keyboard this should make the code work
    Note that there are two signs which looks like single quote but are different one is near the enter key the ” ‘ and the other just before the No. 1 in numbers row ~`
    Thanks


    MonkimoE
    Participant

    @monkimoe

    Yes, I already notice that.
    I use sublime editor so it’s looks the difference colour when something is not right.

    I’m afraid my bp-custom.php not loaded. even I put in folder wp-content/plugins/
    Is there any simple code to making sure the bp-custom.php is loaded first?

    Thank you for your help. really appreciate it…


    MonkimoE
    Participant

    @monkimoe

    I test with
    define ( 'BP_GROUPS_SLUG', 'band' );
    it’s work.

    BP_MEMBERS_SLUG is not work.


    MonkimoE
    Participant

    @monkimoe

    Ah.. I see..

    BP_MEMBERS_SLUG is works for members main url, something like this:
    mydomain.com/members/ ..
    to
    mydomain.com/fans/ ..

    Ok. once again, what I want to change is in Group tabs.
    mydomain.com/group/group-name/fans

    What SLUG i must define to change that?
    All I can found only these:

    BP_ACTIVITY_SLUG
    BP_BLOGS_SLUG
    BP_MEMBERS_SLUG
    BP_FRIENDS_SLUG
    BP_GROUPS_SLUG
    BP_FORUMS_SLUG
    BP_MESSAGES_SLUG
    BP_WIRE_SLUG
    BP_XPROFILE_SLUG
    BP_REGISTER_SLUG
    BP_ACTIVATION_SLUG
    BP_SEARCH_SLUG
    BP_HOME_BLOG_SLUG


    Security
    Participant

    @shivam-kumar

    Ok then make sure you are placing this line of code some where above the function which you have used to rename the members tab to fans and not below it.


    MonkimoE
    Participant

    @monkimoe

    I’m renaming the members tab to fans by language .po file
    I’m affraid there’s no easy way to change this..? >.<

    I found complete list of SLUG:

    Changing Internal Configuration Settings

    but none of them to edit Group Members SLUG.. šŸ™ or is this bug?


    Security
    Participant

    @shivam-kumar

    Are you sure the link you have added there on your site is for members only and not for group or some other component ,no offense just a possibility after all we are all humans cos i think that fans relates more to friends and thus changes should be done as follows
    define ( ‘BP_FRIENDS_SLUG’, ‘fans’ );


    MonkimoE
    Participant

    @monkimoe

    define ( ā€˜BP_FRIENDS_SLUGā€™, ā€˜friendā€™ ); is for friend of members.
    mydomain.com/members/username/friend >> produce list all friends of member.
    it is members have friend.

    Groups have members.
    This is what I need to change.


    Security
    Participant

    @shivam-kumar

    oh i got your point now sorry i dint saw that attached screen shot carefully before,in that case you may need a custom fuction may be the below link could get you some help
    Manually modifying single group navigation in BP 1.5


    Security
    Participant

    @shivam-kumar

    Hi Try this in your bp-custom file

    <? php
    function your_bp_groups_forum_first_tab() {
    global $bp;
    
    $bp->bp_options_nav[ā€˜groupsā€™][ā€˜homeā€™][ā€˜nameā€™] = ā€˜Something';
    }
    add_action(ā€˜wpā€™, ā€˜your_bp_groups_forum_first_tabā€™);
    ?>

    this should change the ‘home’ tab to ‘something’ similarly do the changes for all the tabs accordingly
    Thanks


    MonkimoE
    Participant

    @monkimoe

    Hi, Thanks for the guide.
    Looks like the code only change the tabs name, not change the URL I wanted.

    —-
    I found what I need in core files:
    wp-content/plugins/buddypress/bp-groups/bp-groups-loader.php
    line 471 – 481

    $sub_nav[] = array(
    'name'            => sprintf( _x( 'Members <span>%s</span>', 'My Group screen nav', 'buddypress' ), number_format( $this->current_group->total_member_count ) ),
    'slug'            => 'members', //THIS IS THE ONE
    'parent_url'      => $group_link,
    'parent_slug'     => $this->current_group->slug,
    'screen_function' => 'groups_screen_group_members',
    'position'        => 60,
    'user_has_access' => $this->current_group->user_has_access,
    'item_css_id'     => 'members',
    'no_access_url'   => $group_link,
    );

    I change the ‘slug’ => ‘fans’,
    It’s works changing the url from group-name/members to group-name/fans
    but the page can’t find any fans (members) even it has.

    well..still trying now..


    Security
    Participant

    @shivam-kumar

    try adding this line to the function i gave above and see if it works
    $bp->bp_options_nav[ā€˜groupsā€™][ā€˜homeā€™][ā€˜slugā€™] = ā€˜Something’;


    MonkimoE
    Participant

    @monkimoe

    Hi.. thank you to keep guiding me.
    I don’t know why those code for single groups page doesn’t working in my site.

    Then I tried to modify nav tab in single members page those can working good.
    This what I have in bp-custom.php:

    <?php
    function edit_tabs_options() {
        global $bp;
    // MODIFY GROUP TABS
    $bp->bp_options_nav['groups']['home']['name'] = 'Group Activity'; //NOT WORK
    $bp->bp_nav['groups']['home']['name'] = 'Member Activity 2'; //NOT WORK
    
    //MODIFY MEMBERS TABS
    $bp->bp_nav['home']['name'] = 'Member Activity'; //IT'S WORK
    bp_core_remove_nav_item( 'forums' ); //IT'S WORK
    bp_core_remove_subnav_item( 'profile', 'change-avatar' ); //IT'S WORK
    
    }
    add_action( 'bp_setup_nav', 'edit_tabs_options' );
    ?>

    Last try on fresh install wp + bp with default theme. I will let you know if those code works or not.


    MonkimoE
    Participant

    @monkimoe

    I already test on new wp + bp install.
    These code not work! šŸ™

    // MODIFY GROUP NAME TABS
    $bp->bp_options_nav['groups']['home']['name'] = 'Group Activity'; //NOT WORK
    $bp->bp_nav['groups']['home']['name'] = 'Member Activity 2'; //NOT WORK
    
    //REMOVE SPECIFIC GROUP TAB
    bp_core_remove_subnav_item($bp->groups->slug, 'send-invites');

    taken from: http://wordpress.stackexchange.com/questions/14469/remove-tabs-from-buddypress-groups-and-members-pages >> It’s not work anymore in latest BP 2.2.1

    I’m using latest WordPress 4.1.1 and latest Buddypress 2.2.1
    So.. how to exactly modified Group Tabs in single group page?

    anybody? Please help. stuck in 3 days for this.
    Thank you.


    rosyteddy
    Participant

    @rosyteddy

    https://codex.buddypress.org/getting-started/customizing/changing-internal-configuration-settings/ says “The references to slug Constants are deprecated, this section requires updating.”

    I have no idea when that will be updated. Thanks.

    PS : If this was an absolute necessity for me maybe I would have tried creating a wordpress page named “fans” or whatever, and inserted the Groups page as an iframe in the content of that page. That way, the url would probably show as desired.


    MonkimoE
    Participant

    @monkimoe

    Hi Rosyteddy,
    I got it now. Thank you for guide me there.

    However I resolve this by edit the core of buddypress.

    bp-core-template.php – line 2105
    bp-groups-loader.php – line 473
    groups/single/home.php – search this:

    // Otherwise show members
    elseif ( bp_is_active( 'members'  ) ) : bp_get_template_part( 'groups/single/members'  );

    Changing word ‘members’ to ‘fans’ in those 3 files will give you new url:
    yourdomain.com/groups/group-name/fans/

    Ok. It’s works!
    Note: I still don’t know what effect will have.

    Thank you.


    danbp
    Participant

    @danbp

    FYI BP_MEMBERS_SLUG is deprecated (read line 38)
    and about the member slug in groups read here https://buddypress.trac.wordpress.org/ticket/6001

    Be warned that altering core files is not recommended and not best practice, as you will loose your changes at next BP update.

Viewing 19 replies - 1 through 19 (of 19 total)
  • The topic ‘Change Group Member Slug’ is closed to new replies.
Skip to toolbar