From 47d8bb81831ce0b4c95d51f65eb545447b58131b Mon Sep 17 00:00:00 2001 From: Laury GvR Date: Mon, 5 Mar 2018 17:56:23 -0500 Subject: [PATCH] If not logged in, show login page content It was so that when one is on the members only page, the content of that page would show in addition to the login form. This was requested to be changed so that the members only login page text is separate from the members only page text. Code has also been added to try handling redirection; currently when someone logs in on the front-end, the Contacts plugin forces them to be redirected to the members only page, even if a different url is supplied to the form. If that can be disabled, this code would make it so one is only navigated to the Members Only page if attempting to log in from the Members Only Login page, and otherwise stay on their current page. --- functions.php | 2 ++ index.php | 25 ++++++++----------- .../glm-members-only-login-form.php | 11 +++++++- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/functions.php b/functions.php index 00cd560..6bb336b 100644 --- a/functions.php +++ b/functions.php @@ -11,6 +11,8 @@ require get_template_directory() . '/inc/navigation.php'; DEFINE("BLOCKS_FRONT_TOP_GROUP",69302); DEFINE("BLOCKS_FOOTER_AREA_GROUP",69304); +DEFINE("MEMBERS_ONLY_PAGE_ID",get_option("glm_members_database_option_members_only_id")); +DEFINE("MEMBERS_ONLY_LOGIN_PAGE_ID",69625); if ( ! function_exists( 'wmta_setup' ) ) : /** diff --git a/index.php b/index.php index 35d4a78..9f1957d 100644 --- a/index.php +++ b/index.php @@ -67,21 +67,18 @@ get_header(); ?>

- + +
- " . get_member_name() . "
"; - } ?> - - - -

- + + - - - + + @@ -89,8 +86,8 @@ get_header(); ?> - -
',get_the_title('34'),''; ?>
+ +
',get_the_title('34'),''; ?>
diff --git a/template-parts/glm-members-only-login-form.php b/template-parts/glm-members-only-login-form.php index a24e152..933845e 100644 --- a/template-parts/glm-members-only-login-form.php +++ b/template-parts/glm-members-only-login-form.php @@ -32,9 +32,18 @@
ID === MEMBERS_ONLY_LOGIN_PAGE_ID) { + $redirect_target = MEMBERS_ONLY_PAGE_ID; + } else { + $redirect_target = ""; + } + $args = array( 'echo' => false, - 'form_id' => 'glm_login_form' + 'form_id' => 'glm_login_form', + 'redirect'=> $redirect_target ); $loginForm = wp_login_form($args); $captcha = apply_filters('cptch_display', '', 'glm_login_form'); -- 2.17.1