Advertisement
Guest User

custom_easymail_auto_add_subscriber_to_list_by_post

a guest
Nov 13th, 2012
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.68 KB | None | 0 0
  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 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement