diff --git a/functions.php b/functions.php index b596c9c..5fd1a67 100644 --- a/functions.php +++ b/functions.php @@ -81,5 +81,5 @@ add_action( 'manage_sites_custom_column', '\Aldine\Admin\catalog_column', 1, 3 ) // Remove unwanted menu pages. add_action( 'admin_menu', '\Aldine\Actions\remove_menu_items' ); -// Override signup page. +// Override signup page if enabled. add_action( 'init', '\Aldine\Actions\override_signup_page' ); diff --git a/inc/actions/namespace.php b/inc/actions/namespace.php index 3a174e3..d6bd96d 100644 --- a/inc/actions/namespace.php +++ b/inc/actions/namespace.php @@ -353,7 +353,7 @@ function remove_widgets() { function override_signup_page() { global $pagenow; if ( getenv( 'PB_CUSTOM_SIGNUP' ) && ! is_user_logged_in() && $pagenow === 'wp-signup.php' ) { - wp_redirect( network_home_url( '/register' ) ); + wp_redirect( network_home_url( '/auth' ) ); exit(); } } diff --git a/inc/activation/namespace.php b/inc/activation/namespace.php index 2bc6fac..3f1efcc 100644 --- a/inc/activation/namespace.php +++ b/inc/activation/namespace.php @@ -92,19 +92,12 @@ function create_default_content() { 'post_title' => __( 'Home', 'pressbooks-aldine' ), 'post_content' => $home_content, ], - 'register' => [ - 'post_title' => __( 'Register', 'pressbooks-aldine' ), + 'auth' => [ + 'post_title' => __( 'Auth', 'pressbooks-aldine' ), 'post_content' => '', ], ]; - if ( getenv( 'PB_CUSTOM_SIGNUP' ) ) { - $pages['register'] = [ - 'post_title' => __( 'Register', 'pressbooks-aldine' ), - 'post_content' => '', - ]; - } - // Add our pages. $pages = []; diff --git a/page-register.php b/page-auth.php similarity index 89% rename from page-register.php rename to page-auth.php index 7419400..ef77690 100644 --- a/page-register.php +++ b/page-auth.php @@ -2,7 +2,7 @@ /** * The template for displaying a custom signup page * - * Template Name: Register + * Template Name: Auth * * @link https://developer.wordpress.org/themes/basics/template-hierarchy/ * @@ -12,6 +12,25 @@ add_filter( 'wp_robots', 'wp_robots_no_robots' ); nocache_headers(); +$action = $_GET['action'] ?? 'register'; + +if( $action === 'register' ) { + $main_title = __( 'Create a new account', 'pressbooks-aldine' ); + $title = __( 'Sign up with your email and a password', 'pressbooks-aldine' ); + $url = home_url().'/register/action=register'; + $button_cta = __( 'Create Your Account', 'pressbooks-aldine' ); + $invite_cta = __( 'Already have an account?', 'pressbooks-aldine' ); + $invite_cta_link = home_url().'/auth/?action=login'; + $invite_cta_link_text = __( 'Log in', 'pressbooks-aldine' ); +} else { + $main_title = __( 'Welcome back!', 'pressbooks-aldine' ); + $title = __( 'Log in to your existing account', 'pressbooks-aldine' ); + $url = home_url().'/register/action=login'; + $button_cta = __( 'Login', 'pressbooks-aldine' ); + $invite_cta = __( 'Don\'t have an account?', 'pressbooks-aldine' ); + $invite_cta_link = home_url().'/auth/?action=register'; + $invite_cta_link_text = __( 'Register here', 'pressbooks-aldine' ); +} do_action( 'pb_custom_signup_form_handler' ) ?> @@ -79,27 +98,32 @@ do_action( 'pb_custom_signup_form_handler' )

today', 'pressbooks-aldine' ); ?>

-

+

- -
/register" method="post"> + +
- +
-

+ +

+
- +
+

+ - +

+
- +