Skip to:

correct way to redefine BuddyPress core functions

  • Maxaud


    I’m in the process of updating

    When creating we had to make some changes to the core of BuddyPress for it to functon how we wanted it to.

    I know php but I cannot say that I’m proficient at it.

    Would would be the best way to redefine or modify buddypress function as to preserve them when updating BuddyPress so I’m not having to go in and change BuddyPress core files every time there is an update made?

    Thanks in advance.


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

  • Jeff Sayre



    Yeah, hacking core files is never a good idea. That is why there’s a slick, simple solution!

    Place all your custom code in a file called bp-custom.php. It should be located in /wp-content/plugins/ not in the BuddyPress directory. This file will load before the BuddyPress components load.

    The file has to be named bp-custom.php and placed where I indicated.

    Now, when you update BuddyPress, since your custom code exists outside of the BuddyPress directory, you’ll be fine.



    I had the same issue and this time around my BP core hacks are really at a minimum (but I still had to hack ! ). Mostly my hacks are to do with disabling some includes (like the admin bar – I wish there was just a switch which isn’t too hard to do).

    As Jeff says, I used bp-custom.php for my custom functionality but that only goes so far… You OK with that approach as long as the core BP functions uses a filter or action. If that’s not the case, then your options are gone. What I ended up doing in a couple of cases, was just copy the core BP function into my bp-custom.php file, rename it and change the functionality then call that one instead of the original from my template. Again, this only works if you’re going to change the template functions only. If you need to dig deeper then I have no grand ideas left…

    Be sure to put your bp-custom.php in /plugins/ and not the /buddypress/ directory so it is not overwritten on upgrades. You’ll need to add a comment header and activate it in RC-2.

    Phluxor: disabling the admin bar is easy, add this to your bp-custom.php or your wp-config.php:

    define( 'BP_DISABLE_ADMIN_BAR', true );



    @Andy – yeah, I saw the admin bar disable trick after I posted – doh! Never mind, I took out some other things from bp-core.php anyway.

    Oh yeah, another thing I found was that I had to change the include for bp-custom.php to:

    include_once ‘bp-custom.php’;

    as it gave me grief with redefining existing functions…




    Thanks for the replies guys.

    So basically just redefine the functions I want to change in the new bp-custom.php file in the plugins directory (+ comment header for plugin activation)?

    seems simple enough, now just got to go through and update to RC2.

    Anything big I should know about in the update process, besides the directory changes?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘correct way to redefine BuddyPress core functions’ is closed to new replies.
Skip to toolbar