WordPress.org

Support

Support » Plugins and Hacks » [Plugin: ThreeWP Broadcast] Better action hook patch

[Plugin: ThreeWP Broadcast] Better action hook patch

  • 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.

    Usage:
    add_action(‘threewp_activity_monitor_new_activity’, ‘handle_broadcast_posts’);
    function handle_broadcast_posts( $activity )
    {
    foreach ( $activity[‘activity_details’] as $details )
    {
    switch_to_blog( $details[‘blog_id’] );

    $post = get_post( $details[‘post_id’] );

    restore_current_blog();
    }
    }

    Patch:
    Below
    $to_broadcasted_blogs = array(); // Array of blog names that we're broadcasting to. To be used for the activity monitor action.
    Add
    $to_broadcasted_blog_details = array(); // Array of blog and post IDs that we're broadcasting to. To be used for the activity monitor action.

    Below
    $to_broadcasted_blogs[] = '<a href="' . get_permalink( $new_post_id ) . '">' . get_bloginfo( 'name' ) . '</a>';
    Add
    $to_broadcasted_blog_details[] = array('blog_id'=>$blogID, 'post_id'=>$new_post_id);

    Below

    'activity_strings' => array(
    	'' => '%user_display_name_with_link% has broadcasted '.$post_url_and_name.' to: ' . implode( ', ', $to_broadcasted_blogs),
    ),

    add
    'activity_details' => $to_broadcasted_blog_details,

    http://wordpress.org/extend/plugins/threewp-broadcast/

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: ThreeWP Broadcast] Better action hook patch’ is closed to new replies.