Display post activity stream in email
-
Hello,
To send an email at all users for new post in activity stream, I make snippet :
add_action( ‘youzify_after_adding_wall_post’, ‘yzc_send_email_for_new_activity’, 999 );
function yzc_send_email_for_new_activity( $activity_id ) {
$activity = new BP_Activity_Activity( $activity_id );
if ( $activity->hide_sitewide ) {
return;
}// Get the results
$users = get_users( array( ‘fields’ => ‘id’ ) );foreach ( $users as $user_id ) {
if ( $activity->user_id == $user_id ) {
continue;
}$user_info = get_userdata($user_id);
// Get Email Tags.
$tokens = array(
‘tokens’ => array(
‘yzc_activity.activity_url’ => bp_activity_get_permalink( $activity_id ),
‘yzc_activity.author’ => bp_core_get_user_displayname( $activity->user_id ),
‘yzc_activity.content’ => $activity->content,
)
);// Send Emails
bp_send_email( ‘yzc-new-activity’, $user_info->user_email, $tokens );}
}This line get post content for display it in email after :
yzc_activity.content’ => $activity->content,
But there is a problem, because it’s working only if the content is a string, for images and others it’s not working…
Someone have an idea ?
Thanks.
- You must be logged in to reply to this topic.