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

"; $optin_txt = ( alo_em_translate_option ( alo_em_get_language (), 'alo_em_custom_optin_msg', false) !="") ? alo_em_translate_option ( alo_em_get_language (), 'alo_em_custom_optin_msg', false) : __("Yes, I would like to receive the Newsletter", "alo-easymail"); echo "
"; echo alo_em_show_widget_form(); echo "
"; else: // if can go on // Activate if ($email && $action == 'activate') { if (alo_em_edit_subscriber_state_by_email($email, "1", $unikey) === FALSE) { echo "

".__("Error during activation. Please check the activation link.", "alo-easymail")."

"; } else { echo "

".__("Your subscription was successfully activated. You will receive the next newsletter. Thank you.", "alo-easymail")."

"; do_action ( 'alo_easymail_subscriber_updated', $email, $email ); } } // Request unsubscribe/modify subsription (step #1) if ($email && $action == 'unsubscribe') { $mailinglists = alo_em_get_mailinglists( 'public' ); if ($mailinglists) { // only if there are public lists echo '
'; echo "

".__("To modify your subscription to mailing lists use this form", "alo-easymail") . ":

"; echo '
'; echo alo_em_html_mailinglists_table_to_edit ( $email, "" ); echo '
'; //edit : added all the next if $alo_em_cf = alo_easymail_get_custom_fields(); if( $alo_em_cf ): echo "

".__("You can modify your subscription details", "alo-easymail") . ":

"; echo ""; foreach( $alo_em_cf as $key => $value ){ echo " \n"; $field_id = "alo_em_".$key; // edit-by-alo echo " \n"; echo " \n"; echo " \n"; } echo "
\n"; echo alo_easymail_custom_field_html ( $key, $value, $field_id, "", true ) ."\n"; echo "
"; endif; wp_nonce_field('alo_em_subscpage','alo_em_nonce'); echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; } echo '
'; echo "

".__("To unsubscribe the newsletter for good click this button", "alo-easymail") . "

"; wp_nonce_field('alo_em_subscpage','alo_em_nonce'); echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; } // Confirm unsubscribe and do it! (step #2a) if ($email && $action == 'do_unsubscribe' && isset($_POST['submit']) && wp_verify_nonce($_POST['alo_em_nonce'],'alo_em_subscpage') ) { if (alo_em_delete_subscriber_by_email($email, $unikey)) { echo "

".__("Your subscription was successfully deleted. Bye bye.", "alo-easymail")."

"; do_action ( 'alo_easymail_subscriber_deleted', $email, false ); } else { echo "

".__("Error during unsubscription.", "alo-easymail")." ". __("Try again.", "alo-easymail"). "

"; echo "

".__("If it fails again you can contact the administrator", "alo-easymail").": ".get_option('admin_email')."

"; } } // Modify lists subscription and save it! (step #2b) if ($email && $action == 'do_editlists' && isset($_POST['submit']) && wp_verify_nonce($_POST['alo_em_nonce'],'alo_em_subscpage') ) { $mailinglists = alo_em_get_mailinglists( 'public' ); $subscriber_id = alo_em_is_subscriber( $email ); if ($mailinglists) { foreach ( $mailinglists as $mailinglist => $val) { if ( isset ($_POST['alo_em_profile_lists']) && is_array ($_POST['alo_em_profile_lists']) && in_array ( $mailinglist, $_POST['alo_em_profile_lists'] ) ) { alo_em_add_subscriber_to_list ( $subscriber_id, $mailinglist ); // add to list } else { alo_em_delete_subscriber_from_list ( $subscriber_id, $mailinglist ); // remove from list } } } //edit : added all this foreach $alo_em_cf = alo_easymail_get_custom_fields(); if ($alo_em_cf) { $fields = array(); foreach( $alo_em_cf as $key => $value ){ //check if custom fields have been changed if ( isset( $_POST[ "alo_em_". $key] ) ) { $fields[$key] = $_POST[ "alo_em_". $key]; } } alo_em_update_subscriber_by_email ( $email, $fields, 1, alo_em_get_language(true) ); } $subscriber = alo_em_get_subscriber ( $email ); do_action ( 'alo_easymail_subscriber_updated', $subscriber, $email ); alo_em_update_subscriber_last_act($email); echo "

" . __("Your subscription to mailing lists successfully updated", "alo-easymail") . ".

"; } endif; // end CHECK IF CAN ACCESS ?>