'.__("Activation state updated", "alo-easymail").'.

'; } else { print '

'.__("Error during operation.", "alo-easymail") ." ". __("Not updated", "alo-easymail").'.

'; } } // delete partecipation if( isset($_REQUEST['task']) && $_REQUEST['task'] == 'delete' && is_numeric($_REQUEST['subscriber_id'])) { if ( ALO_em_delete_subscriber_by_id ($_REQUEST['subscriber_id']) ) { print '

'.__("Subscriber deleted", "alo-easymail").'.

'; } else { print '

'.__("Error during operation.", "alo-easymail") ." ". __("Not deleted", "alo-easymail").'.

'; } } // delete welcome import alert if ( isset($_REQUEST['import_alert']) && $_REQUEST['import_alert'] == "stop" ) { update_option( 'ALO_em_import_alert', "hide" ); } ?>

Alo EasyMail Newsletter:

Add new subscribers

?> = '2.6.5') check_admin_referer('alo-easymail_subscribers'); if ( isset($_REQUEST['action']) && $_REQUEST['action'] != "" ) { switch ( $_REQUEST['action'] ) { // go on with step 1! case "lists": if ( !isset($_REQUEST['subscribers'] ) || $_REQUEST['subscribers'] == "" ) { echo '

'.__("Error during operation.", "alo-easymail"); if ( !isset($_REQUEST['subscribers']) || $_REQUEST['subscribers'] == "" ) echo " ". __("No subscriber selected", "alo-easymail") ."."; if ( !isset($_REQUEST['check_list']) || count ($_REQUEST['check_list']) == 0 ) echo " ". __("No list selected", "alo-easymail") ."."; echo '

'; break; } if ($mailinglists) { ?>

:

:

:
    $val) { if ( $val['available'] == "deleted" || $val['available'] == "hidden" ) { //continue; } ?>
:

'. __('There are no available lists', 'alo-easymail') .'.

'; break; } case "delete": if ( !isset($_REQUEST['subscribers'] ) || $_REQUEST['subscribers'] == "" ) { echo '

'.__("Error during operation.", "alo-easymail"); echo " ". __("No subscriber selected", "alo-easymail") ."."; echo '

'; break; } foreach ($_REQUEST['subscribers'] as $subsc => $val) { ALO_em_delete_subscriber_by_id ( $val ); } print '

'.__("Subscribers deleted", "alo-easymail").'.

'; break; case "import": ?>


· :
· :


email_address1@domain.ltd;name1 surname1
email_address2@domain.ltd;name2 surname2
email_address3@domain.ltd;name3
email_address4@domain.ltd


'.__("Error during operation.", "alo-easymail"); if ( !isset($_REQUEST['action']) || $_REQUEST['action'] == "" ) echo " ". __("No action selected", "alo-easymail") ."."; if ( !isset($_REQUEST['subscribers'] )) echo " ". __("No subscriber selected", "alo-easymail") ."."; echo '

'; } } /** * Bulk action: Step #2/2 */ if ( isset($_REQUEST['doaction_step2']) ) { //if($wp_version >= '2.6.5') check_admin_referer('alo-easymail_subscribers'); if ( isset($_REQUEST['action']) && $_REQUEST['action'] != "" ) { switch ( $_REQUEST['action'] ) { // Save requested subscriptions to lists case "lists_step2": if ( !isset($_REQUEST['subscribers']) || $_REQUEST['subscribers'] == "" || !isset($_REQUEST['check_list']) || count ($_REQUEST['check_list']) == 0 ) { echo '

'.__("Error during operation.", "alo-easymail"); if ( !isset($_REQUEST['subscribers']) || $_REQUEST['subscribers'] == "" ) echo " ". __("No subscriber selected", "alo-easymail") ."."; if ( !isset($_REQUEST['check_list']) || count ($_REQUEST['check_list']) == 0 ) echo " ". __("No list selected", "alo-easymail") ."."; echo '

'; break; } $selected_subscribers = explode ( "," , $_REQUEST['subscribers'] ); switch ( $_REQUEST['mode'] ) { // The requested mode case "add_remove": // Add to selected lists and remove from not selected lists // TODO ! break; case "add": // Add to selected lists foreach ($selected_subscribers as $subscriber ) { foreach ( $_REQUEST['check_list'] as $list ) { ALO_em_add_subscriber_to_list ( $subscriber, $list ); } } break; case "remove": // Remove from selected lists foreach ($selected_subscribers as $subscriber ) { foreach ( $_REQUEST['check_list'] as $list ) { ALO_em_delete_subscriber_from_list ( $subscriber, $list ); } } break; } // end switch mode print '

'.__("Updated", "alo-easymail").'.

'; break; // Upload csv and insert new subscribers into db case "import_step2": if (($handle = fopen($_FILES['uploaded_csv']['tmp_name'], "r")) !== FALSE && $_FILES['uploaded_csv']['type'] == "text/csv" ) { $row = 0; $success = 0; // success $not_imported = array(); // list not imported and why if ( isset($_REQUEST['test_only']) && $_REQUEST['test_only'] == "yes") { $html = ""; $html .= '

'. __("Back", "alo-easymail"). '

'; $html .= ''; $html .= ''; $html .= ''; } while ( ($data = fgetcsv($handle, 1000, ";")) !== FALSE ) { $row++; // check data $email = stripslashes ( $wpdb->escape ( $data[0] ) ); $email = ( is_email( $email )) ? $email : false; $name = stripslashes ( $wpdb->escape ( $data[1] ) ); // error if ( $email == false ) { // error: email incorrect $not_imported[$data[0]] = __("The e-email address is not correct", "alo-easymail") ; } else { // error: already existing if ( ALO_em_is_subscriber($email) ) $not_imported[$data[0]] = __("There is already a subscriber with this e-email address", "alo-easymail") ; } if ( isset($_REQUEST['test_only']) && $_REQUEST['test_only'] == "yes") { // test, print records //if ( $row > 10 ) continue; // print only the 1st 10 $span_email = ( isset($not_imported[$data[0]])) ? "".$data[0]."" : $data[0] ; $html .= ""; $html .= ""; $html .= ""; } else { // insert records into db if ( $email && ALO_em_add_subscriber( $email , $name , 1 ) ) { $success ++; } } } fclose($handle); if ( isset($_REQUEST['test_only']) && $_REQUEST['test_only'] == "yes") { // test report $html .= '
'.__("E-mail", "alo-easymail").''.__("Name", "alo-easymail").''.__("Error", "alo-easymail").'
$row: ". $span_email ."".$data[1]."". ( ( isset($not_imported[$data[0]]) ) ? $not_imported[$data[0]] : "") ."
'; echo '

'. sprintf(__("Found %d records", "alo-easymail"), $row ) .'.

'; if ( count($not_imported) ) echo '

'. __("Check the Error column to modify records that otherwise will not be imported", "alo-easymail"). '.

'; echo $html; // print table echo '

'. __("Back", "alo-easymail"). '

'; exit(); } else { // import report echo '

'. sprintf(__("Successfully import: %d records out of %d total", "alo-easymail"), $success, $row ) .'.'; if ( count($not_imported) ) { echo '

'.__("Some records have not been imported", "alo-easymail").':

'; echo ''; echo ''; foreach ($not_imported as $email => $error ) { echo ''; echo ''; } echo '
'.$email.''.$error.'
'; } echo '

'; break; } } else { echo '

'.__("Not valid CSV file uploaded", "alo-easymail") . '.

'; } break; // Import from WP registrered users case "wpusers_step2": $reg_users = ALO_em_get_recipients_registered (); if ( $reg_users ) { $add = 0; foreach ( $reg_users as $reg_user ) { $email = $reg_user->user_email; if ( ALO_em_is_subscriber($email) == false ){ // if not already subscriber, add $name = ucfirst(get_user_meta($reg_user->UID, 'first_name', true))." " .ucfirst(get_user_meta($reg_user->UID,'last_name', true)); if (ALO_em_add_subscriber( $email , $name , 1 ) ) $add ++; } } } if ( $add > 0 ) { echo '

'. sprintf(__("%d new subscribers successfully added from blog members", "alo-easymail"), $add ) .'.

'; } else { echo '

'. __("No subscribers added from blog members", "alo-easymail") .'.

'; } break; } // end switch action } else { echo '

'. __("No action selected", "alo-easymail") .'.

'; } } ?>
'; echo '

'. __('Maybe you would like to import subscribers from your blog registered members or an external archive (using CSV). Click the 'Add/import subscribers' button', 'alo-easymail') .'.

'; echo "

(". __('Do not show it again', 'alo-easymail') .")

"; echo ''; } ?>
"; foreach($array_num as $n) { $selected_test = ($id_test == $test->ID ? ' selected="selected" ': ''); echo ""; } echo ""; ?>
prefix}easymail_subscribers"; $where_search = ""; if( !empty( $s ) ) { $search = '%' . trim( $s ) . '%'; $where_search = " WHERE (email LIKE '$search' OR name LIKE '$search' ) "; } if( !empty( $filter_list ) ) { $filter_list = '%_' . trim( $filter_list ) . '_%'; $where_search .= ( $where_search == "" ) ? " WHERE " : " AND " ; $where_search .= " lists LIKE '$filter_list' "; } $query .= $where_search; // order if ( isset($_GET['sortby']) ) { if( $_GET['sortby'] == 'email' ) { $query .= ' ORDER BY email '; } elseif( $_GET['sortby'] == 'join_date' ) { $query .= ' ORDER BY join_date '; } elseif( $_GET['sortby'] == 'active' ) { $query .= ' ORDER BY active '; } } $query .= ( isset($_GET['order']) && $_GET['order'] == 'ASC' ) ? 'ASC' : 'DESC'; $query .= " LIMIT $offset, $items_per_page "; //echo $query; //DEBUG // The QUERY on subscribers $all_subscribers = $wpdb->get_results($query); if (count($all_subscribers)) { $class = 'alternate'; $row_count = 0; foreach($all_subscribers as $subscriber) { $row_count++; $class = ('alternate' == $class) ? '' : 'alternate'; print "\n"; ?>
".__("E-mail", "alo-easymail").""; ?> ".__("Join date", "alo-easymail").""; ?> ".__("Activated", "alo-easymail")."" .ALO_em_help_tooltip( __("For registered users the dafault state is activated. For public subscribers the default state is deactivated: it will be activated by clicking on the activation link in the e-mail.", "alo-easymail") ." ". __("A subscriber will be deleted if not activated in 5 days.", "alo-easymail") ); ?>
email, 30) ; ?> email; ?> name; ?> email) ) { $user_info = get_userdata( email_exists($subscriber->email) ); echo "ID}' title='".__("View user profile", "alo-easymail")."'>{$user_info->user_login}"; } ?> join_date))." h.".date("H:i", strtotime($subscriber->join_date)) ?> ID. "&act=".(($subscriber->active == 1)? "0":"1")."&sortby=".$_GET['sortby']. "&order=". ( ( isset($_GET['order']) ) ? $_GET['order'] : "" ). "' title='".__("Modify activation state", "alo-easymail")."' "; echo " onclick=\"return confirm('". __("Do you really want to modify the activation state?", "alo-easymail") ."');\">"; echo "active == 1)? "yes.png":"no.png") ."' />"; ?> ";print_r( ALO_em_get_user_mailinglists ( $subscriber->ID ) );echo ""; $user_lists = ALO_em_get_user_mailinglists ( $subscriber->ID ); if ( $user_lists && is_array ($user_lists) ) { echo "
    "; foreach ( $user_lists as $user_list ) { echo "
  • " . $mailinglists[$user_list]["name"] . "
  • "; } echo "
"; } ?>
"; echo ""; echo ""; echo ""; */ echo ""; echo ""; ?>
.
get_var("SELECT COUNT(*) FROM {$wpdb->prefix}easymail_subscribers" . (!empty( $s )?$where_search : "")); $total_pages = ceil($total_items / $items_per_page); $arr_params = array ('paged' => '%#%', 'subscriber_id' => '' /* unset to avoid updated msg in next page */ ); $page_links = paginate_links( array( 'base' => add_query_arg( $arr_params/*'paged', '%#%' */), 'format' => '', 'total' => $total_pages, 'show_all' => true, 'current' => $page )); /* $page_links = paginate_links( array( 'base' => $link_base ."&num=".$items_per_page. (($_GET['s'])? "&s=".$s : "") , 'format' => '&paged=%#%', 'total' => $total_pages, 'show_all' => true, 'current' => $page ));*/ if ( $page_links ) echo "
$page_links
"; ?>

Add new subscribers // DEBUG ------------------------------------------ //print "
".$query."
"; //print "
Totali = ".$total_items."
"; //print_r($_GET) // end DEBUG -------------------------------------- /** * --- end MAIN ---------------------------------------------------------------- */ ?>