From 1c49a5b1d3281fcbfb0142fcef0ece7e14fa3754 Mon Sep 17 00:00:00 2001 From: Hoang Huu Date: Thu, 2 Jan 2020 08:47:07 +0700 Subject: [PATCH] Add redirect page after login/register --- inc/admin/settings/general.php | 28 ++++++++++++++++--- .../class-opalestate-user-form-handler.php | 18 ++++++++++++ languages/opalestate-pro.pot | 4 +-- opal-estate-pro.php | 10 +++---- readme.txt | 9 ++++-- 5 files changed, 55 insertions(+), 14 deletions(-) diff --git a/inc/admin/settings/general.php b/inc/admin/settings/general.php index 53db6070..52f68380 100755 --- a/inc/admin/settings/general.php +++ b/inc/admin/settings/general.php @@ -84,6 +84,26 @@ class Opalestate_Settings_General_Tab extends Opalestate_Settings_Base_Tab { 'type' => 'select', 'options' => $pages, ], + [ + 'name' => esc_html__( 'Login and Redirect to Dashboard page', 'opalestate-pro' ), + 'desc' => esc_html__( 'Redirect to User Management Dashboard page after login.', 'opalestate-pro' ), + 'id' => 'enable_login_redirect_to_dashboard', + 'type' => 'switch', + 'options' => [ + 'on' => esc_html__( 'Enable', 'opalestate-pro' ), + 'off' => esc_html__( 'Disable', 'opalestate-pro' ), + ], + ], + [ + 'name' => esc_html__( 'Register and Redirect to Dashboard page', 'opalestate-pro' ), + 'desc' => esc_html__( 'Redirect to User Management Dashboard page after register.', 'opalestate-pro' ), + 'id' => 'enable_register_redirect_to_dashboard', + 'type' => 'switch', + 'options' => [ + 'on' => esc_html__( 'Enable', 'opalestate-pro' ), + 'off' => esc_html__( 'Disable', 'opalestate-pro' ), + ], + ], [ 'name' => esc_html__( 'Enable Message Database', 'opalestate-pro' ), 'desc' => esc_html__( 'Allow User send message Contact/Equire via email and saved into database to exchange theirs message direct in User Message Management', @@ -99,7 +119,7 @@ class Opalestate_Settings_General_Tab extends Opalestate_Settings_Base_Tab { [ 'name' => esc_html__( 'Maximum Upload Image Size', 'opalestate-pro' ), - 'desc' => esc_html__( 'Set maximun volumn size having < x MB', 'opalestate-pro' ), + 'desc' => esc_html__( 'Set maximum volumn size having < x MB', 'opalestate-pro' ), 'id' => 'upload_image_max_size', 'type' => 'text', @@ -107,7 +127,7 @@ class Opalestate_Settings_General_Tab extends Opalestate_Settings_Base_Tab { ], [ 'name' => esc_html__( 'Maximum Upload Image Files', 'opalestate-pro' ), - 'desc' => esc_html__( 'Set maximun volumn size having < x MB', 'opalestate-pro' ), + 'desc' => esc_html__( 'Set maximum volumn size having < x MB', 'opalestate-pro' ), 'id' => 'upload_image_max_files', 'type' => 'text', @@ -115,7 +135,7 @@ class Opalestate_Settings_General_Tab extends Opalestate_Settings_Base_Tab { ], [ 'name' => esc_html__( 'Maximum Upload Other Size', 'opalestate-pro' ), - 'desc' => esc_html__( 'Set maximun volumn size having < x MB for upload docx, pdf...', 'opalestate-pro' ), + 'desc' => esc_html__( 'Set maximum volumn size having < x MB for upload docx, pdf...', 'opalestate-pro' ), 'id' => 'upload_other_max_size', 'type' => 'text', @@ -123,7 +143,7 @@ class Opalestate_Settings_General_Tab extends Opalestate_Settings_Base_Tab { ], [ 'name' => esc_html__( 'Maximum Upload Other Files', 'opalestate-pro' ), - 'desc' => esc_html__( 'Set maximun volumn size having < x MB for upload docx, pdf...', 'opalestate-pro' ), + 'desc' => esc_html__( 'Set maximum volumn size having < x MB for upload docx, pdf...', 'opalestate-pro' ), 'id' => 'upload_other_max_files', 'type' => 'text', diff --git a/inc/user/class-opalestate-user-form-handler.php b/inc/user/class-opalestate-user-form-handler.php index 166380f0..1257161a 100755 --- a/inc/user/class-opalestate-user-form-handler.php +++ b/inc/user/class-opalestate-user-form-handler.php @@ -18,6 +18,8 @@ class Opalestate_User_Form_Handler { add_action( 'wp_ajax_opalestate_login_form', [ $this, 'process_login' ] ); add_action( 'wp_ajax_opalestate_register_form', [ $this, 'process_register' ] ); + add_filter( 'opalestate_signon_redirect_url', [ $this, 'login_redirect_url' ] ); + add_filter( 'opalestate_register_redirect_url', [ $this, 'register_redirect_url' ] ); } /** @@ -322,6 +324,22 @@ class Opalestate_User_Form_Handler { } die(); } + + public function login_redirect_url( $redirect ) { + if ( 'on' === opalestate_get_option( 'enable_login_redirect_to_dashboard', 'off' ) ) { + $redirect = opalestate_get_user_management_page_uri(); + } + + return $redirect; + } + + public function register_redirect_url( $redirect ) { + if ( 'on' === opalestate_get_option( 'enable_register_redirect_to_dashboard', 'off' ) ) { + $redirect = opalestate_get_user_management_page_uri(); + } + + return $redirect; + } } new Opalestate_User_Form_Handler(); diff --git a/languages/opalestate-pro.pot b/languages/opalestate-pro.pot index 4b44dd33..37df2690 100755 --- a/languages/opalestate-pro.pot +++ b/languages/opalestate-pro.pot @@ -5943,7 +5943,7 @@ msgid "Maximum Upload Image Size" msgstr "" #: inc/admin/settings/general.php:102 inc/admin/settings/general.php:110 -msgid "Set maximun volumn size having < x MB" +msgid "Set maximum volumn size having < x MB" msgstr "" #: inc/admin/settings/general.php:109 @@ -5955,7 +5955,7 @@ msgid "Maximum Upload Other Size" msgstr "" #: inc/admin/settings/general.php:118 inc/admin/settings/general.php:126 -msgid "Set maximun volumn size having < x MB for upload docx, pdf..." +msgid "Set maximum volumn size having < x MB for upload docx, pdf..." msgstr "" #: inc/admin/settings/general.php:125 diff --git a/opal-estate-pro.php b/opal-estate-pro.php index dd7e0e4e..54e96d48 100755 --- a/opal-estate-pro.php +++ b/opal-estate-pro.php @@ -3,11 +3,11 @@ * Plugin Name: Opal Estate Pro * Plugin URI: https://wpdocs.gitbook.io/opal-estate/ * Description: Opal Real Estate Plugin is an ideal solution and brilliant choice for you to set up a professional estate website. - * Version: 1.2.6 + * Version: 1.2.7 * Author: WPOPAL * Author URI: http://www.wpopal.com - * Requires at least: 4.6 - * Tested up to: 5.3 + * Requires at least: 4.9 + * Tested up to: 5.3.2 * Text Domain: opalestate-pro * Domain Path: languages/ * @@ -151,7 +151,7 @@ if ( ! class_exists( 'OpalEstate' ) ) { */ public function __clone() { // Cloning instances of the class is forbidden - _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'opalestate-pro' ), '1.2.6' ); + _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'opalestate-pro' ), '1.2.7' ); } /** @@ -160,7 +160,7 @@ if ( ! class_exists( 'OpalEstate' ) ) { public function setup_constants() { // Plugin version if ( ! defined( 'OPALESTATE_VERSION' ) ) { - define( 'OPALESTATE_VERSION', '1.2.6' ); + define( 'OPALESTATE_VERSION', '1.2.7' ); } // Plugin Folder Path diff --git a/readme.txt b/readme.txt index b29a7c75..cfca9c5f 100755 --- a/readme.txt +++ b/readme.txt @@ -2,9 +2,9 @@ Contributors: wpopal Donate link: https://wpdocs.gitbook.io/opal-estate/ Tags: estate, property, opalestate, house for rent, agency for lease, estate submission, agents estate property, property marketplace -Requires at least: 4.6 -Tested up to: 5.3 -Stable tag: 1.2.6 +Requires at least: 4.9 +Tested up to: 5.3.2 +Stable tag: 1.2.7 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -156,6 +156,9 @@ This section describes how to install the plugin and get it working. * System tickets support 24/7 available : [free support](https://wpopal.ticksy.com/ "Visit the Plugin support Page") == Changelog == += 1.2.7 - 2020-01-02 = +* Added - Redirect to User Dashboard page after login/register setting. + = 1.2.6 - 2019-12-30 = * Fixes - Compatible WordPress version.