Skip to:

how to modify core buddypress

  • kpolkson


    Ok, so I have an example task that I am trying to accomplish. For some reason, the Leave Group button on Groups that I am a member of does not generate a confirmation dialog, it just removes my membership in the group, yet, I would like to have the confirmation dialog.

    I know that I can add the confirm class to the leave-group button, but in order to do that, I have to modify `line 1541` in `/plugins/buddypress/bp-groups/bp-group-template.php` to read:
    `’link_class’ => ‘group-button leave-group confirm’,`
    instead of:
    `’link_class’ => ‘group-button leave-group’,`

    Now this works, but I am modifying core and I don’t want to do that cause it’s going to go away if I update.

    How can I make this small modification to core in a BuddyPress friendly way. I’ve tried adding the function to bp-custom.php and customizing it there, but the log says error: can’t redeclare that.

    What can I do otherwise?

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

  • Roger Coathup


    You can use the filter bp_get_group_join_button to modify the class.

    Have a read up on WordPress filters and actions.

    You can put your filter in bp-custom.php or functions.php.

    That said, I’m not sure what simply adding a class ‘confirm’ will achieve — is there some Javascript configured that will auto display a confirmation popup if the button has a class of ‘confirm’ added to it?



    Thanks, that’s what I thought, but wasn’t sure if there was a different way. I am off to school up on filters and actions.

    the `bp_core_confirmation_js()` function in `/bp-core/bp-core-cssjs.php` attaches a confirmation to all `a.confirm` elements….figured I’d use what was already there rather than try and go adding another myself.


    Roger Coathup


    Say it isn’t so!

    Handy for you in this case, but a nightmare generally speaking. A class of ‘confirm’ is something that’s quite likely to be used by devs, without wanting any unexpected Javascript kicking in.

    The classname should be namespaced in the core.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘how to modify core buddypress’ is closed to new replies.
Skip to toolbar