function Insert_Login_Logout_Toggle($atts)
{
    global $user_message, $feup_success;
    $Salt = get_option("EWD_FEUP_Hash_Salt");
    $Custom_CSS = get_option("EWD_FEUP_Custom_CSS");
    $Time = time();
    $ReturnString = "";
    // Get the attributes passed by the shortcode, and store them in new variables for processing
    extract(shortcode_atts(array('login_redirect_page' => '#', 'logout_redirect_page' => '#'), $atts));
    $User = new FEUP_User();
    if (!$User->Is_Logged_In()) {
        return do_shortcode("[login redirect_page='" . $login_redirect_page . "']");
    } elseif (isset($_POST['Logout_Submit'])) {
        return do_shortcode("[logout redirect_page='" . $logout_redirect_page . "']");
    } else {
        $ReturnString .= "<style type='text/css'>";
        $ReturnString .= $Custom_CSS;
        $ReturnString .= EWD_FEUP_Add_Modified_Styles();
        $ReturnString .= "<div id='ewd-feup-login-form-div'>";
        if (isset($user_message['Message'])) {
            $ReturnString .= $user_message['Message'];
        }
        $ReturnString .= "<form action='#' method='post' id='ewd-feup-login-form' class='feup-pure-form feup-pure-form-aligned'>";
        $ReturnString .= "<input type='hidden' name='ewd-feup-check' value='" . sha1(md5($Time . $Salt)) . "'>";
        $ReturnString .= "<input type='hidden' name='ewd-feup-time' value='" . $Time . "'>";
        $ReturnString .= "<input type='hidden' name='ewd-feup-action' value='login'>";
        $ReturnString .= "<div class='feup-pure-control-group'>";
        $ReturnString .= "<label for='Logout_Submit'></label><input type='submit' class='ewd-feup-submit feup-pure-button feup-pure-button-primary' name='Logout_Submit' value='" . __('Logout', 'EWD_FEUP') . "'>";
        $ReturnString .= "</div>";
        $ReturnString .= "</form>";
        $ReturnString .= "</div>";
        return $ReturnString;
    }
}
Exemplo n.º 2
0
function Insert_Logout($atts)
{
    // Include the required global variables, and create a few new ones
    $Salt = get_option("EWD_FEUP_Hash_Salt");
    $Custom_CSS = get_option("EWD_FEUP_Custom_CSS");
    $CookieName = urlencode("EWD_FEUP_Login" . "%" . sha1(md5(get_site_url() . $Salt)));
    $feup_Label_Successful_Logout_Message = get_option("EWD_FEUP_Label_Successful_Logout_Message");
    if ($feup_Label_Successful_Logout_Message == "") {
        $feup_Label_Successful_Logout_Message = __("You have been successfully logged out.", "EWD_FEUP");
    }
    $ReturnString = "";
    // Get the attributes passed by the shortcode, and store them in new variables for processing
    extract(shortcode_atts(array('no_message' => '', 'redirect_page' => '#', 'no_redirect' => 'No', 'submit_text' => 'Logout'), $atts));
    if ($no_redirect != "Yes" and isset($_COOKIE[$CookieName])) {
        $redirect_page = get_the_permalink();
    }
    setcookie($CookieName, "", time() - 3600, "/");
    $_COOKIE[urldecode($CookieName)] = "";
    if ($redirect_page != "#") {
        FEUPRedirect($redirect_page);
    }
    $ReturnString .= "<style type='text/css'>";
    $ReturnString .= $Custom_CSS;
    $ReturnString .= EWD_FEUP_Add_Modified_Styles();
    $ReturnString .= "<div class='feup-information-div'>";
    $ReturnString .= $feup_Label_Successful_Logout_Message;
    $ReturnString .= "</div>";
    if ($no_message != "Yes") {
        return $ReturnString;
    }
}
function User_List($atts, $content = null)
{
    // Include the required global variables, and create a few new ones
    global $wpdb;
    global $ewd_feup_user_table_name, $ewd_feup_user_fields_table_name;
    $Custom_CSS = get_option("EWD_FEUP_Custom_CSS");
    $UserCookie = CheckLoginCookie();
    // Get the attributes passed by the shortcode, and store them in new variables for processing
    extract(shortcode_atts(array('login_page' => '', 'field_name' => '', 'field_value' => '', 'login_necessary' => 'Yes', 'display_field' => 'Username', 'user_profile_page' => ''), $atts));
    $display_fields = explode(",", $display_field);
    $ReturnString .= "<style type='text/css'>";
    $ReturnString .= $Custom_CSS;
    $ReturnString .= EWD_FEUP_Add_Modified_Styles();
    if (!$UserCookie and $login_necessary == "Yes") {
        $ReturnString .= __("Please log in to access this content.", 'EWD_FEUP');
        if ($login_page != "") {
            $ReturnString .= "<br />" . __('Please', 'EWD_FEUP') . " <a href='" . $login_page . "'>" . __('login', 'EWD_FEUP') . "</a> " . __('to continue.', 'EWD_FEUP');
        }
        return $ReturnString;
    }
    if ($field_name != "" and $field_value != "") {
        $User_IDs = $wpdb->get_results($wpdb->prepare("SELECT User_ID FROM {$ewd_feup_user_fields_table_name} WHERE Field_Name='%s' AND Field_Value='%s'", $field_name, $field_value));
    } else {
        $User_IDs = $wpdb->get_results("SELECT User_ID FROM {$ewd_feup_user_table_name}");
    }
    foreach ($User_IDs as $User_ID) {
        foreach ($display_fields as $display_field) {
            if ($display_field == "Username") {
                $User = $wpdb->get_row($wpdb->prepare("SELECT Username FROM {$ewd_feup_user_table_name} WHERE User_ID='%d'", $User_ID->User_ID));
                $Return_User[$display_field] = $User->Username;
            } else {
                $User = $wpdb->get_row($wpdb->prepare("SELECT Field_Value FROM {$ewd_feup_user_fields_table_name} WHERE User_ID='%d' and Field_Name=%s", $User_ID->User_ID, $display_field));
                $Return_User[$display_field] = $User->Field_Value;
            }
        }
        $Return_User['User_ID'] = $User_ID->User_ID;
        $UserDataSet[] = $Return_User;
        unset($Return_User);
    }
    if (is_array($UserDataSet)) {
        foreach ($UserDataSet as $User_Data) {
            $ReturnString .= "<div class='ewd-feup-user-list-result' id='ewd-feup-user-list'>";
            if ($user_profile_page != "") {
                $ReturnString .= "<a href='" . $user_profile_page . "?User_ID=" . $User_Data['User_ID'] . "'>";
            }
            foreach ($display_fields as $display_field) {
                $ReturnString .= $User_Data[$display_field] . " ";
            }
            if ($user_profile_page != "") {
                $ReturnString .= "</a>";
            }
            $ReturnString .= "</div>";
        }
    }
    return $ReturnString;
}
function Insert_User_Profile($atts)
{
    // Include the required global variables, and create a few new ones
    global $wpdb, $user_message;
    global $ewd_feup_fields_table_name, $ewd_feup_user_table_name, $ewd_feup_user_fields_table_name;
    $Custom_CSS = get_option("EWD_FEUP_Custom_CSS");
    $Salt = get_option("EWD_FEUP_Hash_Salt");
    $Time = time();
    $CheckCookie = CheckLoginCookie();
    $Sql = "SELECT * FROM {$ewd_feup_fields_table_name} WHERE Field_Show_In_Front_End='Yes' ORDER BY Field_Order";
    $Fields = $wpdb->get_results($Sql);
    if (isset($_GET['User_ID'])) {
        $UserData = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$ewd_feup_user_fields_table_name} WHERE User_ID='%d'", $_GET['User_ID']));
    }
    //elseif (isset(get_query_var('user_id')))) {$UserData = $wpdb->get_results($wpdb->prepare("SELECT * FROM $ewd_feup_user_fields_table_name WHERE User_ID='%d'", get_query_var('user_id')));}
    $ReturnString = "";
    if (!isset($UserData)) {
        return __("Please select a valid user profile", 'EWD_FEUP');
    }
    // Get the attributes passed by the shortcode, and store them in new variables for processing
    extract(shortcode_atts(array('login_page' => '', 'omit_fields' => '', 'login_necessary' => 'Yes', 'submit_text' => __('Edit Profile', 'EWD_FEUP')), $atts));
    $ReturnString .= "<style type='text/css'>";
    $ReturnString .= $Custom_CSS;
    $ReturnString .= EWD_FEUP_Add_Modified_Styles();
    if ($CheckCookie['Username'] == "" and $login_necessary == "Yes") {
        $ReturnString .= __('You must be logged in to access this page.', 'EWD_FEUP');
        if ($login_page != "") {
            $ReturnString .= "<br />" . __('Please', 'EWD_FEUP') . " <a href='" . $login_page . "'>" . __('login', 'EWD_FEUP') . "</a> " . __('to continue.', 'EWD_FEUP');
        }
        return $ReturnString;
    }
    $ReturnString .= "<div id='ewd-feup-user-profile-div' class='ewd-feup-user-profile-div'>";
    $Omitted_Fields = explode(",", $omit_fields);
    foreach ($Fields as $Field) {
        if (!in_array($Field->Field_Name, $Omitted_Fields)) {
            $Value = "";
            foreach ($UserData as $UserField) {
                if ($Field->Field_Name == $UserField->Field_Name) {
                    $Value = $UserField->Field_Value;
                }
            }
            $ReturnString .= "<div class='feup-user-profile-field'>";
            $ReturnString .= "<div id='ewd-feup-user-profile-label-" . $Field->Field_ID . "' class='ewd-feup-user-profile-label'>" . $Field->Field_Name . ": </div>";
            $ReturnString .= "<div class='ewd-feup-text-input ewd-feup-user-profile-input'>" . $Value . "</div>";
            $ReturnString .= "</div>";
            unset($Req_Text);
        }
    }
    $ReturnString .= "<div class='feup-pure-control-group'><label for='submit'></label><input type='submit' class='ewd-feup-submit feup-pure-button feup-pure-button-primary' name='Edit_Profile_Submit' value='" . $submit_text . "'></div>";
    $ReturnString .= "</form>";
    $ReturnString .= "</div>";
    return $ReturnString;
}
function Insert_Login_Form($atts)
{
    global $user_message, $feup_success;
    // Include the required global variables, and create a few new ones
    $Salt = get_option("EWD_FEUP_Hash_Salt");
    $Custom_CSS = get_option("EWD_FEUP_Custom_CSS");
    $Username_Is_Email = get_option("EWD_FEUP_Username_Is_Email");
    $Time = time();
    $ReturnString = "";
    // Get the attributes passed by the shortcode, and store them in new variables for processing
    extract(shortcode_atts(array('redirect_page' => '#', 'redirect_field' => '', 'redirect_array_string' => '', 'submit_text' => __('Login', 'EWD_FEUP')), $atts));
    $ReturnString .= "<style type='text/css'>";
    $ReturnString .= $Custom_CSS;
    $ReturnString .= EWD_FEUP_Add_Modified_Styles();
    if ($feup_success and $redirect_field != "") {
        $redirect_page = Determine_Redirect_Page($redirect_field, $redirect_array_string, $redirect_page);
    }
    if ($feup_success and $redirect_page != '#') {
        FEUPRedirect($redirect_page);
    }
    $ReturnString .= "<div id='ewd-feup-login' class='ewd-feup-login-form-div' class='ewd-feup-form-div'>";
    if (isset($user_message['Message'])) {
        $ReturnString .= $user_message['Message'];
    }
    $ReturnString .= "<form action='#' method='post' id='ewd-feup-login-form' class='pure-form pure-form-aligned feup-pure-form-aligned'>";
    $ReturnString .= "<input type='hidden' name='ewd-feup-check' value='" . sha1(md5($Time . $Salt)) . "'>";
    $ReturnString .= "<input type='hidden' name='ewd-feup-time' value='" . $Time . "'>";
    $ReturnString .= "<input type='hidden' name='ewd-feup-action' value='login'>";
    $ReturnString .= "<div class='feup-pure-control-group'>";
    if ($Username_Is_Email == "Yes") {
        $ReturnString .= "<label for='Username' id='ewd-feup-login-username-div' class='ewd-feup-field-label ewd-feup-login-label'>" . __('Email', 'EWD_FEUP') . ": </label>";
        $ReturnString .= "<input type='email' class='ewd-feup-text-input ewd-feup-login-field' name='Username' placeholder='" . __('Email', 'EWD_FEUP') . "...'>";
    } else {
        $ReturnString .= "<label for='Username' id='ewd-feup-login-username-div' class='ewd-feup-field-label ewd-feup-login-label'>" . __('Username', 'EWD_FEUP') . ": </label>";
        $ReturnString .= "<input type='text' class='ewd-feup-text-input ewd-feup-login-field' name='Username' placeholder='" . __('Username', 'EWD_FEUP') . "...'>";
    }
    $ReturnString .= "</div>";
    $ReturnString .= "<div class='feup-pure-control-group'>";
    $ReturnString .= "<label for='Password' id='ewd-feup-login-password-div' class='ewd-feup-field-label ewd-feup-login-label'>" . __('Password', 'EWD_FEUP') . ": </label>";
    $ReturnString .= "<input type='password' class='ewd-feup-text-input ewd-feup-login-field' name='User_Password'>";
    $ReturnString .= "</div>";
    $ReturnString .= "<div class='feup-pure-control-group'>";
    $ReturnString .= "<label for='Submit'></label><input type='submit' class='ewd-feup-submit ewd-feup-login-submit feup-pure-button feup-pure-button-primary' name='Login_Submit' value='" . $submit_text . "'>";
    $ReturnString .= "</div>";
    $ReturnString .= "</form>";
    $ReturnString .= "</div>";
    return $ReturnString;
}
function Insert_Confirm_Forgot_Password($atts)
{
    global $wpdb, $user_message, $feup_success;
    global $ewd_feup_user_table_name;
    $Custom_CSS = get_option("EWD_FEUP_Custom_CSS");
    $CheckCookie = CheckLoginCookie();
    $Salt = get_option("EWD_FEUP_Hash_Salt");
    $Time = time();
    $User = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$ewd_feup_user_table_name} WHERE Username='******'", $CheckCookie['Username']));
    $ReturnString = "";
    // Get the attributes passed by the shortcode, and store them in new variables for processing
    extract(shortcode_atts(array('redirect_page' => '#', 'login_page' => '', 'submit_text' => __('Change password', 'EWD_FEUP')), $atts));
    $ReturnString .= "<style type='text/css'>";
    $ReturnString .= $Custom_CSS;
    $ReturnString .= EWD_FEUP_Add_Modified_Styles();
    if ($feup_success and $redirect_page != '#') {
        FEUPRedirect($redirect_page);
    }
    $ReturnString .= "<div id='ewd-feup-edit-profile-form-div'>";
    if (isset($user_message['Message'])) {
        $ReturnString .= $user_message['Message'];
    }
    $ReturnString .= "<form action='#' method='post' id='ewd-feup-edit-profile-form' class='feup-pure-form pure-form-aligned feup-pure-form-aligned'>";
    $ReturnString .= "<input type='hidden' name='ewd-feup-check' value='" . sha1(md5($Time . $Salt)) . "'>";
    $ReturnString .= "<input type='hidden' name='ewd-feup-time' value='" . $Time . "'>";
    $ReturnString .= "<input type='hidden' name='ewd-feup-action' value='confirm-forgot-password'>";
    $ReturnString .= "<div class='feup-pure-control-group'>";
    $ReturnString .= "<label for='Email' id='ewd-feup-edit-password' class='ewd-feup-field-label'>" . __('Email', 'EWD_FEUP') . ": </label>";
    $ReturnString .= "<input type='email' class='ewd-feup-text-input' name='Email' class='ewd-feup-text-input' value='" . $_GET['add'] . "' />";
    $ReturnString .= "</div>";
    $ReturnString .= "<div class='feup-pure-control-group'>";
    $ReturnString .= "<label for='Resetcode' id='ewd-feup-edit-password' class='ewd-feup-field-label'>" . __('Reset code', 'EWD_FEUP') . ": </label>";
    $ReturnString .= "<input type='text' class='ewd-feup-text-input' name='Resetcode' class='ewd-feup-text-input' value='" . $_GET['rc'] . "' />";
    $ReturnString .= "</div>";
    $ReturnString .= "<div class='feup-pure-control-group'>";
    $ReturnString .= "<label for='User_Password' id='ewd-feup-edit-password' class='ewd-feup-field-label'>" . __('Password', 'EWD_FEUP') . ": </label>";
    $ReturnString .= "<input type='password' class='ewd-feup-text-input' name='User_Password' class='ewd-feup-text-input' value='' />";
    $ReturnString .= "</div>";
    $ReturnString .= "<div class='feup-pure-control-group'>";
    $ReturnString .= "<label for='Confirm_User_Password' id='ewd-feup-edit-confirm-password' class='ewd-feup-field-label'>" . __('Repeat Password', 'EWD_FEUP') . ": </label>";
    $ReturnString .= "<input type='password' class='ewd-feup-text-input' name='Confirm_User_Password' class='ewd-feup-text-input' value='' />";
    $ReturnString .= "</div>";
    $ReturnString .= "<div class='feup-pure-control-group'><label for='submit'></label><input type='submit' class='ewd-feup-submit feup-pure-button feup-pure-button-primary' name='Edit_Password_Submit' value='" . $submit_text . "'></div>";
    $ReturnString .= "</div>";
    $ReturnString .= "</form>";
    return $ReturnString;
}
Exemplo n.º 7
0
function Insert_Forgot_Password_Form($atts)
{
    global $wpdb, $user_message, $feup_success;
    global $ewd_feup_user_table_name;
    $Custom_CSS = get_option("EWD_FEUP_Custom_CSS");
    $Use_Captcha = get_option("EWD_FEUP_Use_Captcha");
    // Get the attributes passed by the shortcode, and store them in new variables for processing
    extract(shortcode_atts(array('redirect_page' => '#', 'loggedin_page' => '/', 'reset_email_url' => '', 'submit_text' => __('Reset password', 'EWD_FEUP')), $atts));
    $feup_Label_Email = get_option("EWD_FEUP_Label_Email");
    if ($feup_Label_Email == "") {
        $feup_Label_Email = __("Email", 'EWD_FEUP');
    }
    if (get_option("EWD_FEUP_Label_Reset_Password") != "") {
        $submit_text = get_option("EWD_FEUP_Label_Reset_Password");
    }
    if ($feup_success and $redirect_page != '#') {
        FEUPRedirect($redirect_page);
    }
    $User = new FEUP_User();
    if ($User->Is_Logged_In()) {
        FEUPRedirect($loggedin_page);
    }
    $ReturnString = "";
    $ReturnString .= "<style type='text/css'>";
    $ReturnString .= $Custom_CSS;
    $ReturnString .= EWD_FEUP_Add_Modified_Styles();
    $ReturnString .= "<div id='ewd-feup-forgot-password-form-div' class='ewd-feup-form-div'>";
    if (isset($user_message['Message'])) {
        $ReturnString .= $user_message['Message'];
    }
    $ReturnString .= "<form action='#' method='post' id='ewd-feup-forgot-password-form' class='feup-pure-form feup-pure-form-aligned'>";
    $ReturnString .= "<input type='hidden' name='ewd-feup-check' value='" . sha1(md5($Time . $Salt)) . "'>";
    $ReturnString .= "<input type='hidden' name='ewd-feup-time' value='" . $Time . "'>";
    $ReturnString .= "<input type='hidden' name='ewd-feup-reset-email-url' value='" . $reset_email_url . "'>";
    $ReturnString .= "<input type='hidden' name='ewd-feup-action' value='forgot-password'>";
    $ReturnString .= "<div class='feup-pure-control-group'>";
    $ReturnString .= "<label for='Email' id='ewd-feup-reset-password' class='ewd-feup-field-label'>" . $feup_Label_Email . ": </label>";
    $ReturnString .= "<input type='email' class='ewd-feup-text-input pure-input-1-3' name='Email' value='' />";
    $ReturnString .= "</div>";
    if ($Use_Captcha == "Yes") {
        $ReturnString .= EWD_FEUP_Add_Captcha();
    }
    $ReturnString .= "<div class='feup-pure-control-group'><label for='submit'></label><input type='submit' class='ewd-feup-submit feup-pure-button feup-pure-button-primary' name='Reset_Password_Submit' value='" . $submit_text . "'></div>";
    $ReturnString .= "</div>";
    return $ReturnString;
}
function Insert_Edit_Profile($atts)
{
    // Include the required global variables, and create a few new ones
    global $wpdb, $user_message, $feup_success;
    global $ewd_feup_fields_table_name, $ewd_feup_user_table_name, $ewd_feup_user_fields_table_name;
    $Custom_CSS = get_option("EWD_FEUP_Custom_CSS");
    $Salt = get_option("EWD_FEUP_Hash_Salt");
    $Time = time();
    $CheckCookie = CheckLoginCookie();
    $Sql = "SELECT * FROM {$ewd_feup_fields_table_name} WHERE Field_Show_In_Front_End='Yes' ORDER BY Field_Order";
    $Fields = $wpdb->get_results($Sql);
    $User = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$ewd_feup_user_table_name} WHERE Username='******'", $CheckCookie['Username']));
    $UserData = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$ewd_feup_user_fields_table_name} WHERE User_ID='%d'", $User->User_ID));
    $ReturnString = "";
    // Get the attributes passed by the shortcode, and store them in new variables for processing
    extract(shortcode_atts(array('redirect_page' => '#', 'login_page' => '', 'omit_fields' => '', 'submit_text' => __('Edit Profile', 'EWD_FEUP')), $atts));
    $ReturnString .= "<style type='text/css'>";
    $ReturnString .= $Custom_CSS;
    $ReturnString .= EWD_FEUP_Add_Modified_Styles();
    if ($CheckCookie['Username'] == "") {
        $ReturnString .= __('You must be logged in to access this page.', 'EWD_FEUP');
        if ($login_page != "") {
            $ReturnString .= "<br />" . __('Please', 'EWD_FEUP') . " <a href='" . $login_page . "'>" . __('login', 'EWD_FEUP') . "</a> " . __('to continue.', 'EWD_FEUP');
        }
        return $ReturnString;
    }
    if ($feup_success and $redirect_page != '#') {
        FEUPRedirect($redirect_page);
    }
    $ReturnString .= "<div id='ewd-feup-edit-profile-form-div' class='ewd-feup-form-div'>";
    if (isset($user_message['Message'])) {
        $ReturnString .= $user_message['Message'];
    }
    $ReturnString .= "<form action='#' method='post' id='ewd-feup-edit-profile-form' class='pure-form pure-form-aligned feup-pure-form-aligned' enctype='multipart/form-data'>";
    $ReturnString .= "<input type='hidden' name='ewd-feup-check' value='" . sha1(md5($Time . $Salt)) . "'>";
    $ReturnString .= "<input type='hidden' name='ewd-feup-time' value='" . $Time . "'>";
    $ReturnString .= "<input type='hidden' name='ewd-feup-action' value='edit-profile'>";
    $ReturnString .= "<input type='hidden' name='Omit_Fields' value='" . $omit_fields . "'>";
    $Omitted_Fields = explode(",", $omit_fields);
    foreach ($Fields as $Field) {
        if (!in_array($Field->Field_Name, $Omitted_Fields)) {
            if ($Field->Field_Required == "Yes") {
                $Req_Text = "required";
            } else {
                $Req_Text = "";
            }
            $Value = "";
            foreach ($UserData as $UserField) {
                if ($Field->Field_Name == $UserField->Field_Name) {
                    $Value = $UserField->Field_Value;
                }
            }
            $ReturnString .= "<div class='feup-pure-control-group'>";
            $ReturnString .= "<label for='" . $Field->Field_Name . "' id='ewd-feup-edit-" . $Field->Field_ID . "' class='ewd-feup-field-label'>" . $Field->Field_Name . ": </label>";
            if ($Field->Field_Type == "text" or $Field->Field_Type == "mediumint") {
                $ReturnString .= "<input name='" . $Field->Field_Name . "' id='ewd-feup-register-input-" . $Field->Field_ID . "' class='ewd-feup-text-input' type='text' value='" . $Value . "' " . $Req_Text . "/>";
            } elseif ($Field->Field_Type == "date") {
                $ReturnString .= "<input name='" . $Field->Field_Name . "' id='ewd-feup-register-input-" . $Field->Field_ID . "' class='ewd-feup-date-input' type='date' value='" . $Value . "' " . $Req_Text . "/>";
            } elseif ($Field->Field_Type == "datetime") {
                $ReturnString .= "<input name='" . $Field->Field_Name . "' id='ewd-feup-register-input-" . $Field->Field_ID . "' class='ewd-feup-datetime-input' type='datetime-local' value='" . $Value . "' " . $Req_Text . "/>";
            } elseif ($Field->Field_Type == "textarea") {
                $ReturnString .= "<textarea name='" . $Field->Field_Name . "' id='ewd-feup-register-input-" . $Field->Field_ID . "' class='ewd-feup-textarea' " . $Req_Text . ">" . $Value . "</textarea>";
            } elseif ($Field->Field_Type == "file") {
                $ReturnString .= __("Current file:", 'EWD_FEUP') . " " . substr($Value, 10) . " | ";
                $ReturnString .= "<input name='" . $Field->Field_Name . "' id='ewd-feup-register-input-" . $Field->Field_ID . "' class='ewd-feup-date-input' type='file' value='' " . $Req_Text . "/>";
            } elseif ($Field->Field_Type == "select") {
                $Options = explode(",", $Field->Field_Options);
                $ReturnString .= "<select name='" . $Field->Field_Name . "' id='ewd-feup-register-input-" . $Field->Field_ID . "' class='ewd-feup-select'>";
                foreach ($Options as $Option) {
                    $ReturnString .= "<option value='" . $Option . "' ";
                    if (trim($Option) == trim($Value)) {
                        $ReturnString .= "selected='selected'";
                    }
                    $ReturnString .= ">" . $Option . "</option>";
                }
                $ReturnString .= "</select>";
            } elseif ($Field->Field_Type == "radio") {
                $Counter = 0;
                $Options = explode(",", $Field->Field_Options);
                foreach ($Options as $Option) {
                    if ($Counter != 0) {
                        $ReturnString .= "</div><div class='feup-pure-control-group ewd-feup-negative-top'><label class='feup-pure-radio'></label>";
                    }
                    $ReturnString .= "<input type='radio' name='" . $Field->Field_Name . "' value='" . $Option . "' class='ewd-feup-radio' " . $Req_Text . " ";
                    if (trim($Option) == trim($Value)) {
                        $ReturnString .= "checked";
                    }
                    $ReturnString .= ">" . $Option;
                    $Counter++;
                }
            } elseif ($Field->Field_Type == "checkbox") {
                $Counter = 0;
                $Options = explode(",", $Field->Field_Options);
                $Values = explode(",", $Value);
                foreach ($Options as $Option) {
                    if ($Counter != 0) {
                        $ReturnString .= "</div><div class='feup-pure-control-group ewd-feup-negative-top'><label class='feup-pure-radio'></label>";
                    }
                    $ReturnString .= "<input type='checkbox' name='" . $Field->Field_Name . "[]' value='" . $Option . "' class='ewd-feup-checkbox' " . $Req_Text . " ";
                    if (in_array($Option, $Values)) {
                        $ReturnString .= "checked";
                    }
                    $ReturnString .= ">" . $Option . "</br>";
                    $Counter++;
                }
            }
            $ReturnString .= "</div>";
            unset($Req_Text);
        }
    }
    $ReturnString .= "<div class='feup-pure-control-group'><label for='submit'></label><input type='submit' class='ewd-feup-submit feup-pure-button feup-pure-button-primary' name='Edit_Profile_Submit' value='" . $submit_text . "'></div>";
    $ReturnString .= "</form>";
    $ReturnString .= "</div>";
    return $ReturnString;
}
function User_Search($atts, $content = null)
{
    // Include the required global variables, and create a few new ones
    global $wpdb;
    global $ewd_feup_user_table_name, $ewd_feup_user_fields_table_name;
    $Custom_CSS = get_option("EWD_FEUP_Custom_CSS");
    $UserCookie = CheckLoginCookie();
    // Get the attributes passed by the shortcode, and store them in new variables for processing
    extract(shortcode_atts(array('login_page' => '', 'login_necessary' => 'Yes', 'submit_text' => 'Search Users', 'search_fields' => '', 'user_profile_page' => ''), $atts));
    $ReturnString .= "<style type='text/css'>";
    $ReturnString .= $Custom_CSS;
    $ReturnString .= EWD_FEUP_Add_Modified_Styles();
    if (!$UserCookie and $login_necessary == "Yes") {
        $ReturnString .= __("Please log in to access this content.", 'EWD_FEUP');
        if ($login_page != "") {
            $ReturnString .= "<br />" . __('Please', 'EWD_FEUP') . " <a href='" . $login_page . "'>" . __('login', 'EWD_FEUP') . "</a> " . __('to continue.', 'EWD_FEUP');
        }
        return $ReturnString;
    }
    if ($search_fields == "") {
        $ReturnString .= __("search_fields was left blank. Please make sure to include that attribute inside your shortcode.", 'EWD_FEUP');
        return $ReturnString;
    }
    if ($_POST['ewd-feup-action'] == "user-search") {
        $Users = Get_User_Search_Results();
        $ReturnString .= "<div class='ewd-feup-user-list-result'>";
        foreach ($Users as $User) {
            $ReturnString .= "<div class='ewd-feup-user'>";
            foreach ($User as $FieldName => $ReturnField) {
                $ReturnString .= "<div class='ewd-feup-user-field'>";
                $ReturnString .= $FieldName . ": " . $ReturnField;
                $ReturnString .= "</div>";
            }
            $ReturnString .= "</div>";
        }
        $ReturnString .= "</div>";
    }
    $search_fields_array = explode(",", $search_fields);
    $ReturnString .= "<div id='ewd-feup-login-form-div'>";
    if (isset($user_message['Message'])) {
        $ReturnString .= $user_message['Message'];
    }
    $ReturnString .= "<form action='#' method='post' id='ewd-feup-login-form' class='feup-pure-form feup-pure-form-aligned'>";
    $ReturnString .= "<input type='hidden' name='ewd-feup-check' value='" . sha1(md5($Time . $Salt)) . "'>";
    $ReturnString .= "<input type='hidden' name='ewd-feup-time' value='" . $Time . "'>";
    $ReturnString .= "<input type='hidden' name='ewd-feup-action' value='user-search'>";
    foreach ($search_fields_array as $field) {
        $field_clean = trim(str_replace(" ", "_", $field));
        $field_clean = str_replace("'", "&#39", $field_clean);
        $ReturnString .= "<div class='feup-pure-control-group'>";
        $ReturnString .= "<label for='" . $field . "' id='ewd-feup-" . $field_clean . "-div' class='ewd-feup-field-label'>" . $field . ": </label>";
        $ReturnString .= "<input type='text' class='ewd-feup-text-input' name='search_" . $field_clean . "' placeholder='" . $field . "...'>";
        $ReturnString .= "</div>";
    }
    $ReturnString .= "<div class='feup-pure-control-group'>";
    $ReturnString .= "<label for='Submit'></label><input type='submit' class='ewd-feup-submit feup-pure-button feup-pure-button-primary' name='Search_Submit' value='" . $submit_text . "'>";
    $ReturnString .= "</div>";
    $ReturnString .= "</form>";
    $ReturnString .= "</div>";
    return $ReturnString;
}
Exemplo n.º 10
0
function Insert_Edit_Account_Form($atts)
{
    global $wpdb, $user_message, $feup_success;
    global $ewd_feup_user_table_name;
    $Custom_CSS = get_option("EWD_FEUP_Custom_CSS");
    $Username_Is_Email = get_option("EWD_FEUP_Username_Is_Email");
    $CheckCookie = CheckLoginCookie();
    //$Sql = "SELECT * FROM $ewd_feup_fields_table_name ";
    //$Fields = $wpdb->get_results($Sql);
    $User = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$ewd_feup_user_table_name} WHERE Username='******'", $CheckCookie['Username']));
    $feup_Label_Please = get_option("EWD_FEUP_Label_Please");
    if ($feup_Label_Please == "") {
        $feup_Label_Please = __("Please", 'EWD_FEUP');
    }
    $feup_Label_To_Continue = get_option("EWD_FEUP_Label_To_Continue");
    if ($feup_Label_To_Continue == "") {
        $feup_Label_To_Continue = __("To Continue", 'EWD_FEUP');
    }
    $feup_Label_Login = get_option("EWD_FEUP_Label_Login");
    if ($feup_Label_Login == "") {
        $feup_Label_Login = __("Login", 'EWD_FEUP');
    }
    $feup_Label_Email = get_option("EWD_FEUP_Label_Email");
    if ($feup_Label_Email == "") {
        $feup_Label_Email = __("Email", 'EWD_FEUP');
    }
    $feup_Label_Username = get_option("EWD_FEUP_Label_Username");
    if ($feup_Label_Username == "") {
        $feup_Label_Username = __("Username", 'EWD_FEUP');
    }
    $feup_Label_Password = get_option("EWD_FEUP_Label_Password");
    if ($feup_Label_Password == "") {
        $feup_Label_Password = __("Password", 'EWD_FEUP');
    }
    $feup_Label_Repeat_Password = get_option("EWD_FEUP_Label_Repeat_Password");
    if ($feup_Label_Repeat_Password == "") {
        $feup_Label_Repeat_Password = __("Repeat Password", 'EWD_FEUP');
    }
    $feup_Label_Password_Strength = get_option("EWD_FEUP_Label_Password_Strength");
    if ($feup_Label_Password_Strength == "") {
        $feup_Label_Password_Strength = __("Password Strength", 'EWD_FEUP');
    }
    $feup_Label_Require_Login_Message = get_option("EWD_FEUP_Label_Require_Login_Message");
    if ($feup_Label_Require_Login_Message == "") {
        $feup_Label_Require_Login_Message = __('You must be logged in to access this page.', 'EWD_FEUP');
    }
    $ReturnString = "";
    // Get the attributes passed by the shortcode, and store them in new variables for processing
    extract(shortcode_atts(array('redirect_page' => '#', 'login_page' => '', 'submit_text' => __('Update Account', 'EWD_FEUP')), $atts));
    $ReturnString .= "<style type='text/css'>";
    $ReturnString .= $Custom_CSS;
    $ReturnString .= EWD_FEUP_Add_Modified_Styles();
    if ($CheckCookie['Username'] == "") {
        $ReturnString .= $feup_Label_Require_Login_Message;
        if ($login_page != "") {
            $ReturnString .= "<br />" . $feup_Label_Please . " <a href='" . $login_page . "'>" . $feup_Label_Login . "</a> " . $feup_Label_To_Continue;
        }
        return $ReturnString;
    }
    if ($feup_success and $redirect_page != '#') {
        FEUPRedirect($redirect_page);
    }
    $ReturnString .= "<div id='ewd-feup-edit-account-form-div' class='ewd-feup-form-div'>";
    if (isset($user_message['Message'])) {
        $ReturnString .= $user_message['Message'];
    }
    $ReturnString .= "<form action='#' method='post' id='ewd-feup-edit-account-form' class='pure-form pure-form-aligned feup-pure-form-aligned'>";
    $ReturnString .= "<input type='hidden' name='ewd-feup-check' value='" . sha1(md5($Time . $Salt)) . "'>";
    $ReturnString .= "<input type='hidden' name='ewd-feup-time' value='" . $Time . "'>";
    $ReturnString .= "<input type='hidden' name='ewd-feup-action' value='edit-account'>";
    if ($Username_Is_Email == "Yes") {
        $ReturnString .= "<div class='feup-pure-control-group'>";
        $ReturnString .= "<label for='Username' id='ewd-feup-register-username-div' class='ewd-feup-field-label ewd-feup-login-label'>" . $feup_Label_Email . ": </label>";
        // $ReturnString .= "<div id='ewd-feup-register-username-div' class='ewd-feup-field-label'>" . __('Email', 'EWD_FEUP') . ": </div>";
        $ReturnString .= "<input type='email' class='ewd-feup-text-input' name='Username' value='" . $User->Username . "'>";
        $ReturnString .= "</div>";
    } else {
        $ReturnString .= "<div class='feup-pure-control-group'>";
        $ReturnString .= "<label for='Username' id='ewd-feup-register-username-div' class='ewd-feup-field-label ewd-feup-login-label'>" . $feup_Label_Username . ": </label>";
        // $ReturnString .= "<div id='ewd-feup-register-username-div' class='ewd-feup-field-label'>" . __('Username', 'EWD_FEUP') . ": </div>";
        $ReturnString .= "<input type='text' class='ewd-feup-text-input' name='Username' value='" . $User->Username . "'>";
        $ReturnString .= "</div>";
    }
    $ReturnString .= "<div class='feup-pure-control-group'>";
    $ReturnString .= "<label for='Password' id='ewd-feup-login-password-div' class='ewd-feup-field-label ewd-feup-login-label'>" . $feup_Label_Password . ": </label>";
    // $ReturnString .= "<div id='ewd-feup-register-password-div' class='ewd-feup-field-label'>" . __('Password', 'EWD_FEUP') . ": </div>";
    $ReturnString .= "<input type='password' class='ewd-feup-text-input ewd-feup-password-input' name='User_Password' value=''>";
    $ReturnString .= "</div>";
    $ReturnString .= "<div class='feup-pure-control-group'>";
    $ReturnString .= "<label for='Repeat-Password' id='ewd-feup-register-password-confirm-div' class='ewd-feup-field-label ewd-feup-login-label'>" . $feup_Label_Repeat_Password . ": </label>";
    // $ReturnString .= "<div id='ewd-feup-register-password-confirm-div' class='ewd-feup-field-label'>" . __('Repeat Password', 'EWD_FEUP') . ": </div>";
    $ReturnString .= "<input type='password' class='ewd-feup-text-input ewd-feup-check-password-input' name='Confirm_User_Password' value=''>";
    $ReturnString .= "</div>";
    $ReturnString .= "<div class='feup-pure-control-group'>";
    $ReturnString .= "<label for='Password Strength' id='ewd-feup-password-strength' class='ewd-feup-field-label'>" . $feup_Label_Password_Strength . ": </label>";
    $ReturnString .= "<span id='ewd-feup-password-result'>Too Short</span>";
    $ReturnString .= "</div>";
    $ReturnString .= "<div class='feup-pure-control-group'><label for='submit'></label><input type='submit' class='ewd-feup-submit feup-pure-button feup-pure-button-primary' name='Edit_Profile_Submit' value='" . $submit_text . "'></div>";
    $ReturnString .= "</form>";
    $ReturnString .= "</div>";
    return $ReturnString;
}
function Insert_Register_Form($atts)
{
    // Include the required global variables, and create a few new ones
    global $wpdb, $post, $user_message, $feup_success;
    global $ewd_feup_fields_table_name;
    $Custom_CSS = get_option("EWD_FEUP_Custom_CSS");
    $Salt = get_option("EWD_FEUP_Hash_Salt");
    $Username_Is_Email = get_option("EWD_FEUP_Username_Is_Email");
    $Use_Captcha = get_option("EWD_FEUP_Use_Captcha");
    $Time = time();
    $Sql = "SELECT * FROM {$ewd_feup_fields_table_name} ORDER BY Field_Order";
    $Fields = $wpdb->get_results($Sql);
    $ReturnString = "";
    if (isset($_GET['ConfirmEmail'])) {
        ConfirmUserEmail();
    }
    // Get the attributes passed by the shortcode, and store them in new variables for processing
    extract(shortcode_atts(array('redirect_page' => '#', 'redirect_field' => "", 'redirect_array_string' => "", 'submit_text' => __('Register', 'EWD_FEUP')), $atts));
    if (isset($_GET['ConfirmEmail'])) {
        $ConfirmationSuccess = ConfirmUserEmail();
    }
    if ($feup_success and $redirect_field != "") {
        $redirect_page = Determine_Redirect_Page($redirect_field, $redirect_array_string, $redirect_page);
    }
    if ($feup_success and $redirect_page != '#') {
        FEUPRedirect($redirect_page);
    }
    $ReturnString .= "<style type='text/css'>";
    $ReturnString .= $Custom_CSS;
    $ReturnString .= EWD_FEUP_Add_Modified_Styles();
    if (!isset($ConfirmationSuccess)) {
        $ReturnString .= "<div id='ewd-feup-register-form-div' class='ewd-feup-form-div'>";
        if (isset($user_message['Message'])) {
            $ReturnString .= $user_message['Message'];
        }
        $ReturnString .= "<form action='#' method='post' id='ewd-feup-register-form' class='feup-pure-form feup-pure-form-aligned' enctype='multipart/form-data'>";
        $ReturnString .= "<input type='hidden' name='ewd-feup-check' value='" . sha1(md5($Time . $Salt)) . "'>";
        $ReturnString .= "<input type='hidden' name='ewd-feup-time' value='" . $Time . "'>";
        $ReturnString .= "<input type='hidden' name='ewd-feup-action' value='register'>";
        $ReturnString .= "<input type='hidden' name='ewd-feup-post-id' value='" . $post->ID . "'>";
        $ReturnString .= "<div class='feup-pure-control-group'>";
        if ($Username_Is_Email == "Yes") {
            $ReturnString .= "<label for='Username' id='ewd-feup-register-username-div' class='ewd-feup-field-label'>" . __('Email', 'EWD_FEUP') . ": </label>";
            if (isset($_POST['Username'])) {
                $ReturnString .= "<input type='email' class='ewd-feup-text-input' name='Username' value='" . $_POST['Username'] . "'>";
            } else {
                $ReturnString .= "<input type='email' class='ewd-feup-text-input' name='Username' placeholder='" . __('Email', 'EWD_FEUP') . "...'>";
            }
        } else {
            $ReturnString .= "<label for='Username' id='ewd-feup-register-username-div' class='ewd-feup-field-label'>" . __('Username', 'EWD_FEUP') . ": </label>";
            if (isset($_POST['Username'])) {
                $ReturnString .= "<input type='text' class='ewd-feup-text-input' name='Username' value='" . $_POST['Username'] . "'>";
            } else {
                $ReturnString .= "<input type='text' class='ewd-feup-text-input' name='Username' placeholder='" . __('Username', 'EWD_FEUP') . "...'>";
            }
        }
        $ReturnString .= "</div>";
        $ReturnString .= "<div class='feup-pure-control-group'>";
        $ReturnString .= "<label for='Password' id='ewd-feup-register-password-div' class='ewd-feup-field-label'>" . __('Password', 'EWD_FEUP') . ": </label>";
        if (isset($_POST['User_Password'])) {
            $ReturnString .= "<input type='password' class='ewd-feup-text-input' name='User_Password' value='" . $_POST['User_Password'] . "'>";
        } else {
            $ReturnString .= "<input type='password' class='ewd-feup-text-input' name='User_Password'>";
        }
        $ReturnString .= "</div>";
        $ReturnString .= "<div class='feup-pure-control-group'>";
        $ReturnString .= "<label for='Repeat Password' id='ewd-feup-register-password-confirm-div' class='ewd-feup-field-label'>" . __('Repeat Password', 'EWD_FEUP') . ": </label>";
        if (isset($_POST['Confirm_User_Password'])) {
            $ReturnString .= "<input type='password' class='ewd-feup-text-input' name='Confirm_User_Password' value='" . $_POST['Confirm_User_Password'] . "'>";
        } else {
            $ReturnString .= "<input type='password' class='ewd-feup-text-input' name='Confirm_User_Password'>";
        }
        $ReturnString .= "</div>";
        foreach ($Fields as $Field) {
            if ($Field->Field_Required == "Yes") {
                $Req_Text = "required";
            } else {
                $Req_Text = "";
            }
            $ReturnString .= "<div class='feup-pure-control-group'>";
            $ReturnString .= "<label for='" . $Field->Field_Name . "' id='ewd-feup-register-" . $Field->Field_ID . "' class='ewd-feup-field-label'>" . __($Field->Field_Name, 'EWD_FEUP') . ": </label>";
            if ($Field->Field_Type == "text" or $Field->Field_Type == "mediumint") {
                if (isset($_POST[str_replace(" ", "_", $Field->Field_Name)])) {
                    $ReturnString .= "<input name='" . $Field->Field_Name . "' id='ewd-feup-register-input-" . $Field->Field_ID . "' class='ewd-feup-text-input pure-input-1-3' type='text' value='" . $_POST[str_replace(" ", "_", $Field->Field_Name)] . "' " . $Req_Text . "/>";
                } else {
                    $ReturnString .= "<input name='" . $Field->Field_Name . "' id='ewd-feup-register-input-" . $Field->Field_ID . "' class='ewd-feup-text-input' type='text' placeholder='" . $Field->Field_Name . "' " . $Req_Text . "/>";
                }
            } elseif ($Field->Field_Type == "date") {
                $ReturnString .= "<input name='" . $Field->Field_Name . "' id='ewd-feup-register-input-" . $Field->Field_ID . "' class='ewd-feup-date-input' type='date' value='" . $Value . "' " . $Req_Text . "/>";
            } elseif ($Field->Field_Type == "datetime") {
                $ReturnString .= "<input name='" . $Field->Field_Name . "' id='ewd-feup-register-input-" . $Field->Field_ID . "' class='ewd-feup-datetime-input' type='datetime-local' value='" . $Value . "' " . $Req_Text . "/>";
            } elseif ($Field->Field_Type == "file") {
                $ReturnString .= "<input name='" . $Field->Field_Name . "' id='ewd-feup-register-input-" . $Field->Field_ID . "' class='ewd-feup-date-input' type='file' value='' " . $Req_Text . "/>";
            } elseif ($Field->Field_Type == "textarea") {
                $ReturnString .= "<textarea name='" . $Field->Field_Name . "' id='ewd-feup-register-input-" . $Field->Field_ID . "' class='ewd-feup-textarea' " . $Req_Text . ">" . $_POST[str_replace(" ", "_", $Field->Field_Name)] . "</textarea>";
            } elseif ($Field->Field_Type == "select") {
                $Options = explode(",", $Field->Field_Options);
                $ReturnString .= "<select name='" . $Field->Field_Name . "' id='ewd-feup-register-input-" . $Field->Field_ID . "' class='ewd-feup-select'>";
                foreach ($Options as $Option) {
                    $ReturnString .= "<option value='" . $Option . "' ";
                    if (isset($_POST[str_replace(" ", "_", $Field->Field_Name)]) and $Option == $_POST[str_replace(" ", "_", $Field->Field_Name)]) {
                        $ReturnString .= "selected='selected'";
                    }
                    $ReturnString .= ">" . $Option . "</option>";
                }
                $ReturnString .= "</select>";
            } elseif ($Field->Field_Type == "radio") {
                $Counter = 0;
                $Options = explode(",", $Field->Field_Options);
                foreach ($Options as $Option) {
                    if ($Counter != 0) {
                        $ReturnString .= "</div><div class='feup-pure-control-group ewd-feup-negative-top'><label class='feup-pure-radio'></label>";
                    }
                    $ReturnString .= "<input type='radio' name='" . $Field->Field_Name . "' value='" . $Option . "' class='ewd-feup-radio' " . $Req_Text . " ";
                    if (isset($_POST[str_replace(" ", "_", $Field->Field_Name)]) and $Option == $_POST[str_replace(" ", "_", $Field->Field_Name)]) {
                        $ReturnString .= "checked='checked'";
                    }
                    $ReturnString .= ">" . $Option . "<br/>";
                    $Counter++;
                }
            } elseif ($Field->Field_Type == "checkbox") {
                $Counter = 0;
                $Options = explode(",", $Field->Field_Options);
                foreach ($Options as $Option) {
                    if ($Counter != 0) {
                        $ReturnString .= "</div><div class='feup-pure-control-group ewd-feup-negative-top'><label class='feup-pure-radio'></label>";
                    }
                    $ReturnString .= "<input type='checkbox' name='" . $Field->Field_Name . "[]' value='" . $Option . "' class='ewd-feup-checkbox' " . $Req_Text . " ";
                    if (isset($_POST[str_replace(" ", "_", $Field->Field_Name)])) {
                        if (in_array($Option, $_POST[str_replace(" ", "_", $Field->Field_Name)])) {
                            $ReturnString .= "checked";
                        }
                    }
                    $ReturnString .= ">" . $Option . "</br>";
                    $Counter++;
                }
            }
            $ReturnString .= "</div>";
            unset($Req_Text);
        }
        if ($Use_Captcha == "Yes") {
            $ReturnString .= EWD_FEUP_Add_Captcha();
        }
        $ReturnString .= "<div class='feup-pure-control-group'><label for='submit'></label><input type='submit' class='ewd-feup-submit feup-pure-button feup-pure-button-primary' name='Register_Submit' value='" . $submit_text . "'></div>";
        $ReturnString .= "</form>";
        $ReturnString .= "</div>";
    } else {
        $ReturnString = "<div class='ewd-feup-email-confirmation'>";
        if ($ConfirmationSuccess == "Yes") {
            $ReturnString .= __("Thanks for confirming your e-mail address!", 'EWD_FEUP');
        }
        if ($ConfirmationSuccess == "No") {
            $ReturnString .= __("The confirmation number provided was incorrect. Please contact the site administrator for assistance.", 'EWD_FEUP');
        }
        $ReturnString .= "</div>";
    }
    return $ReturnString;
}
Exemplo n.º 12
0
function Insert_Login_Form($atts)
{
    global $user_message, $feup_success;
    // Include the required global variables, and create a few new ones
    $Salt = get_option("EWD_FEUP_Hash_Salt");
    $Custom_CSS = get_option("EWD_FEUP_Custom_CSS");
    $Username_Is_Email = get_option("EWD_FEUP_Username_Is_Email");
    $Time = time();
    $Payment_Frequency = get_option("EWD_FEUP_Payment_Frequency");
    $Payment_Types = get_option("EWD_FEUP_Payment_Types");
    $Membership_Cost = get_option("EWD_FEUP_Membership_Cost");
    $Levels_Payment_Array = get_option("EWD_FEUP_Levels_Payment_Array");
    $feup_Label_Login = get_option("EWD_FEUP_Label_Login");
    if ($feup_Label_Login == "") {
        $feup_Label_Login = __("Login", 'EWD_FEUP');
    }
    $feup_Label_Email = get_option("EWD_FEUP_Label_Email");
    if ($feup_Label_Email == "") {
        $feup_Label_Email = __("Email", 'EWD_FEUP');
    }
    $feup_Label_Username = get_option("EWD_FEUP_Label_Username");
    if ($feup_Label_Username == "") {
        $feup_Label_Username = __("Username", 'EWD_FEUP');
    }
    $feup_Label_Password = get_option("EWD_FEUP_Label_Password");
    if ($feup_Label_Password == "") {
        $feup_Label_Password = __("Password", 'EWD_FEUP');
    }
    $ReturnString = "";
    // Get the attributes passed by the shortcode, and store them in new variables for processing
    extract(shortcode_atts(array('redirect_page' => '#', 'redirect_field' => '', 'redirect_array_string' => '', 'submit_text' => __('Login', 'EWD_FEUP')), $atts));
    $ReturnString .= "<style type='text/css'>";
    $ReturnString .= $Custom_CSS;
    $ReturnString .= EWD_FEUP_Add_Modified_Styles();
    $ReturnString .= "</style>";
    if ($_POST['Payment_Required'] == "Yes") {
        if ($Payment_Types == "Membership" and is_numeric($Membership_Cost) and $Membership_Cost != "" or $Payment_Types == "Levels" and sizeof($Levels_Payment_Array) > 0) {
            $ReturnString .= do_shortcode("[account-payment]");
            return $ReturnString;
        }
    }
    if ($feup_success and $redirect_field != "") {
        $redirect_page = Determine_Redirect_Page($redirect_field, $redirect_array_string, $redirect_page);
    }
    // if there is no redirect page, have the current page reload
    if ($feup_success and $redirect_page != '#') {
        FEUPRedirect($redirect_page);
    }
    $ReturnString .= "<div id='ewd-feup-login' class='ewd-feup-login-form-div' class='ewd-feup-form-div'>";
    if (isset($user_message['Message'])) {
        $ReturnString .= $user_message['Message'];
    }
    if (strpos($user_message['Message'], "Payment required.") !== false) {
        $ReturnString .= "</div>";
        return $ReturnString;
    }
    //Payment required
    $ReturnString .= "<form action='user-blog' method='post' id='ewd-feup-login-form' class='pure-form pure-form-aligned feup-pure-form-aligned'>";
    $ReturnString .= "<input type='hidden' name='ewd-feup-check' value='" . sha1(md5($Time . $Salt)) . "'>";
    $ReturnString .= "<input type='hidden' name='ewd-feup-time' value='" . $Time . "'>";
    $ReturnString .= "<input type='hidden' name='ewd-feup-action' value='login'>";
    $ReturnString .= "<div class='feup-pure-control-group'>";
    if ($Username_Is_Email == "Yes") {
        $ReturnString .= "<label for='Username' id='ewd-feup-login-username-div' class='ewd-feup-field-label ewd-feup-login-label'>" . $feup_Label_Email . ": </label>";
        $ReturnString .= "<input type='email' class='ewd-feup-text-input ewd-feup-login-field' name='Username' placeholder='" . $feup_Label_Email . "...'>";
    } else {
        $ReturnString .= "<label for='Username' id='ewd-feup-login-username-div' class='ewd-feup-field-label ewd-feup-login-label'>" . $feup_Label_Username . ": </label>";
        $ReturnString .= "<input type='text' class='ewd-feup-text-input ewd-feup-login-field' name='Username' placeholder='" . $feup_Label_Username . "...'>";
    }
    $ReturnString .= "</div>";
    $ReturnString .= "<div class='feup-pure-control-group'>";
    $ReturnString .= "<label for='Password' id='ewd-feup-login-password-div' class='ewd-feup-field-label ewd-feup-login-label'>" . $feup_Label_Password . ": </label>";
    $ReturnString .= "<input type='password' class='ewd-feup-text-input ewd-feup-login-field' name='User_Password'>";
    $ReturnString .= "</div>";
    $ReturnString .= "<div class='feup-pure-control-group'>";
    $ReturnString .= "<label for='Submit'></label><input type='submit' class='ewd-feup-submit ewd-feup-login-submit feup-pure-button feup-pure-button-primary' name='Login_Submit' value='" . $feup_Label_Login . "'>";
    $ReturnString .= "</div>";
    $ReturnString .= "</form>";
    $ReturnString .= "</div>";
    return $ReturnString;
}
Exemplo n.º 13
0
function Insert_User_Profile($atts)
{
    // Include the required global variables, and create a few new ones
    global $wpdb, $user_message;
    global $ewd_feup_fields_table_name, $ewd_feup_user_table_name, $ewd_feup_user_fields_table_name;
    $Custom_CSS = get_option("EWD_FEUP_Custom_CSS");
    $Salt = get_option("EWD_FEUP_Hash_Salt");
    $Time = time();
    $CheckCookie = CheckLoginCookie();
    $Sql = "SELECT * FROM {$ewd_feup_fields_table_name} WHERE Field_Show_In_Front_End='Yes' ORDER BY Field_Order";
    $Fields = $wpdb->get_results($Sql);
    if (isset($_GET['User_ID'])) {
        $UserData = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$ewd_feup_user_fields_table_name} WHERE User_ID='%d'", $_GET['User_ID']));
    }
    //elseif (isset(get_query_var('user_id')))) {$UserData = $wpdb->get_results($wpdb->prepare("SELECT * FROM $ewd_feup_user_fields_table_name WHERE User_ID='%d'", get_query_var('user_id')));}
    $ReturnString = "";
    if (!isset($UserData)) {
        return $feup_Label_Select_Valid_Profile;
    }
    // Get the attributes passed by the shortcode, and store them in new variables for processing
    extract(shortcode_atts(array('login_page' => '', 'omit_fields' => '', 'login_necessary' => 'Yes', 'submit_text' => __('Edit Profile', 'EWD_FEUP')), $atts));
    if (get_option("EWD_FEUP_Label_Edit_Profile") != "") {
        $submit_text = get_option("EWD_FEUP_Label_Edit_Profile");
    }
    $feup_Label_Require_Login_Message = get_option("EWD_FEUP_Label_Require_Login_Message");
    if ($feup_Label_Require_Login_Message == "") {
        $feup_Label_Require_Login_Message = __('You must be logged in to access this page.', 'EWD_FEUP');
    }
    $feup_Label_Please = get_option("EWD_FEUP_Label_Please");
    if ($feup_Label_Please == "") {
        $feup_Label_Please = __("Please", 'EWD_FEUP');
    }
    $feup_Label_To_Continue = get_option("EWD_FEUP_Label_To_Continue");
    if ($feup_Label_To_Continue == "") {
        $feup_Label_To_Continue = __("To Continue", 'EWD_FEUP');
    }
    $feup_Label_Login = get_option("EWD_FEUP_Label_Login");
    if ($feup_Label_Login == "") {
        $feup_Label_Login = __("Login", 'EWD_FEUP');
    }
    $feup_Label_Select_Valid_Profile = get_option("EWD_FEUP_Label_Select_Valid_Profile");
    if ($feup_Label_Select_Valid_Profile == "") {
        $feup_Label_Select_Valid_Profile = __("Please select a valid user profile", 'EWD_FEUP');
    }
    $ReturnString .= "<style type='text/css'>";
    $ReturnString .= $Custom_CSS;
    $ReturnString .= EWD_FEUP_Add_Modified_Styles();
    if ($CheckCookie['Username'] == "" and $login_necessary == "Yes") {
        $ReturnString .= $feup_Label_Require_Login_Message;
        if ($login_page != "") {
            $ReturnString .= "<br />" . $feup_Label_Please . " <a href='" . $login_page . "'>" . $feup_Label_Login . "</a> " . $feup_Label_To_Continue;
        }
        return $ReturnString;
    }
    $ReturnString .= "<div id='ewd-feup-user-profile-div' class='ewd-feup-user-profile-div'>";
    $Omitted_Fields = explode(",", $omit_fields);
    foreach ($Fields as $Field) {
        if (!in_array($Field->Field_Name, $Omitted_Fields)) {
            $Value = "";
            foreach ($UserData as $UserField) {
                if ($Field->Field_Name == $UserField->Field_Name) {
                    $Value = $UserField->Field_Value;
                }
            }
            $ReturnString .= "<div class='feup-user-profile-field'>";
            $ReturnString .= "<div id='ewd-feup-user-profile-label-" . $Field->Field_ID . "' class='ewd-feup-user-profile-label'>" . $Field->Field_Name . ": </div>";
            if ($Field->Field_Type != "picture") {
                $ReturnString .= "<div class='ewd-feup-text-input ewd-feup-user-profile-input'>" . $Value . "</div>";
            } else {
                $ReturnString .= "<img class='ewd-feup-profile-picture' src='" . site_url("/wp-content/uploads/ewd-feup-user-uploads/") . $Value . "' alt='" . $Field->Field_Name . "'/>";
            }
            $ReturnString .= "</div>";
        }
    }
    $ReturnString .= "</div>";
    return $ReturnString;
}
Exemplo n.º 14
0
function EWD_FEUP_Account_Payment($atts)
{
    global $wpdb;
    global $ewd_feup_user_table_name, $ewd_feup_levels_table_name;
    $Custom_CSS = get_option("EWD_FEUP_Custom_CSS");
    $Payment_Frequency = get_option("EWD_FEUP_Payment_Frequency");
    $Payment_Types = get_option("EWD_FEUP_Payment_Types");
    $Membership_Cost = get_option("EWD_FEUP_Membership_Cost");
    $PayPal_Email_Address = get_option("EWD_FEUP_PayPal_Email_Address");
    $Pricing_Currency_Code = get_option("EWD_FEUP_Pricing_Currency_Code");
    $Thank_You_URL = get_option("EWD_FEUP_Thank_You_URL");
    $Discount_Codes_Array = get_option("EWD_FEUP_Discount_Codes_Array");
    $Levels_Payment_Array = get_option("EWD_FEUP_Levels_Payment_Array");
    if (!is_array($Levels_Payment_Array)) {
        $Levels_Payment_Array = array();
    }
    $CheckCookie = CheckLoginCookie();
    // Get the attributes passed by the shortcode, and store them in new variables for processing
    extract(shortcode_atts(array('username' => '', 'level' => '', 'discount_code' => ''), $atts));
    if ($CheckCookie['Username'] != "") {
        $username = $CheckCookie['Username'];
    }
    $ReturnString = "<style type='text/css'>";
    $ReturnString .= $Custom_CSS;
    $ReturnString .= EWD_FEUP_Add_Modified_Styles();
    $ReturnString .= "</style>";
    if ($username == "" and isset($_POST['Username'])) {
        $username = $_POST['Username'];
    }
    if ($level == "" and isset($_POST['level'])) {
        $level = $_POST['level'];
    }
    if ($discount_code == "" and isset($_POST['discount_code'])) {
        $discount_code = $_POST['discount_code'];
    }
    $feup_Label_Upgrade_Account = get_option("EWD_FEUP_Label_Upgrade_Account");
    $feup_Label_Upgrade_Level = get_option("EWD_FEUP_Label_Upgrade_Level");
    $feup_Label_Username = get_option("EWD_FEUP_Label_Username");
    $feup_Label_Level = get_option("EWD_FEUP_Label_Level");
    $feup_Label_Next = get_option("EWD_FEUP_Label_Next");
    $feup_Label_Discount_Message = get_option("EWD_FEUP_Label_Discount_Message");
    $feup_Label_Discount_Code = get_option("EWD_FEUP_Label_Discount_Code");
    $feup_Label_Use_Discount_Code = get_option("EWD_FEUP_Label_Use_Discount_Code");
    if ($feup_Label_Upgrade_Account == "") {
        $feup_Label_Upgrade_Account = __("Upgrade Account", 'EWD_FEUP');
    }
    if ($feup_Label_Upgrade_Level == "") {
        $feup_Label_Upgrade_Level = __("Select the level you'd like to upgrade to using the form below:", 'EWD_FEUP');
    }
    if ($feup_Label_Username == "") {
        $feup_Label_Username = __('Username', 'EWD_FEUP');
    }
    if ($feup_Label_Level == "") {
        $feup_Label_Level = __('Level', 'EWD_FEUP');
    }
    if ($feup_Label_Next == "") {
        $feup_Label_Next = __('Next', 'EWD_FEUP');
    }
    if ($feup_Label_Discount_Message == "") {
        $feup_Label_Discount_Message = __("Have a discount code? Enter it below.", 'EWD_FEUP');
    }
    if ($feup_Label_Discount_Code == "") {
        $feup_Label_Discount_Code = __('Discount Code', 'EWD_FEUP');
    }
    if ($feup_Label_Use_Discount_Code == "") {
        $feup_Label_Discount_Code = __('Use Discount Code', 'EWD_FEUP');
    }
    if ($username == "" or $Payment_Types == "Levels" and $level == "") {
        $ReturnString .= "<div class-'ewd-feup-paypal-username-form'>";
        if ($Payment_Types == "Levels") {
            $ReturnString .= "<h4>" . $feup_Label_Upgrade_Account . "</h4>";
            $ReturnString .= "<p>" . $feup_Label_Upgrade_Level . "</p>";
        }
        $ReturnString .= "<form action='#' method='post'>";
        if ($username == "") {
            $ReturnString .= "<div class='feup-pure-control-group'>";
            $ReturnString .= "<label for='Username' id='ewd-feup-paypal-username-div' class='ewd-feup-field-label'>" . $feup_Label_Username . ": </label>";
            $ReturnString .= "<input type='text' class='ewd-feup-text-input ewd-feup-paypal-username-input' name='Username'>";
            $ReturnString .= "</div>";
        } else {
            $ReturnString .= "<div class='feup-pure-control-group'>";
            $ReturnString .= "<label for='Username' id='ewd-feup-paypal-username-label' class='ewd-feup-field-label'>" . $feup_Label_Username . ": </label>";
            $ReturnString .= "<input type='hidden' name='Username' value='" . $username . "' />";
            $ReturnString .= "<span class='ewd-feup-username'>" . $username . "</span>";
            $ReturnString .= "</div>";
        }
        if ($Payment_Types == "Levels") {
            if ($level == "") {
                $ReturnString .= "<div class='feup-pure-control-group'>";
                $ReturnString .= "<label for='level' id='ewd-feup-paypal-username-div' class='ewd-feup-field-label'>" . $feup_Label_Level . ": </label>";
                $ReturnString .= "<select class='ewd-feup-select-input' name='level'>";
                foreach ($Levels_Payment_Array as $Level_Payment_Item) {
                    $Level = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$ewd_feup_levels_table_name} WHERE Level_ID=%d", $Level_Payment_Item['Level']));
                    $ReturnString .= "<option value='" . $Level_Payment_Item['Level'] . "'>" . $Level->Level_Name . " (" . $Level_Payment_Item['Amount'] . ")</option>";
                }
                $ReturnString .= "</select>";
                $ReturnString .= "</div>";
            } else {
                $ReturnString .= "<input type='hidden' name='level' value='" . $level . "' />";
            }
        }
        $ReturnString .= "<div class='feup-pure-control-group'><label for='submit'></label><input type='submit' class='ewd-feup-submit feup-pure-button feup-pure-button-primary' name='PayPal_Username_Submit' value='" . $feup_Label_Next . "'></div>";
        $ReturnString .= "</form>";
        $ReturnString .= "</div>";
    } else {
        $User = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$ewd_feup_user_table_name} WHERE Username=%s", $username));
        if ($Payment_Frequency == "One_Time") {
            if ($Payment_Types == "Membership") {
                if ($discount_code != "") {
                    $Discount = EWD_FEUP_Calculate_Discount("Membership", $discount_code, $Payment_Frequency);
                } else {
                    $Discount['Amount'] = 0;
                }
                $Payment_Amount = $Membership_Cost - $Discount['Amount'];
                $ReturnString .= "<div class='ewd-feup-paypal-form'>";
                $ReturnString .= "<form action='https://www.paypal.com/cgi-bin/webscr' method='post' class='standard-form'>";
                //$ReturnString .= "<form action='https://www.sandbox.paypal.com/cgi-bin/webscr' method='post' class='standard-form'>";
                $ReturnString .= "<input type='hidden' name='item_name_1' value='" . substr(get_bloginfo('name'), 0, 100) . " Site Membership' />";
                $ReturnString .= "<input type='hidden' name='quantity_1' value='1' />";
                $ReturnString .= "<input type='hidden' name='amount_1' value='" . $Payment_Amount . "' />";
                $ReturnString .= "<input type='hidden' name='custom' value='User_ID=" . $User->User_ID . "&discount_code=" . $discount_code . "' />";
                $ReturnString .= "<input type='hidden' name='cmd' value='_cart' />";
                $ReturnString .= "<input type='hidden' name='upload' value='1' />";
                $ReturnString .= "<input type='hidden' name='business' value='" . $PayPal_Email_Address . "' />";
                $ReturnString .= "<input type='hidden' name='currency_code' value='" . $Pricing_Currency_Code . "' />";
                //$ReturnString .= "<input type='hidden' name='lc' value='CA' />"
                //$ReturnString .= "<input type='hidden' name='rm' value='2' />";
                $ReturnString .= "<input type='hidden' name='return' value='" . $Thank_You_URL . "' />";
                //$ReturnString .= "<input type='hidden' name='cancel_return' value='" . ' />
                $ReturnString .= "<input type='hidden' name='notify_url' value='" . get_site_url() . "' />";
                $ReturnString .= "<input type='submit' class='submit-button' value='Proceed to Payment' />";
                $ReturnString .= "</form>";
                $ReturnString .= "</div>";
            } else {
                $Selected_Level = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$ewd_feup_levels_table_name} WHERE Level_ID=%d", $level));
                if ($discount_code != "") {
                    $Discount = EWD_FEUP_Calculate_Discount($level, $discount_code, $Payment_Frequency);
                } else {
                    $Discount['Amount'] = 0;
                }
                $Level_Cost = EWD_FEUP_Calculate_Level_Payment($level);
                $Payment_Amount = $Level_Cost - $Discount['Amount'];
                $ReturnString .= "<div class='ewd-feup-paypal-form'>";
                $ReturnString .= "<form action='https://www.paypal.com/cgi-bin/webscr' method='post' class='standard-form'>";
                //$ReturnString .= "<form action='https://www.sandbox.paypal.com/cgi-bin/webscr' method='post' class='standard-form'>";
                $ReturnString .= "<input type='hidden' name='item_name_1' value='" . substr(get_bloginfo('name'), 0, 100) . " " . $Selected_Level->Level_Name . " Fee' />";
                $ReturnString .= "<input type='hidden' name='quantity_1' value='1' />";
                $ReturnString .= "<input type='hidden' name='amount_1' value='" . $Payment_Amount . "' />";
                $ReturnString .= "<input type='hidden' name='custom' value='User_ID=" . $User->User_ID . "&discount_code=" . $discount_code . "&level_id=" . $level . "&current_level_id=" . $User->Level_ID . "' />";
                $ReturnString .= "<input type='hidden' name='cmd' value='_cart' />";
                $ReturnString .= "<input type='hidden' name='upload' value='1' />";
                $ReturnString .= "<input type='hidden' name='business' value='" . $PayPal_Email_Address . "' />";
                $ReturnString .= "<input type='hidden' name='currency_code' value='" . $Pricing_Currency_Code . "' />";
                //$ReturnString .= "<input type='hidden' name='lc' value='CA' />"
                //$ReturnString .= "<input type='hidden' name='rm' value='2' />";
                $ReturnString .= "<input type='hidden' name='return' value='" . $Thank_You_URL . "' />";
                //$ReturnString .= "<input type='hidden' name='cancel_return' value='" . ' />
                $ReturnString .= "<input type='hidden' name='notify_url' value='" . get_site_url() . "' />";
                $ReturnString .= "<input type='submit' class='submit-button' value='Proceed to Payment' />";
                $ReturnString .= "</form>";
                $ReturnString .= "</div>";
            }
        } else {
            if ($Payment_Types == "Membership") {
                if ($discount_code != "") {
                    $Discount = EWD_FEUP_Calculate_Discount("Membership", $discount_code, $Payment_Frequency);
                } else {
                    $Discount['Amount'] = 0;
                }
                if ($Discount['Amount'] == 0) {
                    $Payment_Amount = $Membership_Cost;
                } elseif ($Discount['Amount'] != 0 and $Discount['Recurring'] != "Yes") {
                    $Trial = true;
                    $Payment_Amount_Trial = $Membership_Cost - $Discount['Amount'];
                    $Payment_Amount = $Membership_Cost;
                } else {
                    $Payment_Amount = $Membership_Cost - $Discount['Amount'];
                }
                if ($Payment_Frequency == "Yearly") {
                    $PP_Frequnecy = "Y";
                }
                if ($Payment_Frequency == "Monthly") {
                    $PP_Frequnecy = "M";
                }
                $ReturnString .= "<div class='ewd-feup-paypal-form'>";
                $ReturnString .= "<form action='https://www.paypal.com/cgi-bin/webscr' method='post' class='standard-form'>";
                //$ReturnString .= "<form action='https://www.sandbox.paypal.com/cgi-bin/webscr' method='post' class='standard-form'>";
                $ReturnString .= "<input type='hidden' name='item_name' value='" . substr(get_bloginfo('name'), 0, 100) . " " . $Payment_Frequency . " Membership' />";
                $ReturnString .= "<input type='hidden' name='a3' value='" . $Payment_Amount . "' />";
                $ReturnString .= "<input type='hidden' name='p3' value='1' />";
                $ReturnString .= "<input type='hidden' name='t3' value='" . $PP_Frequnecy . "' />";
                if ($Trial) {
                    $ReturnString .= "<input type='hidden' name='a1' value='" . $Payment_Amount_Trial . "' />";
                    $ReturnString .= "<input type='hidden' name='p1' value='1' />";
                    $ReturnString .= "<input type='hidden' name='t1' value='" . $PP_Frequnecy . "' />";
                }
                $ReturnString .= "<input type='hidden' name='src' value='1' />";
                $ReturnString .= "<input type='hidden' name='custom' value='User_ID=" . $User->User_ID . "&discount_code=" . $discount_code . "' />";
                $ReturnString .= "<input type='hidden' name='cmd' value='_xclick-subscriptions' />";
                $ReturnString .= "<input type='hidden' name='business' value='" . $PayPal_Email_Address . "' />";
                $ReturnString .= "<input type='hidden' name='currency_code' value='" . $Pricing_Currency_Code . "' />";
                //$ReturnString .= "<input type='hidden' name='lc' value='CA' />"
                //$ReturnString .= "<input type='hidden' name='rm' value='2' />";
                $ReturnString .= "<input type='hidden' name='return' value='" . $Thank_You_URL . "' />";
                //$ReturnString .= "<input type='hidden' name='cancel_return' value='" . ' />
                $ReturnString .= "<input type='hidden' name='notify_url' value='" . get_site_url() . "' />";
                $ReturnString .= "<input type='submit' class='submit-button' value='Proceed to Payment' />";
                $ReturnString .= "</form>";
                $ReturnString .= "</div>";
            } else {
                $Selected_Level = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$ewd_feup_levels_table_name} WHERE Level_ID=%d", $level));
                if ($discount_code != "") {
                    $Discount = EWD_FEUP_Calculate_Discount($level, $discount_code, $Payment_Frequency);
                } else {
                    $Discount['Amount'] = 0;
                }
                $Level_Cost = EWD_FEUP_Calculate_Level_Payment($level);
                if ($Discount['Amount'] == 0) {
                    $Payment_Amount = $Level_Cost;
                } elseif ($Discount['Amonut'] != 0 and $Discount['Recurring'] != "Yes") {
                    $Trial = true;
                    $Payment_Amount_Trial = $Level_Cost - $Discount['Amount'];
                    $Payment_Amount = $Level_Cost;
                } else {
                    $Payment_Amount = $Level_Cost - $Discount['Amount'];
                }
                if ($Payment_Frequency == "Yearly") {
                    $PP_Frequnecy = "Y";
                }
                if ($Payment_Frequency == "Monthly") {
                    $PP_Frequnecy = "M";
                }
                $ReturnString .= "<div class='ewd-feup-paypal-form'>";
                $ReturnString .= "<form action='https://www.paypal.com/cgi-bin/webscr' method='post' class='standard-form'>";
                //$ReturnString .= "<form action='https://www.sandbox.paypal.com/cgi-bin/webscr' method='post' class='standard-form'>";
                $ReturnString .= "<input type='hidden' name='item_name' value='" . substr(get_bloginfo('name'), 0, 100) . " " . $Payment_Frequency . " " . $Selected_Level->Level_Name . "' />";
                $ReturnString .= "<input type='hidden' name='a3' value='" . $Payment_Amount . "' />";
                $ReturnString .= "<input type='hidden' name='p3' value='1' />";
                $ReturnString .= "<input type='hidden' name='t3' value='" . $PP_Frequnecy . "' />";
                if ($Trial) {
                    $ReturnString .= "<input type='hidden' name='a1' value='" . $Payment_Amount_Trial . "' />";
                    $ReturnString .= "<input type='hidden' name='p3' value='1' />";
                    $ReturnString .= "<input type='hidden' name='t3' value='" . $PP_Frequnecy . "' />";
                }
                $ReturnString .= "<input type='hidden' name='src' value='1' />";
                $ReturnString .= "<input type='hidden' name='custom' value='User_ID=" . $User->User_ID . "&discount_code=" . $discount_code . "&level_id=" . $level . "&current_level_id=" . $User->Level_ID . "' />";
                $ReturnString .= "<input type='hidden' name='cmd' value='_xclick-subscriptions' />";
                $ReturnString .= "<input type='hidden' name='business' value='" . $PayPal_Email_Address . "' />";
                $ReturnString .= "<input type='hidden' name='currency_code' value='" . $Pricing_Currency_Code . "' />";
                //$ReturnString .= "<input type='hidden' name='lc' value='CA' />"
                //$ReturnString .= "<input type='hidden' name='rm' value='2' />";
                $ReturnString .= "<input type='hidden' name='return' value='" . $Thank_You_URL . "' />";
                //$ReturnString .= "<input type='hidden' name='cancel_return' value='" . ' />
                $ReturnString .= "<input type='hidden' name='notify_url' value='" . get_site_url() . "' />";
                $ReturnString .= "<input type='submit' class='submit-button' value='Proceed to Payment' />";
                $ReturnString .= "</form>";
                $ReturnString .= "</div>";
            }
        }
        if (sizeof($Discount_Codes_Array) > 0) {
            $ReturnString .= "<div class='ewd-feup-discount-div'>";
            $ReturnString .= $feup_Label_Discount_Message;
            $ReturnString .= "<div class='ewd-feup-discount-form'>";
            $ReturnString .= "<form action='#' method='post'>";
            $ReturnString .= "<input type='hidden' name='Payment_Required' value='Yes' />";
            if ($username != "") {
                $ReturnString .= "<input type='hidden' name='Username' value='" . $username . "' />";
            }
            if ($level != "") {
                $ReturnString .= "<input type='hidden' name='Username' value='" . $level . "' />";
            }
            $ReturnString .= "<div class='feup-pure-control-group'>";
            $ReturnString .= "<label for='Username' id='ewd-feup-paypal-discount-code-div' class='ewd-feup-field-label'>" . $feup_Label_Discount_Code . ": </label>";
            $ReturnString .= "<input type='text' class='ewd-feup-text-input ewd-feup-paypal-discount-code-input' name='discount_code'>";
            $ReturnString .= "</div>";
            $ReturnString .= "<div class='feup-pure-control-group'><label for='submit'></label><input type='submit' class='ewd-feup-submit feup-pure-button feup-pure-button-primary' name='Discount_Submit' value='" . $feup_Label_Use_Discount_Code . "'></div>";
            $ReturnString .= "</form>";
            $ReturnString .= "</div>";
        }
    }
    return $ReturnString;
}