Created
June 21, 2019 20:58
-
-
Save KaineLabs/5bea5f8061a33433762c8ddeb8ffbfed to your computer and use it in GitHub Desktop.
Add New Follow Post
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add New Follow Post | |
*/ | |
function yzc_register_follow_activity_actions() { | |
// Bail if activity is not active | |
if ( ! bp_is_active( 'activity' ) ) | |
return false; | |
bp_activity_set_action( 'yzc_follows', 'yzc_new_follow', __( 'New Follow' ) ); | |
} | |
add_action( 'bp_register_activity_actions', 'yzc_register_follow_activity_actions' ); | |
/** | |
* Track New Follows | |
*/ | |
function yzc_add_new_follow_activity_post( $data = null ) { | |
// Get Review Content. | |
$activity_id = bp_activity_add( array( | |
'action' => sprintf( | |
__( '%1s is following %2s', 'youzer' ), bp_core_get_userlink( $data->follower_id ), bp_core_get_userlink( $data->leader_id ) ), | |
'content' => '', | |
'component' => 'yzc_follows', | |
'type' => 'yzc_new_follow', | |
) | |
); | |
return $activity_id; | |
} | |
add_action( 'bp_follow_after_save', 'yzc_add_new_follow_activity_post', 10 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment