Exemple #1
0
function ym_get_additional_registration_form_page($another_page_needed, $page = false)
{
    $html = '';
    if (!$page) {
        $page = ym_request('ym_page');
    }
    if ($page > 1) {
        $wp_error = new WP_Error();
        ym_register_post(ym_request('username'), '', $wp_error, $page);
        //error checking
        if ($wp_error->get_error_code()) {
            $errors = '';
            $messages = '';
            foreach ($wp_error->get_error_codes() as $code) {
                $severity = $wp_error->get_error_data($code);
                foreach ($wp_error->get_error_messages($code) as $error) {
                    if ('message' == $severity) {
                        $messages .= '	' . $error . "<br />\n";
                    } else {
                        $errors .= '	' . $error . "<br />\n";
                    }
                }
            }
            if (!empty($errors)) {
                $html .= '<div id="login_error">' . apply_filters('login_errors', $errors) . "</div>\n";
            }
            if (!empty($messages)) {
                $html .= '<p class="message">' . apply_filters('login_messages', $messages) . "</p>\n";
            }
            $another_page_needed = $page;
            $page--;
        }
    }
    $action = trailingslashit(get_option('siteurl')) . '?ym_subscribe=1&ym_page=' . $page . '&username=' . ym_get('username') . (ym_get('subs') ? '&subs=' . ym_get('subs') : '') . (ym_get('pack_id') ? '&pack_id=' . ym_get('pack_id') : '');
    $html .= '<form action="' . $action . '" method="post" enctype="multipart/form-data" name="registerform" id="registerform">
		<div style="clear: both;">';
    $html .= ym_register_form(true, $another_page_needed);
    $html .= '</div>
		<div class="ym_clear">&nbsp;</div>
		<p class="submit">';
    $previous_page = ym_get_previous_custom_field_page($another_page_needed);
    if ($previous_page > 1) {
        $html .= '<input class="button-primary" type="button" value="' . __('&laquo Previous', 'ym') . '" onclick="document.location=\'' . $action . '&another_page_needed=' . $previous_page . '\';" />';
    }
    $html .= '	<input class="button-primary" type="submit" name="submit" value="Next &raquo;" />
		</p>';
    $html .= '</form>';
    return $html;
}
         $user_id = ym_get_user_id_by_username($username);
     } else {
         if ($email = ym_get('email')) {
             $user_id = ym_get_user_id_by_email($email);
         }
     }
     $pack_id = ym_post('ym_subscription', FALSE);
     $html .= ym_upgrade_buttons(true, $pack_id, $user_id);
     $html .= $footer;
 } else {
     if (ym_request('username')) {
         $errors = false;
         $html = $header;
         if ($page > 1) {
             $wp_error = new WP_Error();
             ym_register_post(ym_request('username'), '', $wp_error, $page);
             //error checking
             if ($wp_error->get_error_code()) {
                 $errors = true;
                 $additional_page_needed = $page + 1;
                 $html .= ym_get_additional_registration_form_page($additional_page_needed, $page);
             }
         }
         if (!$errors) {
             $html .= ym_available_modules(ym_request('username'), true);
         }
         $html .= $footer;
     } else {
         if ($user_status == YM_STATUS_PENDING) {
             $html = $header . '<p>' . __('Error - Your subscription status is pending. Please contact an administrator for more information.', 'ym') . '</p>' . $footer;
         } else {