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
bp_activity_add()
What if they don’t have a hook created for it? How would I create one?
Don’t you have the hook and the function backwards in the add_action()? I thought the $hook gets listed before the $function?
Good spot! They are backwards. If Amen doesn’t have a hook available you could always ask them to add one.
Should be: add_action( 'actual_hook_name', 'add_prayer_request_to_stream' );
It was late when I wrote that reply! 🙂