Skip to:

Please help – understanding Buddypress code without documentation

  • bgrun80


    Hey all,

    I’m a new developer (started a year ago). I’ve been working with WordPress for about 3 months and I get it.

    Buddypress is a different issue, because there is very little documentation that teaches a new developer what the functions/actions/filters do,
    how to use them, what parameters they take, etc. etc. I’ve been through the codex cover to cover (figuratively) but there simply isn’t enough there.

    So I’m gonna post some questions here, and I’ve asked a spiritual guru about this, if you answer them and help me understand how to use Buddypress,
    you will have a happy and healthy life and birds will stop pooping on your car.

    Question 1:
    I’ve read the wordpress codex page about the Plugin API, so I understand about add_action and do_action and hooks.
    But there are a heap of do_action’s in the bp-default theme’s header.php, index.php, & footer.php that I don’t understand.
    I’ve looked through other core files, but I can’t find where the add_action for them is, nor any documentation anywhere else.

    Could you please explain about, or direct me to the page of code for the following hooks:

    I’ve also started a blog on the subject. Feel free to comments and help out there.

    Many thanks!

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

  • Boone Gorges


    Instances of do_action() don’t actually do anything. They are just hooks for other plugins or themes to use. So, while I agree that there should be a great deal more documentation throughout the BP core, documentation for the do_action calls in bp-defaultisn’t really possible because of the simple fact that most of them are not actually used by BuddyPress itself.

    If you would like to see where (or whether) a particular hook is being used by BP, search for that hook name in the context of an add_action() in the BP package.

    And fyi, every user account here on should have edit access to Try visiting If you find you don’t have access, it’s an error – let me know and I’ll be happy to set it up.



    Not every do_action call automatically has actions attached to it. Some do, but some are just there so developers can hook into them if they need to.

    If you want to know what a function does, then do a search in the files for the functions. While the codex does a good job with the various loops and some other stuff, it’s not so good with functions, and there are a lot of them. Once you have found the function (takes around 3 seconds in my IDE) you know what parameters it takes, where you can hook into and to what hooks it is attached.

    Quite easy, really :)



    @bgrun80 I think it’s cool that you want to work on the documentation. I saw your post Dec. 2010 “Buddypress functions that I’ll try to figure out – please help via comments” in your blog and you’re working on the BuddyPress 1.1.3 version. The userbar.php, optionsbar.php and plugin-template.php files for example, are no longer in BP 1.2+ versions. You might want to document latest version



    Thanks for the quick replies!

    I think I understand the idea of hooks now as they are used in index.php, header.php, etc.

    @boonebgorges: Unfortunately I don’t have the ability to edit the codex, but I’d really like to.
    I also tried logging into and I wasn’t allowed to do anything there either.
    It would be great if you could fix that for me, because until Jan 10th, all I’ll be doing is figuring out the code
    and publishing it in my own blog ( It would be fun to edit the codex at the same time.

    @mercime: cheers for the heads up. I pulled that old list from another post, but I’ll update it today with 1.2.7.

    Have a good one.



    Question: When a user logs into a Buddypress site, do all the core files load from the Buddypress root folder, or does it simply load the theme files?

    Basically, how does the big picture work?

    Also, what is the relationship between the core files and their respective directories?
    e.g. bp-blogs.php and the bp-blogs directory


    Boone Gorges


    @bgrun80 I’ve added you as an Editor on the codex. (The script that is supposed to handle this setup automatically has been acting buggy lately.)

    When you load a URL that matches a pattern that BP is looking for (eg /members/boonebgorges), BP first finds the corresponding data in the database (in this example, the profile data for a member matching the name ‘boonebgorges’) and then loads the theme file designated for this kind of data (members/single/home). In broad strokes, it’s not that different from how a standard WP post query works.

    The relationship between core files is conventional. For something like the groups component:
    – bp-groups/bp-groups-templatetags.php contains all function that are called from theme templates, along with the loop builder classes
    – bp-groups/bp-groups-filters.php contains the functions that modify the output of the groups component via apply_filters(), plus the application of any WP-native filters like kses
    – bp-groups/bp-groups-classes.php contains the database classes (for the most part, the -classes.php files should be the only place where SQL statements appear) as well as any other miscellaneous classes (like the BP_Group_Extension class, in the case of groups)
    – bp-groups/bp-groups-notifications.php contains the functions that format and send email notifications related to the group
    – bp-groups.php contains some setup functions for the component (like groups_setup_globals() and the functions that set up navigation), as well as any other functions that don’t have a natural home in any of the other files listed above.



    Cheers @boonebgorges.

    So, if I can clarify the whole process. Please tell me if I’m right or if I’m wrong,
    and I’ll post it up on my forum, and make a page in the codex if you want.

    When a visitor loads the URL of a Buddypress-supported site:
    1. the WordPress environment loads and loads the Buddypress plugin
    2. buddypress/bp-themes/bp-default is loaded (if you have activated that theme)
    3. as the visitor browses through different pages, functions are activated in those pages
    4. these functions draw their code from the core files (checking first if bp-custom.php contains same-named functions that will overwrite code in the core files)
    5. there are 9 core files
    6. these 9 core files require/include other groups of code from folders that are named the same way
    e.g. ‘bp-core.php’ requires/includes the files from the ‘bp-core’ folder
    7. The files in these folders are groups of code that share a similar category (e.g. classes) (e.g. bp-core/bp-core-classes.php)
    because modularizing them this way makes it easier to find the code you need.
    8. extra code that is hard to categorize clearly is simply put into the main file (e.g. bp-core.php)

    a. Is the above list right?
    b. Do the core files need to be loaded every time a user visits a page and activates a related function?
    e.g. if a user activates a function related to friends, does bp-friends.php need to be loaded?

    Seems like maybe a more open approach to the documentation is in order? Like a mediawiki or something like that? I could be wrong; just a feeling.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Please help – understanding Buddypress code without documentation’ is closed to new replies.
Skip to toolbar