Skip to:
Content
Pages
Categories
Search
Top
Bottom

Make Amen plugin BuddyPress compatible

  • Avatar of jamrizzi
    jamrizzi
    Participant

    @jamrizzi

    I am using the WordPress plugin called Amen on my BuddyPress powered website. What I need the plugin to do is when someone submits a prayer request, it is displayed on their BuddyPress feed. I’m guessing I’ll have to use a hook of some kind to accomplish this, but I have no clue where to start. Can anyone help me?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Avatar of henrywright
    henrywright
    Moderator

    @henrywright

    I’m guessing I’ll have to use a hook of some kind to accomplish this

    You’re right. But the hook would be supplied by the Amen plugin. You could start by asking the plugin’s support if one is available. I’m guessing here but it will probably be called something like after_submit_prayer_request.

    Then you’d build your own function which you can ‘hook’ on to the ‘after_submit_prayer_request’ hook (don’t forget I’m guessing at the hook name).

    Your function would simply add an item to the BP activity stream and will look something like this:

    function add_prayer_request_to_stream() {
        bp_activity_add( $args )
    }
    add_action( 'add_prayer_request_to_stream', 'actual_hook_name' );

    Note: This won’t work until you have the actual hook name and have supplied the $args as an array that describes the activity item you’re creating.

    See here for more info on the bp_activity_add() function

    http://codex.buddypress.org/developer/function-examples/bp_activity_add/

    Avatar of jamrizzi
    jamrizzi
    Participant

    @jamrizzi

    What if they don’t have a hook created for it? How would I create one?

    Avatar of jamrizzi
    jamrizzi
    Participant

    @jamrizzi

    Don’t you have the hook and the function backwards in the add_action()? I thought the $hook gets listed before the $function?

    Avatar of henrywright
    henrywright
    Moderator

    @henrywright

    Good spot! They are backwards. If Amen doesn’t have a hook available you could always ask them to add one.

    Avatar of henrywright
    henrywright
    Moderator

    @henrywright

    Should be: add_action( 'actual_hook_name', 'add_prayer_request_to_stream' );

    It was late when I wrote that reply! :)

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

The topic ‘Make Amen plugin BuddyPress compatible’ is closed to new replies.