Skip to:
Content
Pages
Categories
Search
Top
Bottom

Using BP functionality in another plugin

  • @brantb15

    Participant

    I’m creating a custom plugin and would like to run a function when someone makes a BP activity update.

    How can I make this possible?

Viewing 4 replies - 1 through 4 (of 4 total)
  • @shanebp

    Moderator

    Use a hook.
    Look in the files in the bp-activity dir – especially bp-activity-functions.php

    You probably want to use one of these hooks:

    do_action( 'bp_activity_posted_update', $r['content'], $r['user_id'], $activity_id );
    do_action( 'bp_activity_add', $r );

    @brantb15

    Participant

    There were a few actions that I was trying to hook into, but they don’t register as actions. I used include plugins_url() . '/buddypress/bp-activity/bp-activity-functions.php';, but even with that, it still doesn’t come back as an action when I use has_action

    @shanebp

    Moderator

    Do you know how do_action works?
    There is no need to include any WP or BP files.
    Just make sure the hooks are available when you call them.
    For example, in your plugin loader, use ‘bp_ready’ hook to call a function that will include any of your plugin files that rely on BP hooks.

    @brantb15

    Participant

    Oooh ok.
    I knew how do_action works, it’s just that I didn’t know how to provide the bp_functionality, so that’s why I was trying to use include.

    Thanks for letting me know about bp_ready

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Using BP functionality in another plugin’ is closed to new replies.
Skip to toolbar