Add Pages settings.

This commit is contained in:
Hoang Huu 2020-01-06 09:37:47 +07:00
parent 1c49a5b1d3
commit bb42be1a8c
8 changed files with 272 additions and 134 deletions

View File

@ -86,6 +86,7 @@ class Opalestate_Admin {
'settings/searcharea.php',
'settings/general.php',
'settings/property.php',
'settings/pages.php',
] );
// Get it started

View File

@ -117,8 +117,10 @@ class Opalestate_Plugin_Settings {
$tabs = [];
$tabs['general'] = esc_html__( 'General', 'opalestate-pro' );
$tabs['property'] = esc_html__( 'Property', 'opalestate-pro' );
$tabs['pages'] = esc_html__( 'Pages', 'opalestate-pro' );
$tabs['3rd_party'] = esc_html__( '3rd Party', 'opalestate-pro' );
$tabs['api_keys'] = esc_html__( 'API', 'opalestate-pro' );
if ( ! empty( $settings['addons']['fields'] ) ) {
$tabs['addons'] = esc_html__( 'Add-ons', 'opalestate-pro' );
@ -128,9 +130,6 @@ class Opalestate_Plugin_Settings {
$tabs['licenses'] = esc_html__( 'Licenses', 'opalestate-pro' );
}
$tabs['api_keys'] = esc_html__( 'API', 'opalestate-pro' );
$tabs['3rd_party'] = esc_html__( '3rd Party', 'opalestate-pro' );
return apply_filters( 'opalestate_settings_tabs', $tabs );
}

View File

@ -32,11 +32,6 @@ class Opalestate_Settings_General_Tab extends Opalestate_Settings_Base_Tab {
}
public function get_tab_fields( $key = '' ) {
$pages = opalestate_cmb2_get_post_options( [
'post_type' => 'page',
'numberposts' => -1,
] );
return apply_filters( 'opalestate_settings_general', [
[
'name' => esc_html__( 'General Settings', 'opalestate-pro' ),
@ -46,44 +41,6 @@ class Opalestate_Settings_General_Tab extends Opalestate_Settings_Base_Tab {
'before_row' => '<hr>',
'after_row' => '<hr>',
],
[
'name' => esc_html__( 'User Management Page', 'opalestate-pro' ),
'desc' => esc_html__( 'This is page use User Management Page using for show content of management page such as profile, my properties', 'opalestate-pro' ),
'id' => 'user_management_page',
'type' => 'select',
'options' => $pages,
],
[
'name' => esc_html__( 'Dashboard Logo', 'opalestate-pro' ),
'desc' => esc_html__( 'Upload a logo for user dashboard page.', 'opalestate-pro' ),
'id' => 'dashboard_logo',
'type' => 'file',
'preview_size' => [ 100, 100 ],
'options' => [
'url' => false,
],
'query_args' => [
'type' => [
'image/gif',
'image/jpeg',
'image/png',
],
],
],
[
'name' => esc_html__( 'My Account Page', 'opalestate-pro' ),
'desc' => esc_html__( 'This is page used for login and register an account, or reset password.', 'opalestate-pro' ),
'id' => 'user_myaccount_page',
'type' => 'select',
'options' => $pages,
],
[
'name' => esc_html__( 'Terms and Conditions Page', 'opalestate-pro' ),
'desc' => esc_html__( 'This is page used for terms and conditions.', 'opalestate-pro' ),
'id' => 'user_terms_page',
'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' ),
@ -104,19 +61,6 @@ class Opalestate_Settings_General_Tab extends Opalestate_Settings_Base_Tab {
'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',
'opalestate-pro' ),
'id' => 'message_log',
'type' => 'switch',
'options' => [
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
],
],
[
'name' => esc_html__( 'Maximum Upload Image Size', 'opalestate-pro' ),
'desc' => esc_html__( 'Set maximum volumn size having < x MB', 'opalestate-pro' ),

View File

@ -0,0 +1,176 @@
<?php
/**
* $Desc$
*
* @version $Id$
* @package opalestate
* @author Opal Team <info@wpopal.com >
* @copyright Copyright (C) 2019 wpopal.com. All Rights Reserved.
* @license GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
*
* @website http://www.wpopal.com
* @support http://www.wpopal.com/support/forum.html
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Opalestate_Settings_Pages_Tab extends Opalestate_Settings_Base_Tab {
public function get_tabnav() {
}
public function get_tab_content( $key = '' ) {
return [
'id' => 'options_page',
'opalestate_title' => esc_html__( 'Pages', 'opalestate-pro' ),
'show_on' => [ 'key' => 'options-page', 'value' => [ $key, ], ],
'fields' => $this->get_tab_fields(),
];
}
public function get_tab_fields( $key = '' ) {
$pages = opalestate_cmb2_get_post_options( [
'post_type' => 'page',
'numberposts' => -1,
] );
return apply_filters( 'opalestate_settings_pages', [
[
'name' => esc_html__( 'Pages Settings', 'opalestate-pro' ),
'type' => 'opalestate_title',
'id' => 'opalestate_title_pages_settings',
'before_row' => '<hr>',
'after_row' => '<hr>',
],
[
'name' => esc_html__( 'User Management Page', 'opalestate-pro' ),
'desc' => esc_html__( 'This is page use User Management Page using for show content of management page such as profile, my properties', 'opalestate-pro' ),
'id' => 'user_management_page',
'type' => 'select',
'options' => $pages,
],
[
'name' => esc_html__( 'Dashboard Logo', 'opalestate-pro' ),
'desc' => esc_html__( 'Upload a logo for user dashboard page.', 'opalestate-pro' ),
'id' => 'dashboard_logo',
'type' => 'file',
'preview_size' => [ 100, 100 ],
'options' => [
'url' => false,
],
'query_args' => [
'type' => [
'image/gif',
'image/jpeg',
'image/png',
],
],
],
[
'name' => esc_html__( 'My Account Page', 'opalestate-pro' ),
'desc' => esc_html__( 'This is page used for login and register an account, or reset password.', 'opalestate-pro' ),
'id' => 'user_myaccount_page',
'type' => 'select',
'options' => $pages,
],
[
'name' => esc_html__( 'Terms and Conditions Page', 'opalestate-pro' ),
'desc' => esc_html__( 'This is page used for terms and conditions.', 'opalestate-pro' ),
'id' => 'user_terms_page',
'type' => 'select',
'options' => $pages,
],
[
'name' => esc_html__( 'Dashboard Settings', 'opalestate-pro' ),
'type' => 'opalestate_title',
'id' => 'opalestate_title_pages_dashboard',
'desc' => esc_html__( 'Settings for User Management Dashboard.', 'opalestate-pro' ),
'before_row' => '<hr>',
'after_row' => '<hr>',
],
[
'name' => esc_html__( 'Show Profile', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Profile menu page.', 'opalestate-pro' ),
'id' => 'enable_dashboard_profile',
'type' => 'switch',
'options' => [
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
],
'default' => 'on',
],
[
'name' => esc_html__( 'Show Favorite', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Favorite menu page.', 'opalestate-pro' ),
'id' => 'enable_dashboard_favorite',
'type' => 'switch',
'options' => [
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
],
'default' => 'on',
],
[
'name' => esc_html__( 'Show Reviews', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Reviews menu page.', 'opalestate-pro' ),
'id' => 'enable_dashboard_reviews',
'type' => 'switch',
'options' => [
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
],
'default' => 'on',
],
[
'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',
'opalestate-pro' ),
'id' => 'message_log',
'type' => 'switch',
'options' => [
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
],
],
[
'name' => esc_html__( 'Show Submission', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Submission menu page.', 'opalestate-pro' ),
'id' => 'enable_dashboard_submission',
'type' => 'switch',
'options' => [
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
],
'default' => 'on',
],
[
'name' => esc_html__( 'Show Properties', 'opalestate-pro' ),
'desc' => esc_html__( 'Show My Properties menu page.', 'opalestate-pro' ),
'id' => 'enable_dashboard_properties',
'type' => 'switch',
'options' => [
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
],
'default' => 'on',
],
[
'name' => esc_html__( 'Show Saved Search', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Saved Search menu page.', 'opalestate-pro' ),
'id' => 'enable_dashboard_savedsearch',
'type' => 'switch',
'options' => [
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
],
'default' => 'on',
],
]
);
}
}

View File

@ -188,12 +188,14 @@ class OpalEstate_User_Search {
*
*/
public function dashboard_menu( $menu ) {
if ( 'on' === opalestate_get_option( 'enable_dashboard_savedsearch', 'on' ) ) {
$menu['savedsearch'] = [
'icon' => 'fa fa-search',
'link' => 'saved_search',
'title' => esc_html__( 'Saved Search', 'opalestate-pro' ),
'id' => 0,
];
}
return $menu;
}

View File

@ -69,10 +69,10 @@ function opalestate_get_user_tab_uri( $tab ) {
function opalestate_management_show_content_page_tab() {
$tab = isset( $_GET['tab'] ) && $_GET['tab'] ? sanitize_text_field( $_GET['tab'] ) : 'dashboard';
$fnc = 'opalestate_user_content_' . $tab . '_page';
$tab_hook = $tab;
$tab_hook = apply_filters( 'opalestate_user_content_tab_hook', $tab_hook, $tab );
$fnc = 'opalestate_user_content_' . $tab_hook . '_page';
$content = apply_filters( $fnc, '' );
@ -144,64 +144,7 @@ function opalestate_management_user_menu() {
function opalestate_management_user_menu_tabs() {
global $opalestate_options;
$menu = [];
$menu['dashboard'] = [
'icon' => 'fas fa-chart-line',
'link' => 'dashboard',
'title' => esc_html__( 'Dashboard', 'opalestate-pro' ),
'id' => isset( $opalestate_options['profile_page'] ) ? $opalestate_options['profile_page'] : 0,
];
$menu['profile'] = [
'icon' => 'far fa-user',
'link' => 'profile',
'title' => esc_html__( 'Personal Information', 'opalestate-pro' ),
'id' => isset( $opalestate_options['profile_page'] ) ? $opalestate_options['profile_page'] : 0,
];
$menu['favorite'] = [
'icon' => 'far fa-heart',
'link' => 'favorite',
'title' => esc_html__( 'Favorite', 'opalestate-pro' ),
'id' => isset( $opalestate_options['favorite_page'] ) ? $opalestate_options['favorite_page'] : 0,
];
$menu['reviews'] = [
'icon' => 'far fa-star',
'link' => 'reviews',
'title' => esc_html__( 'Reviews', 'opalestate-pro' ),
'id' => isset( $opalestate_options['reviews_page'] ) ? $opalestate_options['reviews_page'] : 0,
];
if ( opalestate_get_option( 'message_log' ) ) {
$menu['messages'] = [
'icon' => 'fa fa-envelope',
'link' => 'messages',
'title' => esc_html__( 'Messages', 'opalestate-pro' ),
'id' => isset( $opalestate_options['reviews_page'] ) ? $opalestate_options['reviews_page'] : 0,
];
}
$menu['submission'] = [
'icon' => 'fa fa-upload',
'link' => 'submission',
'title' => esc_html__( 'Submit Property', 'opalestate-pro' ),
'id' => isset( $opalestate_options['submission_page'] ) ? $opalestate_options['submission_page'] : 0,
];
$statistics = new OpalEstate_User_Statistics();
$menu['myproperties'] = [
'icon' => 'fas fa-building',
'link' => 'submission_list',
'title' => esc_html__( 'My Properties', 'opalestate-pro' ) . '<span class="count">' . $statistics->get_count_properties() . '</span>',
'id' => isset( $opalestate_options['submission_list_page'] ) ? $opalestate_options['submission_list_page'] : 0,
];
$menu = apply_filters( 'opalestate_management_user_menu', $menu );
$menu = opalestate_get_user_dashboard_menus();
$output = '<ul class="account-links nav-pills nav-stacked">';
@ -228,6 +171,76 @@ function opalestate_management_user_menu_tabs() {
echo $output;
}
function opalestate_get_user_dashboard_menus() {
global $opalestate_options;
$menu = [];
$menu['dashboard'] = [
'icon' => 'fas fa-chart-line',
'link' => 'dashboard',
'title' => esc_html__( 'Dashboard', 'opalestate-pro' ),
'id' => isset( $opalestate_options['profile_page'] ) ? $opalestate_options['profile_page'] : 0,
];
if ( 'on' === opalestate_get_option( 'enable_dashboard_profile', 'on' ) ) {
$menu['profile'] = [
'icon' => 'far fa-user',
'link' => 'profile',
'title' => esc_html__( 'Personal Information', 'opalestate-pro' ),
'id' => isset( $opalestate_options['profile_page'] ) ? $opalestate_options['profile_page'] : 0,
];
}
if ( 'on' === opalestate_get_option( 'enable_dashboard_favorite', 'on' ) ) {
$menu['favorite'] = [
'icon' => 'far fa-heart',
'link' => 'favorite',
'title' => esc_html__( 'Favorite', 'opalestate-pro' ),
'id' => isset( $opalestate_options['favorite_page'] ) ? $opalestate_options['favorite_page'] : 0,
];
}
if ( 'on' === opalestate_get_option( 'enable_dashboard_reviews', 'on' ) ) {
$menu['reviews'] = [
'icon' => 'far fa-star',
'link' => 'reviews',
'title' => esc_html__( 'Reviews', 'opalestate-pro' ),
'id' => isset( $opalestate_options['reviews_page'] ) ? $opalestate_options['reviews_page'] : 0,
];
}
if ( 'on' === opalestate_get_option( 'message_log', 'on' ) ) {
$menu['messages'] = [
'icon' => 'fa fa-envelope',
'link' => 'messages',
'title' => esc_html__( 'Messages', 'opalestate-pro' ),
'id' => isset( $opalestate_options['reviews_page'] ) ? $opalestate_options['reviews_page'] : 0,
];
}
if ( 'on' === opalestate_get_option( 'enable_dashboard_submission', 'on' ) ) {
$menu['submission'] = [
'icon' => 'fa fa-upload',
'link' => 'submission',
'title' => esc_html__( 'Submit Property', 'opalestate-pro' ),
'id' => isset( $opalestate_options['submission_page'] ) ? $opalestate_options['submission_page'] : 0,
];
}
if ( 'on' === opalestate_get_option( 'enable_dashboard_properties', 'on' ) ) {
$statistics = new OpalEstate_User_Statistics();
$menu['myproperties'] = [
'icon' => 'fas fa-building',
'link' => 'submission_list',
'title' => esc_html__( 'My Properties', 'opalestate-pro' ) . '<span class="count">' . $statistics->get_count_properties() . '</span>',
'id' => isset( $opalestate_options['submission_list_page'] ) ? $opalestate_options['submission_list_page'] : 0,
];
}
return apply_filters( 'opalestate_management_user_menu', $menu );
}
function opalestate_user_content_dashboard_page() {
echo opalestate_load_template_path( 'user/dashboard' );
}

View File

@ -3,7 +3,7 @@
* 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.7
* Version: 1.2.8
* Author: WPOPAL
* Author URI: http://www.wpopal.com
* Requires at least: 4.9
@ -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&#8217; huh?', 'opalestate-pro' ), '1.2.7' );
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'opalestate-pro' ), '1.2.8' );
}
/**
@ -160,7 +160,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
public function setup_constants() {
// Plugin version
if ( ! defined( 'OPALESTATE_VERSION' ) ) {
define( 'OPALESTATE_VERSION', '1.2.7' );
define( 'OPALESTATE_VERSION', '1.2.8' );
}
// Plugin Folder Path

View File

@ -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.8 - 2020-01-06 =
* Added - Pages settings.
= 1.2.7 - 2020-01-02 =
* Added - Redirect to User Dashboard page after login/register setting.