/** * Builds the shortcode pages (login, register, user-profile, user-edit, password) * * Some of the logic here is similar to the wpmem_securify() function. But whereas that function handles general * content, this function handles building specific pages generated by shortcodes. * * @since 2.6 * * @param string $page * @global string $wpmem_regchk * @global string $wpmem_themsg * @global string $wpmem_a * @return string $content */ function wpmem_do_sc_pages($page) { global $wpmem_regchk, $wpmem_themsg, $wpmem_a; include_once WPMEM_PATH . 'wp-members-dialogs.php'; $content = ''; // deprecating members-area parameter to be replaced by user-profile $page = $page == 'user-profile' ? 'members-area' : $page; if ($page == 'members-area' || $page == 'register') { if ($wpmem_regchk == "captcha") { global $wpmem_captcha_err; $wpmem_themsg = __('There was an error with the CAPTCHA form.') . '<br /><br />' . $wpmem_captcha_err; } if ($wpmem_regchk == "loginfailed") { return wpmem_inc_loginfailed(); } if (!is_user_logged_in()) { if ($wpmem_a == 'register') { switch ($wpmem_regchk) { case "success": $content = wpmem_inc_regmessage($wpmem_regchk, $wpmem_themsg); $content = $content . wpmem_inc_login(); break; default: $content = wpmem_inc_regmessage($wpmem_regchk, $wpmem_themsg); $content = $content . wpmem_inc_registration(); break; } } elseif ($wpmem_a == 'pwdreset') { $content = wpmem_page_pwd_reset($wpmem_regchk, $content); } else { $content = $page == 'members-area' ? $content . wpmem_inc_login('members') : $content; $content = $page == 'register' || WPMEM_NO_REG != 1 ? $content . wpmem_inc_registration() : $content; } } elseif (is_user_logged_in() && $page == 'members-area') { /** * Filter the default heading in User Profile edit mode. * * @since 2.7.5 * * @param string The default edit mode heading. */ $heading = apply_filters('wpmem_user_edit_heading', __('Edit Your Information', 'wp-members')); switch ($wpmem_a) { case "edit": $content = $content . wpmem_inc_registration('edit', $heading); break; case "update": // determine if there are any errors/empty fields if ($wpmem_regchk == "updaterr" || $wpmem_regchk == "email") { $content = $content . wpmem_inc_regmessage($wpmem_regchk, $wpmem_themsg); $content = $content . wpmem_inc_registration('edit', $heading); } else { //case "editsuccess": $content = $content . wpmem_inc_regmessage($wpmem_regchk, $wpmem_themsg); $content = $content . wpmem_inc_memberlinks(); } break; case "pwdchange": $content = wpmem_page_pwd_reset($wpmem_regchk, $content); break; case "renew": $content = wpmem_renew(); break; default: $content = wpmem_inc_memberlinks(); break; } } elseif (is_user_logged_in() && $page == 'register') { //return wpmem_inc_memberlinks( 'register' ); $content = $content . wpmem_inc_memberlinks('register'); } } if ($page == 'login') { $content = $wpmem_regchk == "loginfailed" ? wpmem_inc_loginfailed() : $content; $content = !is_user_logged_in() ? $content . wpmem_inc_login('login') : wpmem_inc_memberlinks('login'); } if ($page == 'password') { $content = wpmem_page_pwd_reset($wpmem_regchk, $content); } if ($page == 'user-edit') { $content = wpmem_page_user_edit($wpmem_regchk, $content); } return $content; }
/** * Builds the shortcode pages (login, register, user-profile, user-edit, password). * * Some of the logic here is similar to the wpmem_securify() function. * But where that function handles general content, this function * handles building specific pages generated by shortcodes. * * @since 2.6.0 * * @global object $wpmem The WP_Members object. * @global string $wpmem_themsg The WP-Members message container. * @global object $post The WordPress post object. * * @param string $page * @param string $redirect_to * @param string $tag * @return string $content */ function wpmem_do_sc_pages($atts, $content, $tag) { $page = isset($atts['page']) ? $atts['page'] : $tag; $redirect_to = isset($atts['redirect_to']) ? $atts['redirect_to'] : null; $hide_register = isset($atts['register']) && 'hide' == $atts['register'] ? true : false; global $wpmem, $wpmem_themsg, $post; include_once WPMEM_PATH . 'inc/dialogs.php'; $content = ''; // Deprecating members-area parameter to be replaced by user-profile. $page = $page == 'user-profile' ? 'members-area' : $page; if ($page == 'members-area' || $page == 'register') { if ($wpmem->regchk == "captcha") { global $wpmem_captcha_err; $wpmem_themsg = __('There was an error with the CAPTCHA form.') . '<br /><br />' . $wpmem_captcha_err; } if ($wpmem->regchk == "loginfailed") { return wpmem_inc_loginfailed(); } if (!is_user_logged_in()) { if ($wpmem->action == 'register' && !$hide_register) { switch ($wpmem->regchk) { case "success": $content = wpmem_inc_regmessage($wpmem->regchk, $wpmem_themsg); $content = $content . wpmem_inc_login(); break; default: $content = wpmem_inc_regmessage($wpmem->regchk, $wpmem_themsg); $content = $content . wpmem_inc_registration(); break; } } elseif ($wpmem->action == 'pwdreset') { $content = wpmem_page_pwd_reset($wpmem->regchk, $content); } elseif ($wpmem->action == 'getusername') { $content = wpmem_page_forgot_username($wpmem->regchk, $content); } else { $content = $page == 'members-area' ? $content . wpmem_inc_login('members') : $content; $content = ($page == 'register' || $wpmem->show_reg[$post->post_type] != 0) && !$hide_register ? $content . wpmem_inc_registration() : $content; } } elseif (is_user_logged_in() && $page == 'members-area') { /** * Filter the default heading in User Profile edit mode. * * @since 2.7.5 * * @param string The default edit mode heading. */ $heading = apply_filters('wpmem_user_edit_heading', __('Edit Your Information', 'wp-members')); switch ($wpmem->action) { case "edit": $content = $content . wpmem_inc_registration('edit', $heading); break; case "update": // Determine if there are any errors/empty fields. if ($wpmem->regchk == "updaterr" || $wpmem->regchk == "email") { $content = $content . wpmem_inc_regmessage($wpmem->regchk, $wpmem_themsg); $content = $content . wpmem_inc_registration('edit', $heading); } else { //Case "editsuccess". $content = $content . wpmem_inc_regmessage($wpmem->regchk, $wpmem_themsg); $content = $content . wpmem_inc_memberlinks(); } break; case "pwdchange": $content = wpmem_page_pwd_reset($wpmem->regchk, $content); break; case "renew": $content = wpmem_renew(); break; default: $content = wpmem_inc_memberlinks(); break; } } elseif (is_user_logged_in() && $page == 'register') { $content = $content . wpmem_inc_memberlinks('register'); } } if ($page == 'login') { $content = $wpmem->regchk == "loginfailed" ? wpmem_inc_loginfailed() : $content; $content = !is_user_logged_in() ? $content . wpmem_inc_login('login', $redirect_to) : wpmem_inc_memberlinks('login'); } if ($page == 'password') { $content = wpmem_page_pwd_reset($wpmem->regchk, $content); } if ($page == 'user-edit') { $content = wpmem_page_user_edit($wpmem->regchk, $content); } return $content; }