コード例 #1
0
/**
 * Save the optin/optout on Registration Form
 */
function alo_em_save_registration_optin($user_id, $password = "", $meta = array())
{
    $user = get_userdata($user_id);
    if (!empty($user->first_name) && !empty($user->last_name)) {
        $name = $user->first_name . ' ' . $user->last_name;
    } else {
        $name = $user->display_name;
    }
    if (isset($_POST['alo_em_opt']) && $_POST['alo_em_opt'] == "yes") {
        $lang = isset($_POST['alo_em_lang']) && in_array($_POST['alo_em_lang'], alo_em_get_all_languages(false)) ? $_POST['alo_em_lang'] : "";
        $fields['email'] = $user->user_email;
        //edit : added all this line
        $fields['name'] = $name;
        //edit : added all this line
        //alo_em_add_subscriber( $fields, 1, $lang ); //edit : orig : alo_em_add_subscriber( $user->user_email, $name , 1, $lang );
        if (alo_em_add_subscriber($fields, 1, $lang) == "OK") {
            do_action('alo_easymail_new_subscriber_added', alo_em_get_subscriber($user->user_email), $user_id);
        }
        // if subscribing, save also lists
        $mailinglists = alo_em_get_mailinglists('public');
        if ($mailinglists) {
            $subscriber_id = alo_em_is_subscriber($user->user_email);
            foreach ($mailinglists as $mailinglist => $val) {
                if (isset($_POST['alo_em_register_lists']) && is_array($_POST['alo_em_register_lists']) && in_array($mailinglist, $_POST['alo_em_register_lists'])) {
                    alo_em_add_subscriber_to_list($subscriber_id, $mailinglist);
                    // add to list
                }
            }
        }
    }
    /*else {
    		alo_em_add_email_in_unsubscribed ( $user->user_email );
    	}*/
}
コード例 #2
0
	<th scope="col"><?php 
_e('Order', 'alo-easymail');
?>
</th>
	<th scope="col"><?php 
_e('Subscribers', 'alo-easymail');
?>
</th>
	<th scope="col"><?php 
_e('Action', 'alo-easymail');
?>
</th>
</tr></thead>
<tbody>
<?php 
$tab_mailinglists = alo_em_get_mailinglists('hidden,admin,public');
if ($tab_mailinglists) {
    foreach ($tab_mailinglists as $list => $val) {
        if ($val['available'] == "deleted") {
            continue;
        }
        ?>
		<tr>
			<td><strong><?php 
        echo $list;
        ?>
</strong></td>
			<td><strong><?php 
        echo alo_em_translate_multilangs_array(alo_em_get_language(), $val['name'], true);
        ?>
</strong></td>