Advertisement
Guest User

Edit Flow, efx_auto_subscribe_usergroup

a guest
Mar 20th, 2012
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.28 KB | None | 0 0
  1. function efx_auto_subscribe_usergroup( $new_status, $old_status, $post ) {
  2.         global $edit_flow;
  3.        
  4.         // Choose the slug for whichever status you'd like to auto-subscribe on
  5.         if ( 'story-idea' == $new_status ) {
  6.                 // You'll need to get term IDs for your user groups and place them as
  7.                 // comma-separated values
  8.                 $usergroup_ids_to_follow = array( 90
  9.                                 // 88,
  10.                         );
  11.                 $edit_flow->notifications->follow_post_usergroups( $post->ID, $usergroup_ids_to_follow, true );
  12.         }
  13.        
  14.         if ( 'assigned' == $new_status ) {
  15.                 $edit_flow->notifications->follow_post_usergroups( $post->ID, 0, false );
  16.                 // You'll need to get term IDs for your user groups and place them as
  17.                 // comma-separated values
  18.                 $usergroup_ids_to_follow = array( 88
  19.                                 // 88,
  20.                         );
  21.                 $edit_flow->notifications->follow_post_usergroups( $post->ID, $usergroup_ids_to_follow, true );
  22.         }
  23.         // Return true to send the email notification
  24.         return true;
  25. }
  26. add_filter( 'ef_notification_status_change', 'efx_auto_subscribe_usergroup', 10, 3 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement