This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Edit Flow, efx_auto_subscribe_usergroup

By: a guest on Mar 20th, 2012  |  syntax: PHP  |  size: 1.28 KB  |  views: 59  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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 );
clone this paste RAW Paste Data