Exemplo n.º 1
0
/**
 * When someone subcribes, it delete email from 'unsubscribed' table
 * @param	str
 * @param	int		user id optional: only if subscriber is also a registered user
 */
function alo_em_delete_unsubscribed_email_from_db_table($subscriber, $user_id = false)
{
    global $wpdb;
    if (alo_em_check_email_in_unsubscribed($subscriber->email)) {
        alo_em_delete_email_from_unsubscribed($subscriber->email);
    }
}
/**
 * Add email in Unsubscribed table
 * 
 *@param	str		email
 */
function alo_em_add_email_in_unsubscribed($email)
{
    global $wpdb;
    if (!alo_em_check_email_in_unsubscribed($email)) {
        $wpdb->insert("{$wpdb->prefix}easymail_unsubscribed", array('email' => $email, 'added_on' => current_time('mysql', 0)));
    }
}