function render_login_page($attributes, $content = null)
 {
     if (is_user_logged_in()) {
         $url = home_url('home');
         PR_Membership::pr_redirect($url);
     }
     // Pass the redirect parameter to the WordPress login functionality: by default,
     // don't specify a redirect, but if a valid redirect URL has been passed as
     // request parameter, use it.
     $attributes['redirect'] = '';
     if (isset($_REQUEST['redirect_to'])) {
         $attributes['redirect'] = wp_validate_redirect($_REQUEST['redirect_to'], $attributes['redirect']);
     }
     // Error messages
     $errors = array();
     if (isset($_REQUEST['login'])) {
         $error_codes = explode(',', $_REQUEST['login']);
         foreach ($error_codes as $code) {
             $errors[] = $this->get_error_message($code);
         }
     }
     $attributes['errors'] = $errors;
     // Check if user just logged out
     $attributes['logged_out'] = isset($_REQUEST['logged_out']) && $_REQUEST['logged_out'] == true;
     return Pr_Membership::get_html_template('login', $attributes);
 }
 function render_registration($attributes)
 {
     if (isset($_POST['register'])) {
         $this->username = $_POST['username'];
         $this->email = $_POST['email'];
         $this->password = $_POST['password'];
         $attributes = $this->signup();
     }
     if (!is_user_logged_in()) {
         // check to make sure user registration is enabled
         $registration_enabled = get_option('users_can_register');
         // only show the registration form if allowed
         if ($registration_enabled) {
             return Pr_Membership::get_html_template('register', $attributes);
         } else {
             echo 'Registration is disabled at the moment';
         }
     }
 }