• Gengar003

    (@gengar003)


    I have Subscribe2 installed on some of my child blogs in my Multi-Site setup.

    I wanted posts that were broadcast by ThreeWP to a child blog with Subscribe2 installed, to trigger notifications. But they didn’t.

    I did some digging, and the reason it doesn’t happen is because switch_to_blog only switches the data context, not the plugin context, so child blogs’ subscribe2 plugins never loaded.

    I discovered a workaround: If a post is posted in the future, instead of immediately, it will be posted in the child blog’s context, and so subscribe2 will trigger. Even a 60-second delay is sufficient.

    Code patch: starting on line 1473 of ThreeWP_Broadcast.php (version 1.11), replace this:

    if ( $need_to_insert_post ) 	{
    		$new_post_id = wp_insert_post( $new_post);
    		if ( $link )
    			$broadcast_data->add_linked_child( $blogID, $new_post_id );
    	}

    with this:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    In theory, this should work for other notification plugins that do something when a post is posted, but I haven’t tested it as I don’t use any others.

    If you as a user don’t want to deal with patching your plugin code, you can just set your posts to be published one minute in the future, and all child blogs’ “do something when a post is made” handlers should activate properly.

    A note: I think I accidentally posted this in the wrong forum, but can’t move it. The title doesn’t allow me enough characters to prefix it with [ThreeWP Broadcast]. Apologies.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘How to use ThreeWP Broadcast with subscribe2 and similar notification plugins’ is closed to new replies.