1

I want to change the behavior of a bbpress/Buddypress "create group" page. I found the function I need to rewrite, it's the function create_screen in plugins/bbpress/includes/extend/buddypress/group.php. I think I need to do something like

remove_action( 'some_hook_here', 'create_screen'  );  
add_action( 'some_hook_here', 'create_screen' );

But I don't know what hook I have to use, or where to find it. This is my first time trying to write a wordpress plugin, so I'm a little lost.

7
  • plugins/buddypress/readme.txt says it's version 1.8.1. I guess what I'm looking at is more of an extension to bbpress that interfaces with Buddypress.
    – Jonathan
    Commented Dec 12, 2013 at 16:34
  • Just to clarify, the file you are looking at is in the bbPress plugin, not the BuddyPress plugin.
    – Ben Miller
    Commented Dec 12, 2013 at 16:35
  • See: wordpress.stackexchange.com/a/103644/21376
    – s_ha_dum
    Commented Dec 12, 2013 at 16:40
  • @s_ha_dum, Thanks, that's helpful. I still can't find the relevant hook for the function I want to rewrite, though--there don't seem to be any do_action() around the function I'm trying to rewrite, and maybe that's not what I should be looking for.
    – Jonathan
    Commented Dec 12, 2013 at 16:54
  • There may not be a relevant hook. If there is no hook, or other mechanism that lets you override the function, then you can't override it. See this too: wordpress.stackexchange.com/a/101240/21376
    – s_ha_dum
    Commented Dec 12, 2013 at 17:03

1 Answer 1

0

BuddyPress defines a class named BP_Group_Extension which can be used by plugins or themes as an API for creating group extensions. This base class is located in buddypress/bp-groups/bp-groups-classes.php, and there is documentation on how to use it in the file at the beginning of the class definition (starting at line 1742).

bbPress uses this BuddyPress API to modify the BuddyPress functionality. In bbPress, the class where you found the create_screen function is named BBP_Forums_Group_Extension and it extends the BP_Group_Extension class. If you want to create a plugin to modify this further, you can extend the class further and redefine the create_screen function.

1
  • Thanks, thanks makes a lot of sense. But when I write a class MLA_BBP_Forums_Group_Extension extends BBP_Forums_Group_Extension { function create_screen() { in my plugin file, it doesn't seem to affect anything.
    – Jonathan
    Commented Dec 12, 2013 at 22:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.