We send MailChimp emails out when new posts are published (or broadcasted) however the broadcast plugin made it difficult to determine the Post ID of the broadcasted posts. The patch below adds an array of blog_id=>post_id to make things easier.
function handle_broadcast_posts( $activity )
foreach ( $activity[‘activity_details’] as $details )
switch_to_blog( $details[‘blog_id’] );
$post = get_post( $details[‘post_id’] );
$to_broadcasted_blogs = array(); // Array of blog names that we're broadcasting to. To be used for the activity monitor action.
$to_broadcasted_blog_details = array(); // Array of blog and post IDs that we're broadcasting to. To be used for the activity monitor action.
$to_broadcasted_blogs = '<a href="' . get_permalink( $new_post_id ) . '">' . get_bloginfo( 'name' ) . '</a>';
$to_broadcasted_blog_details = array('blog_id'=>$blogID, 'post_id'=>$new_post_id);
'activity_strings' => array( '' => '%user_display_name_with_link% has broadcasted '.$post_url_and_name.' to: ' . implode( ', ', $to_broadcasted_blogs), ),
'activity_details' => $to_broadcasted_blog_details,
- The topic ‘[Plugin: ThreeWP Broadcast] Better action hook patch’ is closed to new replies.