/** * Creates a user edit page. * * @since 2.7.6 * * @param string $wpmem_regchk * @param string $content * @return string $content */ function wpmem_page_user_edit($wpmem_regchk, $content) { global $wpmem_a, $wpmem_themsg; /** * Filter the default User Edit heading for shortcode. * * @since 2.7.6 * * @param string The default edit mode heading. */ $heading = apply_filters('wpmem_user_edit_heading', __('Edit Your Information', 'wp-members')); if ($wpmem_a == "update") { $content .= wpmem_inc_regmessage($wpmem_regchk, $wpmem_themsg); } $content = $content . wpmem_inc_registration('edit', $heading); 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 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; }
/** * Creates a user edit page * * @since 2.7.6 * * @param string $wpmem_regchk * @param string $content * @return string $content */ function wpmem_page_user_edit($wpmem_regchk, $content) { global $wpmem_a, $wpmem_themsg; $heading = apply_filters('wpmem_user_edit_heading', __('Edit Your Information', 'wp-members')); if ($wpmem_a == "update") { $content .= wpmem_inc_regmessage($wpmem_regchk, $wpmem_themsg); } $content = $content . wpmem_inc_registration('edit', $heading); return $content; }
/** * The Securify Content Filter. * * This is the primary function that picks up where get_action() leaves off. * Determines whether content is shown or hidden for both post and pages. * * @since 3.0 * * @global string $wpmem_themsg Contains messages to be output. * @global string $wpmem_captcha_err Contains error message for reCAPTCHA. * @global object $post The post object. * @param string $content * @return string $content */ function do_securify($content = null) { global $wpmem_themsg, $post; $content = is_single() || is_page() ? $content : wpmem_do_excerpt($content); if (!wpmem_test_shortcode($content, 'wp-members')) { if ($this->regchk == "captcha") { global $wpmem_captcha_err; $wpmem_themsg = __('There was an error with the CAPTCHA form.') . '<br /><br />' . $wpmem_captcha_err; } // Block/unblock Posts. if (!is_user_logged_in() && $this->is_blocked() == true) { include_once WPMEM_PATH . 'inc/dialogs.php'; //Show the login and registration forms. if ($this->regchk) { // Empty content in any of these scenarios. $content = ''; switch ($this->regchk) { case "loginfailed": $content = wpmem_inc_loginfailed(); break; case "success": $content = wpmem_inc_regmessage($this->regchk, $wpmem_themsg); $content = $content . wpmem_inc_login(); break; default: $content = wpmem_inc_regmessage($this->regchk, $wpmem_themsg); $content = $content . wpmem_inc_registration(); break; } } else { // Toggle shows excerpt above login/reg on posts/pages. global $wp_query; if (isset($wp_query->query_vars['page']) && $wp_query->query_vars['page'] > 1) { // Shuts down excerpts on multipage posts if not on first page. $content = ''; } elseif ($this->show_excerpt[$post->post_type] == 1) { if (!stristr($content, '<span id="more')) { $content = wpmem_do_excerpt($content); } else { $len = strpos($content, '<span id="more'); $content = substr($content, 0, $len); } } else { // Empty all content. $content = ''; } $content = $this->show_login[$post->post_type] == 1 ? $content . wpmem_inc_login() : $content . wpmem_inc_login('page', '', 'hide'); $content = $this->show_reg[$post->post_type] == 1 ? $content . wpmem_inc_registration() : $content; } // Protects comments if expiration module is used and user is expired. } elseif (is_user_logged_in() && $this->is_blocked() == true) { $content = $this->use_exp == 1 && function_exists('wpmem_do_expmessage') ? wpmem_do_expmessage($content) : $content; } } /** * Filter the value of $content after wpmem_securify has run. * * @since 2.7.7 * * @param string $content The content after securify has run. */ $content = apply_filters('wpmem_securify', $content); if (strstr($content, '[wpmem_txt]')) { // Fix the wptexturize. remove_filter('the_content', 'wpautop'); remove_filter('the_content', 'wptexturize'); add_filter('the_content', 'wpmem_texturize', 99); } 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; }