Example #1
0
function send_email($args)
{
    global $SPD;
    $form_fields = @$args['call_prop']['form_field'];
    $wp_mail_array = @$SPD->data_arg['data'][$form_fields];
    include TEMPLATEPATH . '/theme-template-parts/mail/' . $args['call_prop']['email_message'] . '.php';
    ts_sendEmail($args['call_prop']['email_adress'], $args['call_prop']['email_title'], $mail_content, $args['call_prop']['email_header']);
}
Example #2
0
function change_password($args)
{
    $data_key = key($args['form_data']['data']);
    global $FC;
    $wp_user_array;
    foreach ($args['form_data']['data'][$data_key] as $key => $value) {
        if ($key == 'user_pass') {
            $wp_user_array['user_pass'] = $value['value'];
        }
        if ($key == 'user_email') {
            $wp_user_array['user_email'] = $value['value'];
        }
    }
    $user_info = get_userdata(get_current_user_id());
    // dont send email
    if ($user_info == "") {
        $my_message = 'Aby zmienić hasło powinieneś sie najpierw zalogować';
        $FC->flow_arg[$data_key][$FC->current_step]['msg'][2] = $my_message;
    }
    if ($wp_user_array['user_email'] == $user_info->user_email || validate_hash($_POST['uid'], $_POST['hash'], false)) {
        $my_message = 'Twoje nowe hasło zostało zmienione na: ' . $wp_user_array['user_pass'];
        $FC->flow_arg[$data_key][$FC->current_step]['msg'][2] = $my_message;
        @wp_update_user(array('ID' => $user_info->ID, 'user_pass' => $wp_user_array['user_pass']));
    } else {
        // Chceck is user have admin role
        if ($user_info->roles[0] == 'administrator') {
            $my_message = 'Zmieniasz hasło użytkownika:' . $wp_user_array['user_email'];
            $FC->flow_arg[$data_key][$FC->current_step]['msg'][2] = $my_message;
            //@wp_update_user( array ('ID' => $user_info->ID, 'user_pass' => $wp_user_array['user_pass'] ) ) ;
        } else {
            $my_message = 'Podałeś adres email nie należący do Twojego konta';
            $FC->flow_arg[$data_key][$FC->current_step]['msg'][2] = $my_message;
        }
    }
    // send email
    if ($args['call_prop']['send_email'] == true) {
        // add content email template
        include TEMPLATEPATH . '/theme-template-parts/mail/' . $wp_mail_array['email_message'] . '.php';
        //var_dump($wp_mail_array);
        ts_sendEmail($wp_mail_array['user_email'], $wp_mail_array['email_title'], $mail_content, $wp_mail_array['email_header']);
    }
}