Safe to edit BuddyPress Plugin?
-
Like a theme, do I need to make a child-plugin to edit the BP plugin? How can I ensure that all future updates are safe?
-
Don’t edit the plugin. The changes WILL be overwritten. There’s tons of hooks everywhere and a different process for doing things, depending on what you wanted to change.
What are you tying to do?
I am changing many things. For the theme, I created a child. But I will be editing slugs, some functions, etc to change my site’s layout and look.
Hook into the filters or actions whenever possible. (Basically anywhere in the codebase with an ‘apply_filters’ or ‘do_action’ call.) Otherwise, you’ll run into major upgrade problems and headaches depending on the level and complexity of your hacks!
Need a primer on filters and actions?
http://themeshaper.com/2009/05/03/filters-wordpress-child-themes/That tutorial is for themes, but applies to plugins as well.
Hope that helps!
There’s built in hooks to change slugs and other things.
Awesome, thank you! I will look into this.
I may come back for a few questions
Quick question:
So I create Bp-Custom (I am editing the slugs), but will this file be wiped out by future updates?
Create bp-custom.php and upload it to wp-content/plugins/ folder and no, the file won’t be wiped out be future updates. Include bp-custom.php whenever you make a backup of server files.
Are you sure you meant ” wp-content/plugins/” or wp-content/plugins/buddypress/?
I already uploaded it to wp-content/plugins/buddypress with the define code
(<?php
define( ‘BP_ACTIVATION_SLUG’, ‘activate’ );
define( ‘BP_ACTIVITY_SLUG’, ‘activity’ );etc) But with my changes…. Nothing’s changed.
Any thoughts?
Upload bp-custom.php to wp-content/plugins/ folder (NOT in buddypress folder) and it’s going to work.
e.g.
`<?php
define( ‘BP_ACTIVATION_SLUG’, ‘activate’ );
define( ‘BP_ACTIVITY_SLUG’, ‘activity’ );
?>`It also helps to change the default slugs to something else
eg.
`define( ‘BP_ACTIVATION_SLUG’, ‘confirm’ );
define( ‘BP_ACTIVITY_SLUG’, ‘stream’ );
`what @r-a-y said
I did this, but nothing changed. Is there any other setting I have to change first?
If you have a child theme of bp-default theme, copy over the header.php file to child theme folder. Open header.php with text editor and make changes in navigation links.
Hey, have you tried to refresh your computer after making the changes? sometimes you need to clear the cache.
Ok, right now, I place exactly this code in my bp-custom.php
<?phpdefine( 'BP_ACTIVATION_SLUG', 'activate' );
define( 'BP_ACTIVITY_SLUG', 'activity' );
define( 'BP_BLOGS_SLUG', 'blogs' );
define( 'BP_FORUMS_SLUG', 'forums' );
define( 'BP_FRIENDS_SLUG', 'friends' );
define( 'BP_GROUPS_SLUG', 'somethingnew' );
define( 'BP_MEMBERS_SLUG', 'members' );
define( 'BP_MESSAGES_SLUG', 'messages' );
define( 'BP_REGISTER_SLUG', 'register' );
define( 'BP_SEARCH_SLUG', 'search' );
define( 'BP_SETTINGS_SLUG', 'settings' );
define( 'BP_XPROFILE_SLUG', 'profile'?>
and uploaded it to /wp-content/plugins. I get this error:
Parse error: syntax error, unexpected ‘;’ in /home/content/90/5329690/html/*site*/wp-content/plugins/bp-custom.php on line 17.
Any thoughts?
Ok, I guess the code did not post in my last post, so here’s what I have:
<?php
define( ‘BP_ACTIVATION_SLUG’, ‘activate’ );
define( ‘BP_ACTIVITY_SLUG’, ‘activity’ );
define( ‘BP_BLOGS_SLUG’, ‘blogs’ );
define( ‘BP_FORUMS_SLUG’, ‘forums’ );
define( ‘BP_FRIENDS_SLUG’, ‘friends’ );
define( ‘BP_GROUPS_SLUG’, ‘somethingnew’ );
define( ‘BP_MEMBERS_SLUG’, ‘members’ );
define( ‘BP_MESSAGES_SLUG’, ‘messages’ );
define( ‘BP_REGISTER_SLUG’, ‘register’ );
define( ‘BP_SEARCH_SLUG’, ‘search’ );
define( ‘BP_SETTINGS_SLUG’, ‘settings’ );
define( ‘BP_XPROFILE_SLUG’, ‘profile’?>
I successfully changed the titles, but not the slugs.
Not sure why the code is not showing:
Here’s the snippet that I changed between the php tags
define( ‘BP_GROUPS_SLUG’, ‘somethingnew’ );
I solved it! But I dont know if this is safe:
I placed only the define groups directly after the line
define(‘WPLANG’, ”);
in wp-config.php
Safe?
It’s safe to place the code in wp-config.php.
Thank you
- The topic ‘Safe to edit BuddyPress Plugin?’ is closed to new replies.