Change Group Member Slug
-
Hello world,
I want change group member slug:
mydomain.com/group/group-name/members
to
mydomain.com/group/group-name/fansI already change all “members” text to “fans” in my language .po file.
But the site url still have /members on it.I already try with bp-custom.php
define( 'BP_MEMBERS_SLUG', 'fans' );
still not workingAny guide for this?
Thank you.
-
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
ThanksHi, 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.
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 ~`
ThanksYes, 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…
I test with
define ( 'BP_GROUPS_SLUG', 'band' );
it’s work.BP_MEMBERS_SLUG is not work.
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/fansWhat 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_SLUGOk 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.
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:
but none of them to edit Group Members SLUG.. š or is this bug?
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’ );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.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.5Hi 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
ThanksHi, 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..
try adding this line to the function i gave above and see if it works
$bp->bp_options_nav[āgroupsā][āhomeā][āslugā] = āSomething’;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.
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.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.
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.
FYI BP_MEMBERS_SLUG is deprecated (read line 38)
and about the member slug in groups read here https://buddypress.trac.wordpress.org/ticket/6001Be warned that altering core files is not recommended and not best practice, as you will loose your changes at next BP update.
- The topic ‘Change Group Member Slug’ is closed to new replies.