Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

custom_easymail_auto_add_subscriber_to_list_by_post

By: a guest on Nov 13th, 2012  |  syntax: PHP  |  size: 0.68 KB  |  views: 125  |  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 custom_easymail_auto_add_subscriber_to_list_by_post ( $subscriber, $user_id=false ) {
  2.         global $post;
  3.         if ( is_singular() && is_object($post) ) {
  4.                 switch( $post->ID ) {
  5.  
  6.                         // List of post IDs and related lists
  7.                         case 1:
  8.                         case 2:
  9.                                 $list_id = 1; // put the ID of mailing list
  10.                                 break;
  11.                         case 3:
  12.                                 $list_id = 2; // put the ID of mailing list
  13.                                 break;                 
  14.  
  15.                         // etc etc ........
  16.                        
  17.                         // A default list
  18.                         default:
  19.                                 $list_id = 3; // put the ID of mailing list
  20.                 }
  21.                 alo_em_add_subscriber_to_list ( $subscriber->ID, $list_id );
  22.         }
  23. }
  24. add_action ( "alo_easymail_new_subscriber_added",  "custom_easymail_auto_add_subscriber_to_list_by_post", 10, 2 );