Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Mike Hatcher

    (@hatcherm)

    Hi,

    I’ve been waiting 4 weeks for a response. Please can you let me know either way if this is possible so I can feed back to my client.

    Many thanks.

    I had a similar issue with the chat window not displaying on my site after upgrading. I switched to the default theme, deactivated all my plugins, then reactivated the theme and plugins. Seemed to work. Very weird.

    Hi wonderliza,

    After a bit of trial and error, I found the solution to your problem (and my own). I’m assuming that your issue is the same as mine: You want to subscribe a group to a page/post when in a particular status. When the status of that page/post changes, you want to unsubscribe the current group and subscribe the new group relevant to the new status. Well, I managed to do that by doing the following…

    I added the following in my theme’s functions.php file (You could also do this by creating a plugin for this):

    function efx_auto_subscribe_usergroup( $new_status, $old_status, $post ) {
    
    		global $edit_flow;
    
    		// Remove existing user group(s) every time the status changes
    		if ( $new_status ) {
    			$usergroup_ids_to_follow = array();
    			$edit_flow->notifications->follow_post_usergroups( $post->ID, $usergroup_ids_to_follow, false );
    		};
    		// "Editorial review" status subscribes "Content manager" group
    		if ( 'editorial-review' == $new_status ) {
    			// You'll need to get term IDs for your user groups and place them as comma-separated values
    			$usergroup_ids_to_follow = array(30);
    			$edit_flow->notifications->follow_post_usergroups( $post->ID, $usergroup_ids_to_follow, true );
    		};
    
    		// "Quality control" status subscribes "Quality assurance" group
    		if ( 'qa-review' == $new_status ) {
    			// You'll need to get term IDs for your user groups and place them as comma-separated values
    			$usergroup_ids_to_follow = array(11);
    			$edit_flow->notifications->follow_post_usergroups( $post->ID, $usergroup_ids_to_follow, true );
    		};
    
    		// "SEO review" status subscribes "SEO" group
    		if ( 'seo-check' == $new_status ) {
    			// You'll need to get term IDs for your user groups and place them as comma-separated values
    			$usergroup_ids_to_follow = array(16);
    			$edit_flow->notifications->follow_post_usergroups( $post->ID, $usergroup_ids_to_follow, true );
    		};
    
    		// "To be published" status subscribes "Content manager" group
    		if ( 'to-be-published' == $new_status ) {
    			// You'll need to get term IDs for your user groups and place them as comma-separated values
    			$usergroup_ids_to_follow = array(30);
    			$edit_flow->notifications->follow_post_usergroups( $post->ID, $usergroup_ids_to_follow, true );
    		};
    
    		// Return true to send the email notification
    		return $new_status;
    
    	};
    	add_filter( 'ef_notification_status_change', 'efx_auto_subscribe_usergroup', 10, 3 );

    This listens for a change to a page/post status and then removes all the existing subscriptions. Based on the new status chosen, it then subscribes the user group.

    I hope this helps.

    @joost I’ve recently moved over from All-in-One SEO to your WordPress SEO by Yoast plugin. Great stuff!

    My issue is that I also use the Root Relative URLs plugin a lot as it is very, very useful. I was wondering if there is a way for you/me to change your SEO plugin so that still generates the absolute links in the XML sitemaps. I think this would be very useful for a lot of people.

    Thanks!
    Mike

Viewing 4 replies - 1 through 4 (of 4 total)