Merge branch 'master' of https://github.com/wpopal/opal-estate-pro
This commit is contained in:
commit
ff39207b86
@ -61,9 +61,9 @@ class Opalestate_Agency_Front {
|
|||||||
|
|
||||||
add_filter( 'opalestate_management_user_menu', [ $this, 'render_extra_profile_link' ] );
|
add_filter( 'opalestate_management_user_menu', [ $this, 'render_extra_profile_link' ] );
|
||||||
|
|
||||||
add_action( "opalestate_user_content_agency_profile_page", [ $this, 'render_profile' ] );
|
add_action( 'opalestate_user_content_agency_profile_page', [ $this, 'render_profile' ] );
|
||||||
add_action( "opalestate_user_content_agency_team_page", [ $this, 'render_team' ] );
|
add_action( 'opalestate_user_content_agency_team_page', [ $this, 'render_team' ] );
|
||||||
add_action( "opalestate_user_init", [ $this, 'process_action_member' ] );
|
add_action( 'opalestate_user_init', [ $this, 'process_action_member' ] );
|
||||||
|
|
||||||
$this->register_shortcodes();
|
$this->register_shortcodes();
|
||||||
}
|
}
|
||||||
@ -153,7 +153,6 @@ class Opalestate_Agency_Front {
|
|||||||
unset( $_POST[ $prefix . 'title' ] );
|
unset( $_POST[ $prefix . 'title' ] );
|
||||||
unset( $_POST[ $prefix . 'text' ] );
|
unset( $_POST[ $prefix . 'text' ] );
|
||||||
|
|
||||||
|
|
||||||
if ( $data['ID'] > 0 ) {
|
if ( $data['ID'] > 0 ) {
|
||||||
$post_id = wp_update_post( $data, true );
|
$post_id = wp_update_post( $data, true );
|
||||||
} else {
|
} else {
|
||||||
@ -309,8 +308,8 @@ class Opalestate_Agency_Front {
|
|||||||
*/
|
*/
|
||||||
public function register_shortcodes() {
|
public function register_shortcodes() {
|
||||||
$this->shortcodes = [
|
$this->shortcodes = [
|
||||||
'search_agencies' => [ 'code' => 'search_agencies', 'label' => esc_html__( 'Search Agencies', 'opalestate-pro' ) ],
|
'search_agencies' => [ 'code' => 'search_agencies', 'label' => esc_html__( 'Search Agencies', 'opalestate-pro' ) ],
|
||||||
'agency_carousel' => [ 'code' => 'agency_carousel', 'label' => esc_html__( 'Agency Carousel', 'opalestate-pro' ) ],
|
'agency_carousel' => [ 'code' => 'agency_carousel', 'label' => esc_html__( 'Agency Carousel', 'opalestate-pro' ) ],
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ( $this->shortcodes as $shortcode ) {
|
foreach ( $this->shortcodes as $shortcode ) {
|
||||||
@ -318,51 +317,59 @@ class Opalestate_Agency_Front {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function agency_carousel ( $atts ) {
|
public function agency_carousel( $atts ) {
|
||||||
|
|
||||||
$atts = is_array( $atts ) ? $atts : [];
|
$atts = is_array( $atts ) ? $atts : [];
|
||||||
|
|
||||||
$default = array(
|
$default = [
|
||||||
'current_uri' => null,
|
'current_uri' => null,
|
||||||
'column' => 3,
|
'column' => 3,
|
||||||
'limit' => 12,
|
'limit' => 12,
|
||||||
'paged' => 1,
|
'paged' => 1,
|
||||||
'onlyfeatured' => 0,
|
'onlyfeatured' => 0,
|
||||||
);
|
];
|
||||||
|
|
||||||
$atts = array_merge( $default, $atts );
|
$atts = array_merge( $default, $atts );
|
||||||
|
|
||||||
return opalestate_load_template_path( 'shortcodes/agency-carousel' , $atts );
|
return opalestate_load_template_path( 'shortcodes/agency-carousel', $atts );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function search_agencies ( $atts=[] ) {
|
public function search_agencies( $atts = [] ) {
|
||||||
|
|
||||||
$atts = is_array( $atts ) ? $atts : [];
|
$atts = is_array( $atts ) ? $atts : [];
|
||||||
$layout = 'search-agency-form';
|
$layout = 'search-agency-form';
|
||||||
|
|
||||||
$default = array(
|
$default = [
|
||||||
'current_uri' => null,
|
'current_uri' => null,
|
||||||
'form' => $layout
|
'form' => $layout,
|
||||||
);
|
];
|
||||||
|
|
||||||
$atts = array_merge( $default, $atts );
|
$atts = array_merge( $default, $atts );
|
||||||
|
|
||||||
return opalestate_load_template_path( 'shortcodes/search-agencies' , $atts );
|
return opalestate_load_template_path( 'shortcodes/search-agencies', $atts );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function render_profile() {
|
public function render_profile() {
|
||||||
|
$user_id = get_current_user_id();
|
||||||
$post_id = OpalEstate_User::get_member_id();
|
$post_id = OpalEstate_User::get_member_id();
|
||||||
|
|
||||||
if ( isset( $post->ID ) && $post->post_status != 'publish' ) {
|
// Check if have not any relationship, create a new then update this meta value.
|
||||||
opalestate_add_notice( "warning", esc_html__( 'You account is under reviewing! it take some time to process' ) );
|
if ( ! $post_id || $post_id < 0 ) {
|
||||||
add_action( "opalestate_profile_agency_form_before", "opalestate_print_notices" );
|
static::on_set_role( $user_id );
|
||||||
|
}
|
||||||
|
|
||||||
|
$post_id = get_user_meta( $user_id, OPALESTATE_USER_PROFILE_PREFIX . 'related_id', true );
|
||||||
|
$post = get_post( $post_id );
|
||||||
|
|
||||||
|
if ( isset( $post->ID ) && ( $post->post_status != 'publish' || $post->ID == get_the_ID() ) ) {
|
||||||
|
opalestate_add_notice( 'warning', esc_html__( 'You account is under reviewing! It take some time to process.', 'opalestate-pro' ) );
|
||||||
|
add_action( 'opalestate_profile_agency_form_before', 'opalestate_print_notices' );
|
||||||
}
|
}
|
||||||
|
|
||||||
$metaboxes = $this->render_front_form( [], $post_id );
|
$metaboxes = $this->render_front_form( [], $post_id );
|
||||||
@ -446,15 +453,12 @@ class Opalestate_Agency_Front {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function on_set_role( $user_id ) {
|
public static function on_set_role( $user_id ) {
|
||||||
|
|
||||||
if ( $user_id ) {
|
if ( $user_id ) {
|
||||||
|
|
||||||
$args = [
|
$args = [
|
||||||
'post_type' => 'opalestate_agency',
|
'post_type' => 'opalestate_agency',
|
||||||
'posts_per_page' => 10,
|
'posts_per_page' => 10,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
$args['meta_key'] = OPALESTATE_AGENCY_PREFIX . 'user_id';
|
$args['meta_key'] = OPALESTATE_AGENCY_PREFIX . 'user_id';
|
||||||
$args['meta_value'] = $user_id;
|
$args['meta_value'] = $user_id;
|
||||||
$args['meta_compare'] = '=';
|
$args['meta_compare'] = '=';
|
||||||
@ -477,6 +481,8 @@ class Opalestate_Agency_Front {
|
|||||||
public static function create_agency( $args = [], $user_id ) {
|
public static function create_agency( $args = [], $user_id ) {
|
||||||
$data = get_user_by( 'id', $user_id );
|
$data = get_user_by( 'id', $user_id );
|
||||||
|
|
||||||
|
$post_title = sprintf( esc_html__( 'User ID: %s', 'opalestate-pro' ), $user_id );
|
||||||
|
|
||||||
$args = wp_parse_args( $args, [
|
$args = wp_parse_args( $args, [
|
||||||
'first_name' => $data->first_name,
|
'first_name' => $data->first_name,
|
||||||
'last_name' => $data->last_name,
|
'last_name' => $data->last_name,
|
||||||
@ -495,9 +501,14 @@ class Opalestate_Agency_Front {
|
|||||||
'instagram' => '',
|
'instagram' => '',
|
||||||
] );
|
] );
|
||||||
|
|
||||||
|
if ( $args['first_name'] && $args['last_name'] ) {
|
||||||
|
$post_title = $args['first_name'] . ' ' . $args['last_name'];
|
||||||
|
} elseif ( isset( $data->display_name ) && $data->display_name ) {
|
||||||
|
$post_title = esc_html( $data->display_name );
|
||||||
|
}
|
||||||
|
|
||||||
$agency_id = wp_insert_post( [
|
$agency_id = wp_insert_post( [
|
||||||
'post_title' => $args['first_name'] && $args['last_name'] ? $args['first_name'] . ' ' . $args['last_name'] : esc_html__( 'User ID', 'opalestate-pro' ) . ': ' . $user_id,
|
'post_title' => $post_title,
|
||||||
'post_content' => 'empty description',
|
'post_content' => 'empty description',
|
||||||
'post_excerpt' => 'empty excerpt',
|
'post_excerpt' => 'empty excerpt',
|
||||||
'post_type' => 'opalestate_agency',
|
'post_type' => 'opalestate_agency',
|
||||||
|
@ -90,15 +90,20 @@ class Opalestate_Agent_Front {
|
|||||||
* render_profile
|
* render_profile
|
||||||
*/
|
*/
|
||||||
public function render_profile() {
|
public function render_profile() {
|
||||||
|
|
||||||
$user_id = get_current_user_id();
|
$user_id = get_current_user_id();
|
||||||
$post_id = get_user_meta( $user_id, OPALESTATE_USER_PROFILE_PREFIX . 'related_id', true );
|
$post_id = get_user_meta( $user_id, OPALESTATE_USER_PROFILE_PREFIX . 'related_id', true );
|
||||||
|
|
||||||
$post = get_post( $post_id );
|
// Check if have not any relationship, create a new then update this meta value.
|
||||||
|
if ( ! $post_id || $post_id < 0 ) {
|
||||||
|
$this->on_set_role( $user_id );
|
||||||
|
}
|
||||||
|
|
||||||
if ( isset( $post->ID ) && $post->post_status != 'publish' ) {
|
$post_id = get_user_meta( $user_id, OPALESTATE_USER_PROFILE_PREFIX . 'related_id', true );
|
||||||
opalestate_add_notice( "warning", esc_html__( 'You account is under reviewing! it take some time to process' ) );
|
$post = get_post( $post_id );
|
||||||
add_action( "opalestate_profile_agency_form_before", "opalestate_print_notices" );
|
|
||||||
|
if ( isset( $post->ID ) && ( $post->post_status != 'publish' || $post->ID == get_the_ID() ) ) {
|
||||||
|
opalestate_add_notice( 'warning', esc_html__( 'You account is under reviewing! It take some time to process.', 'opalestate-pro' ) );
|
||||||
|
add_action( 'opalestate_profile_agent_form_before', 'opalestate_print_notices' );
|
||||||
}
|
}
|
||||||
|
|
||||||
$metaboxes = $this->render_front_form( [], $post_id );
|
$metaboxes = $this->render_front_form( [], $post_id );
|
||||||
@ -316,23 +321,23 @@ class Opalestate_Agent_Front {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function agent_carousel ( $atts ) {
|
public function agent_carousel( $atts ) {
|
||||||
|
|
||||||
$atts = is_array( $atts ) ? $atts : [];
|
$atts = is_array( $atts ) ? $atts : [];
|
||||||
$layout = 'search-agency-form';
|
$layout = 'search-agency-form';
|
||||||
|
|
||||||
$default = array(
|
$default = [
|
||||||
'current_uri' => null,
|
'current_uri' => null,
|
||||||
'column' => 4,
|
'column' => 4,
|
||||||
'limit' => 12,
|
'limit' => 12,
|
||||||
'paged' => 1,
|
'paged' => 1,
|
||||||
'onlyfeatured' => 0,
|
'onlyfeatured' => 0,
|
||||||
'form' => $layout
|
'form' => $layout,
|
||||||
);
|
];
|
||||||
|
|
||||||
$atts = array_merge( $default, $atts );
|
$atts = array_merge( $default, $atts );
|
||||||
|
|
||||||
return opalestate_load_template_path( 'shortcodes/agent-carousel' , $atts );
|
return opalestate_load_template_path( 'shortcodes/agent-carousel', $atts );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function archives_query( $query ) {
|
public function archives_query( $query ) {
|
||||||
@ -461,7 +466,6 @@ class Opalestate_Agent_Front {
|
|||||||
'posts_per_page' => 10,
|
'posts_per_page' => 10,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
$args['meta_key'] = OPALESTATE_AGENT_PREFIX . 'user_id';
|
$args['meta_key'] = OPALESTATE_AGENT_PREFIX . 'user_id';
|
||||||
$args['meta_value'] = $user_id;
|
$args['meta_value'] = $user_id;
|
||||||
$args['meta_compare'] = '=';
|
$args['meta_compare'] = '=';
|
||||||
@ -478,9 +482,10 @@ class Opalestate_Agent_Front {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function create_agent( $args = [], $user_id ) {
|
public function create_agent( $args = [], $user_id ) {
|
||||||
|
|
||||||
$data = get_user_by( 'id', $user_id );
|
$data = get_user_by( 'id', $user_id );
|
||||||
|
|
||||||
|
$post_title = sprintf( esc_html__( 'User ID: %s', 'opalestate-pro' ), $user_id );
|
||||||
|
|
||||||
$args = wp_parse_args( $args, [
|
$args = wp_parse_args( $args, [
|
||||||
'first_name' => $data->first_name,
|
'first_name' => $data->first_name,
|
||||||
'last_name' => $data->last_name,
|
'last_name' => $data->last_name,
|
||||||
@ -500,8 +505,14 @@ class Opalestate_Agent_Front {
|
|||||||
'instagram' => '',
|
'instagram' => '',
|
||||||
] );
|
] );
|
||||||
|
|
||||||
|
if ( $args['first_name'] && $args['last_name'] ) {
|
||||||
|
$post_title = $args['first_name'] . ' ' . $args['last_name'];
|
||||||
|
} elseif ( isset( $data->display_name ) && $data->display_name ) {
|
||||||
|
$post_title = esc_html( $data->display_name );
|
||||||
|
}
|
||||||
|
|
||||||
$agent_id = wp_insert_post( [
|
$agent_id = wp_insert_post( [
|
||||||
'post_title' => $args['first_name'] && $args['last_name'] ? $args['first_name'] . ' ' . $args['last_name'] : esc_html__( 'User ID', 'opalestate-pro' ) . ': ' . $user_id,
|
'post_title' => $post_title,
|
||||||
'post_content' => '',
|
'post_content' => '',
|
||||||
'post_excerpt' => '',
|
'post_excerpt' => '',
|
||||||
'post_type' => 'opalestate_agent',
|
'post_type' => 'opalestate_agent',
|
||||||
@ -509,7 +520,6 @@ class Opalestate_Agent_Front {
|
|||||||
'post_author' => $user_id,
|
'post_author' => $user_id,
|
||||||
], true );
|
], true );
|
||||||
|
|
||||||
|
|
||||||
do_action( 'opalesate_insert_user_agent', $agent_id );
|
do_action( 'opalesate_insert_user_agent', $agent_id );
|
||||||
|
|
||||||
return $agent_id;
|
return $agent_id;
|
||||||
|
202
inc/api/v1/property.php
Executable file → Normal file
202
inc/api/v1/property.php
Executable file → Normal file
@ -1,118 +1,111 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* Define
|
|
||||||
* Note: only use for internal purpose.
|
|
||||||
*
|
|
||||||
* @package OpalJob
|
|
||||||
* @copyright Copyright (c) 2019, WpOpal <https://www.wpopal.com>
|
|
||||||
* @license https://opensource.org/licenses/gpl-license GNU Public License
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
// Exit if accessed directly.
|
// Exit if accessed directly.
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Job_Api
|
* Property_Api
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @package Opal_Job
|
* @package Property_Api
|
||||||
* @subpackage Opal_Job/controllers
|
|
||||||
*/
|
*/
|
||||||
class Property_Api extends Base_Api {
|
class Property_Api extends Base_Api {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The unique identifier of the route resource.
|
* The unique identifier of the route resource.
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @access public
|
* @access public
|
||||||
* @var string $base.
|
* @var string $base .
|
||||||
*/
|
*/
|
||||||
public $base = '/property';
|
public $base = '/property';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register Routes
|
* Register Routes
|
||||||
*
|
*
|
||||||
* Register all CURD actions with POST/GET/PUT and calling function for each
|
* Register all CURD actions with POST/GET/PUT and calling function for each
|
||||||
*
|
*
|
||||||
|
* @return avoid
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*
|
*
|
||||||
* @return avoid
|
|
||||||
*/
|
*/
|
||||||
public function register_routes ( ) {
|
public function register_routes() {
|
||||||
/// call http://domain.com/wp-json/job-api/v1/job/list ////
|
/// call http://domain.com/wp-json/estate-api/v1/estate/list ////
|
||||||
register_rest_route( $this->namespace, $this->base.'/list', array(
|
register_rest_route( $this->namespace, $this->base . '/list', [
|
||||||
'methods' => WP_REST_Server::READABLE,
|
'methods' => WP_REST_Server::READABLE,
|
||||||
'callback' => array( $this, 'get_list' ),
|
'callback' => [ $this, 'get_list' ],
|
||||||
'permission_callback' => array( $this, 'validate_request' ),
|
'permission_callback' => [ $this, 'validate_request' ],
|
||||||
));
|
] );
|
||||||
|
|
||||||
/// call http://domain.com/wp-json/job-api/v1/job/featured ////
|
/// call http://domain.com/wp-json/estate-api/v1/estate/featured ////
|
||||||
register_rest_route( $this->namespace, $this->base.'/featured', array(
|
register_rest_route( $this->namespace, $this->base . '/featured', [
|
||||||
'methods' => WP_REST_Server::READABLE,
|
'methods' => WP_REST_Server::READABLE,
|
||||||
'callback' => array( $this, 'get_featured_list' ),
|
'callback' => [ $this, 'get_featured_list' ],
|
||||||
'permission_callback' => array( $this, 'validate_request' ),
|
'permission_callback' => [ $this, 'validate_request' ],
|
||||||
));
|
] );
|
||||||
|
|
||||||
/// call http://domain.com/wp-json/job-api/v1/job/1 ////
|
/// call http://domain.com/wp-json/job-api/v1/job/1 ////
|
||||||
register_rest_route( $this->namespace, $this->base.'/(?P<id>\d+)', array(
|
register_rest_route( $this->namespace, $this->base . '/(?P<id>\d+)', [
|
||||||
'methods' => WP_REST_Server::READABLE,
|
'methods' => WP_REST_Server::READABLE,
|
||||||
'callback' => array( $this, 'get_job' ),
|
'callback' => [ $this, 'get_job' ],
|
||||||
'permission_callback' => array( $this, 'validate_request' ),
|
'permission_callback' => [ $this, 'validate_request' ],
|
||||||
));
|
] );
|
||||||
|
|
||||||
/// call http://domain.com/wp-json/job-api/v1/job/create ////
|
/// call http://domain.com/wp-json/job-api/v1/job/create ////
|
||||||
register_rest_route( $this->namespace, $this->base.'/create', array(
|
register_rest_route( $this->namespace, $this->base . '/create', [
|
||||||
'methods' => 'GET',
|
'methods' => 'GET',
|
||||||
'callback' => array( $this, 'create' ),
|
'callback' => [ $this, 'create' ],
|
||||||
'permission_callback' => array( $this, 'validate_request' ),
|
'permission_callback' => [ $this, 'validate_request' ],
|
||||||
));
|
] );
|
||||||
|
|
||||||
/// call http://domain.com/wp-json/job-api/v1/job/edit ////
|
/// call http://domain.com/wp-json/job-api/v1/job/edit ////
|
||||||
register_rest_route( $this->namespace, $this->base.'/edit', array(
|
register_rest_route( $this->namespace, $this->base . '/edit', [
|
||||||
'methods' => 'GET',
|
'methods' => 'GET',
|
||||||
'callback' => array( $this, 'edit' ),
|
'callback' => [ $this, 'edit' ],
|
||||||
));
|
] );
|
||||||
|
|
||||||
/// call http://domain.com/wp-json/job-api/v1/job/delete ////
|
/// call http://domain.com/wp-json/job-api/v1/job/delete ////
|
||||||
register_rest_route( $this->namespace, $this->base.'/delete', array(
|
register_rest_route( $this->namespace, $this->base . '/delete', [
|
||||||
'methods' => 'GET',
|
'methods' => 'GET',
|
||||||
'callback' => array( $this, 'delete' ),
|
'callback' => [ $this, 'delete' ],
|
||||||
'permission_callback' => array( $this, 'validate_request' ),
|
'permission_callback' => [ $this, 'validate_request' ],
|
||||||
));
|
] );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List job by tags and taxonmies
|
* List job by tags and taxonmies
|
||||||
*/
|
*/
|
||||||
/// call http://domain.com/wp-json/job-api/v1/jobs ////
|
/// call http://domain.com/wp-json/job-api/v1/jobs ////
|
||||||
register_rest_route( $this->namespace, $this->base.'/tags', array(
|
register_rest_route( $this->namespace, $this->base . '/tags', [
|
||||||
'methods' => 'GET',
|
'methods' => 'GET',
|
||||||
'callback' => array( $this, 'delete' ),
|
'callback' => [ $this, 'delete' ],
|
||||||
'permission_callback' => array( $this, 'validate_request' ),
|
'permission_callback' => [ $this, 'validate_request' ],
|
||||||
));
|
] );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_featured_list() {
|
public function get_featured_list() {
|
||||||
$properties = array();
|
$properties = [];
|
||||||
$error = array();
|
$error = [];
|
||||||
|
|
||||||
$property = null;
|
$property = null;
|
||||||
|
|
||||||
if ( $property == null ) {
|
if ( $property == null ) {
|
||||||
$properties = array();
|
$properties = [];
|
||||||
|
|
||||||
$property_list = get_posts( array(
|
$property_list = get_posts( [
|
||||||
'post_type' => 'opalestate_property',
|
'post_type' => 'opalestate_property',
|
||||||
'posts_per_page' => $this->per_page(),
|
'posts_per_page' => $this->per_page(),
|
||||||
'suppress_filters' => true,
|
'suppress_filters' => true,
|
||||||
'meta_key' => OPALESTATE_PROPERTY_PREFIX . 'featured',
|
'meta_key' => OPALESTATE_PROPERTY_PREFIX . 'featured',
|
||||||
'meta_value' => 'on',
|
'meta_value' => 'on',
|
||||||
'paged' => $this->get_paged()
|
'paged' => $this->get_paged(),
|
||||||
) );
|
] );
|
||||||
|
|
||||||
if ( $property_list ) {
|
if ( $property_list ) {
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ( $property_list as $property_info ) {
|
foreach ( $property_list as $property_info ) {
|
||||||
$properties[ $i ] = $this->get_property_data( $property_info );
|
$properties[ $i ] = $this->get_property_data( $property_info );
|
||||||
$i ++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -123,7 +116,7 @@ class Property_Api extends Base_Api {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
$error['error'] = sprintf(
|
$error['error'] = sprintf(
|
||||||
/* translators: %s: property */
|
/* translators: %s: property */
|
||||||
esc_html__( 'Form %s not found!', 'opalestate-pro' ),
|
esc_html__( 'Form %s not found!', 'opalestate-pro' ),
|
||||||
$property
|
$property
|
||||||
);
|
);
|
||||||
@ -132,44 +125,44 @@ class Property_Api extends Base_Api {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$response['collection'] = $properties;
|
$response['collection'] = $properties;
|
||||||
$response['pages'] = 4;
|
$response['pages'] = 4;
|
||||||
$response['current'] = 1;
|
$response['current'] = 1;
|
||||||
|
|
||||||
return $this->get_response( 200, $response );
|
return $this->get_response( 200, $response );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get List Of Job
|
* Get List Of Job
|
||||||
*
|
*
|
||||||
* Based on request to get collection
|
* Based on request to get collection
|
||||||
*
|
*
|
||||||
|
* @return WP_REST_Response is json data
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*
|
*
|
||||||
* @return WP_REST_Response is json data
|
|
||||||
*/
|
*/
|
||||||
public function get_list ( $request ) {
|
public function get_list( $request ) {
|
||||||
|
|
||||||
$properties = array();
|
$properties = [];
|
||||||
$error = array();
|
$error = [];
|
||||||
|
|
||||||
$property = null;
|
$property = null;
|
||||||
|
|
||||||
if ( $property == null ) {
|
if ( $property == null ) {
|
||||||
$properties = array();
|
$properties = [];
|
||||||
|
|
||||||
$property_list = get_posts( array(
|
$property_list = get_posts( [
|
||||||
'post_type' => 'opalestate_property',
|
'post_type' => 'opalestate_property',
|
||||||
'posts_per_page' => $this->per_page(),
|
'posts_per_page' => $this->per_page(),
|
||||||
'suppress_filters' => true,
|
'suppress_filters' => true,
|
||||||
'paged' => $this->get_paged()
|
'paged' => $this->get_paged(),
|
||||||
) );
|
] );
|
||||||
|
|
||||||
if ( $property_list ) {
|
if ( $property_list ) {
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ( $property_list as $property_info ) {
|
foreach ( $property_list as $property_info ) {
|
||||||
$properties[ $i ] = $this->get_property_data( $property_info );
|
$properties[ $i ] = $this->get_property_data( $property_info );
|
||||||
$i ++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -180,7 +173,7 @@ class Property_Api extends Base_Api {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
$error['error'] = sprintf(
|
$error['error'] = sprintf(
|
||||||
/* translators: %s: property */
|
/* translators: %s: property */
|
||||||
esc_html__( 'Form %s not found!', 'opalestate-pro' ),
|
esc_html__( 'Form %s not found!', 'opalestate-pro' ),
|
||||||
$property
|
$property
|
||||||
);
|
);
|
||||||
@ -189,9 +182,10 @@ class Property_Api extends Base_Api {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$response['collection'] = $properties;
|
$response['collection'] = $properties;
|
||||||
$response['pages'] = 4;
|
$response['pages'] = 4;
|
||||||
$response['current'] = 1;
|
$response['current'] = 1;
|
||||||
|
|
||||||
return $this->get_response( 200, $response );
|
return $this->get_response( 200, $response );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,15 +193,15 @@ class Property_Api extends Base_Api {
|
|||||||
/**
|
/**
|
||||||
* Opalestaten a opalestate_property post object, generate the data for the API output
|
* Opalestaten a opalestate_property post object, generate the data for the API output
|
||||||
*
|
*
|
||||||
* @since 1.1
|
* @param object $property_info The Download Post Object
|
||||||
*
|
|
||||||
* @param object $property_info The Download Post Object
|
|
||||||
*
|
*
|
||||||
* @return array Array of post data to return back in the API
|
* @return array Array of post data to return back in the API
|
||||||
|
* @since 1.1
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
private function get_property_data( $property_info ) {
|
private function get_property_data( $property_info ) {
|
||||||
|
|
||||||
$property = array();
|
$property = [];
|
||||||
|
|
||||||
$property['info']['id'] = $property_info->ID;
|
$property['info']['id'] = $property_info->ID;
|
||||||
$property['info']['slug'] = $property_info->post_name;
|
$property['info']['slug'] = $property_info->post_name;
|
||||||
@ -219,24 +213,24 @@ class Property_Api extends Base_Api {
|
|||||||
$property['info']['content'] = $property_info->post_content;
|
$property['info']['content'] = $property_info->post_content;
|
||||||
$property['info']['thumbnail'] = wp_get_attachment_url( get_post_thumbnail_id( $property_info->ID ) );
|
$property['info']['thumbnail'] = wp_get_attachment_url( get_post_thumbnail_id( $property_info->ID ) );
|
||||||
|
|
||||||
$data = opalesetate_property( $property_info->ID );
|
$data = opalesetate_property( $property_info->ID );
|
||||||
$gallery = $data->get_gallery();
|
$gallery = $data->get_gallery();
|
||||||
$property['info']['gallery'] = isset($gallery[0]) && !empty($gallery[0]) ? $gallery[0]: array();
|
$property['info']['gallery'] = isset( $gallery[0] ) && ! empty( $gallery[0] ) ? $gallery[0] : [];
|
||||||
$property['info']['price'] = opalestate_price_format( $data->get_price() );
|
$property['info']['price'] = opalestate_price_format( $data->get_price() );
|
||||||
$property['info']['map'] = $data->get_map();
|
$property['info']['map'] = $data->get_map();
|
||||||
$property['info']['address'] = $data->get_address();
|
$property['info']['address'] = $data->get_address();
|
||||||
$property['meta'] = $data->get_meta_shortinfo();
|
$property['meta'] = $data->get_meta_shortinfo();
|
||||||
|
$property['is_featured'] = $data->is_featured();
|
||||||
|
$property['status'] = $data->get_status();
|
||||||
|
$property['labels'] = $data->get_labels();
|
||||||
|
$property['locations'] = $data->get_locations();
|
||||||
|
$property['amenities'] = $data->get_amenities();
|
||||||
|
$property['types'] = $data->get_types_tax();
|
||||||
|
$property['author_type'] = $data->get_author_type();
|
||||||
|
$property['author_data'] = $data->get_author_link();
|
||||||
|
|
||||||
|
|
||||||
$property['is_featured'] = $data->is_featured();
|
|
||||||
$property['status'] = $data->get_status();
|
|
||||||
$property['labels'] = $data->get_labels();
|
|
||||||
$property['locations'] = $data->get_locations();
|
|
||||||
$property['amenities'] = $data->get_amenities();
|
|
||||||
$property['types'] = $data->get_types_tax();
|
|
||||||
|
|
||||||
return apply_filters( 'opalestate_api_properties_property', $property );
|
return apply_filters( 'opalestate_api_properties_property', $property );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -244,24 +238,24 @@ class Property_Api extends Base_Api {
|
|||||||
*
|
*
|
||||||
* Based on request to get collection
|
* Based on request to get collection
|
||||||
*
|
*
|
||||||
|
* @return WP_REST_Response is json data
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*
|
*
|
||||||
* @return WP_REST_Response is json data
|
|
||||||
*/
|
*/
|
||||||
public function delete( ) {
|
public function delete() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function reviews () {
|
public function reviews() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function categories () {
|
public function categories() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tags () {
|
public function tags() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -454,7 +454,7 @@ class Opalestate_Property {
|
|||||||
return '<a href="' . $data['link'] . '" aria-label="' . $data['name'] . '" class="author-link"><span aria-label="' . $data['name'] . '" class="author-avatar hint--top">' . $avatar . '</span><span class="author-name">' . $data['name'] . '</span></a>';
|
return '<a href="' . $data['link'] . '" aria-label="' . $data['name'] . '" class="author-link"><span aria-label="' . $data['name'] . '" class="author-avatar hint--top">' . $avatar . '</span><span class="author-name">' . $data['name'] . '</span></a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
private function get_author_link() {
|
public function get_author_link() {
|
||||||
|
|
||||||
$image_id = get_user_meta( get_the_author_meta( 'ID' ), OPALESTATE_USER_PROFILE_PREFIX . 'avatar_id', true );
|
$image_id = get_user_meta( get_the_author_meta( 'ID' ), OPALESTATE_USER_PROFILE_PREFIX . 'avatar_id', true );
|
||||||
$related_id = get_user_meta( get_the_author_meta( 'ID' ), OPALESTATE_USER_PROFILE_PREFIX . 'related_id', true );
|
$related_id = get_user_meta( get_the_author_meta( 'ID' ), OPALESTATE_USER_PROFILE_PREFIX . 'related_id', true );
|
||||||
|
@ -186,8 +186,8 @@ class Opalestate_User_Form_Handler {
|
|||||||
if ( $password !== $password1 ) {
|
if ( $password !== $password1 ) {
|
||||||
throw new Exception( '<strong>' . esc_html__( 'ERROR', 'opalestate-pro' ) . ':</strong> ' . esc_html__( 'Re-Password is not match.', 'opalestate-pro' ) );
|
throw new Exception( '<strong>' . esc_html__( 'ERROR', 'opalestate-pro' ) . ':</strong> ' . esc_html__( 'Re-Password is not match.', 'opalestate-pro' ) );
|
||||||
}
|
}
|
||||||
$credentials['user_pass'] = $password;
|
|
||||||
|
|
||||||
|
$credentials['user_pass'] = $password;
|
||||||
|
|
||||||
/* create new user */
|
/* create new user */
|
||||||
$user_id = opalestate_create_user( $credentials );
|
$user_id = opalestate_create_user( $credentials );
|
||||||
@ -195,8 +195,7 @@ class Opalestate_User_Form_Handler {
|
|||||||
if ( is_wp_error( $user_id ) ) {
|
if ( is_wp_error( $user_id ) ) {
|
||||||
throw new Exception( '<strong>' . esc_html__( 'ERROR', 'opalestate-pro' ) . ':</strong> ' . $user_id->get_error_message() );
|
throw new Exception( '<strong>' . esc_html__( 'ERROR', 'opalestate-pro' ) . ':</strong> ' . $user_id->get_error_message() );
|
||||||
} else {
|
} else {
|
||||||
|
/* After register successfully */
|
||||||
/* after register successfully */
|
|
||||||
do_action( 'opalestate_after_register_successfully', $user_id );
|
do_action( 'opalestate_after_register_successfully', $user_id );
|
||||||
|
|
||||||
$redirect = home_url();
|
$redirect = home_url();
|
||||||
@ -213,7 +212,7 @@ class Opalestate_User_Form_Handler {
|
|||||||
|
|
||||||
$redirect = apply_filters( 'opalestate_register_redirect_url', $redirect );
|
$redirect = apply_filters( 'opalestate_register_redirect_url', $redirect );
|
||||||
|
|
||||||
/* is ajax request */
|
/* Is ajax request */
|
||||||
if ( opalestate_is_ajax_request() ) {
|
if ( opalestate_is_ajax_request() ) {
|
||||||
wp_send_json( [ 'status' => true, 'redirect' => $redirect ] );
|
wp_send_json( [ 'status' => true, 'redirect' => $redirect ] );
|
||||||
} else {
|
} else {
|
||||||
|
@ -185,20 +185,24 @@ class OpalEstate_User {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* On Register user.
|
||||||
*
|
*
|
||||||
|
* @param int $user_id User ID
|
||||||
*/
|
*/
|
||||||
public function on_regiser_user( $user_id ) {
|
public function on_regiser_user( $user_id ) {
|
||||||
if ( isset( $_POST['role'] ) ) {
|
if ( isset( $_POST['role'] ) ) {
|
||||||
$roles = opalestate_user_roles_by_user_id( $user_id );
|
|
||||||
|
|
||||||
// Fetch the WP_User object of our user.
|
// Fetch the WP_User object of our user.
|
||||||
$u = new WP_User( $user_id );
|
$u = new WP_User( $user_id );
|
||||||
$u->remove_role( 'subscriber' );
|
$u->remove_role( 'subscriber' );
|
||||||
|
|
||||||
// Replace the current role with 'editor' role
|
// Replace the current role with 'editor' role
|
||||||
$u->set_role( sanitize_text_field( $_POST['role'] ) );
|
$u->set_role( sanitize_text_field( $_POST['role'] ) );
|
||||||
|
|
||||||
|
$roles = opalestate_user_roles_by_user_id( $user_id );
|
||||||
|
|
||||||
if ( $roles && in_array( $_POST['role'], $roles ) ) {
|
if ( $roles && in_array( $_POST['role'], $roles ) ) {
|
||||||
$role = str_replace( 'opalestate_', '', sanitize_text_field( $_POST['role'] ) );
|
$role = str_replace( 'opalestate_', '', sanitize_text_field( $_POST['role'] ) );
|
||||||
|
|
||||||
do_action( 'opalestate_on_set_role_' . $role, $user_id );
|
do_action( 'opalestate_on_set_role_' . $role, $user_id );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ $property = opalesetate_property( get_the_ID() );
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<p class="property-description">
|
<p class="property-description">
|
||||||
<?php echo opalestate_fnc_excerpt( 14, '...' ); ?>
|
<?php echo opalestate_fnc_excerpt( 38, '...' ); ?>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div><!-- .entry-content -->
|
</div><!-- .entry-content -->
|
||||||
|
@ -50,7 +50,8 @@ switch ( $type ) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<div class="opalestate-box-content property-agent-section">
|
|
||||||
|
<div class="opalestate-box-content property-agent-section property-author-v2">
|
||||||
<div class="opalestate-box">
|
<div class="opalestate-box">
|
||||||
<div class="author-content-box">
|
<div class="author-content-box">
|
||||||
<div class="property-agent-info">
|
<div class="property-agent-info">
|
||||||
@ -59,5 +60,3 @@ switch ( $type ) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ switch ( $type ) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<div class="opalestate-box-content property-agent-section">
|
<div class="opalestate-box-content property-agent-section property-author-v3">
|
||||||
<div class="opalestate-box">
|
<div class="opalestate-box">
|
||||||
<?php if ( opalestate_get_option( 'enable_single_author_box' , 'on' ) == 'on' ) : ?>
|
<?php if ( opalestate_get_option( 'enable_single_author_box' , 'on' ) == 'on' ) : ?>
|
||||||
<div class="author-content-box">
|
<div class="author-content-box">
|
||||||
|
@ -44,7 +44,7 @@ switch ( $type ) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<div class="opalestate-box-content property-agent-section">
|
<div class="opalestate-box-content property-agent-section property-author-v1">
|
||||||
<div class="opalestate-box">
|
<div class="opalestate-box">
|
||||||
<div class="author-content-box">
|
<div class="author-content-box">
|
||||||
<div class="opal-row">
|
<div class="opal-row">
|
||||||
|
@ -6,10 +6,8 @@
|
|||||||
$prefix = OPALESTATE_USER_PROFILE_PREFIX;
|
$prefix = OPALESTATE_USER_PROFILE_PREFIX;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_id = $author->ID;
|
$user_id = $author->ID;
|
||||||
$is_sticky = get_user_meta( $user_id, $prefix . 'sticky', true );
|
$is_sticky = get_user_meta( $user_id, $prefix . 'sticky', true );
|
||||||
|
|
||||||
|
|
||||||
$desciption = get_user_meta( $user_id, 'description', true );
|
$desciption = get_user_meta( $user_id, 'description', true );
|
||||||
|
|
||||||
$roles = opalestate_user_roles_by_user_id( $user_id );
|
$roles = opalestate_user_roles_by_user_id( $user_id );
|
||||||
@ -75,7 +73,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div><!-- /.agent-preview -->
|
</div><!-- /.agent-preview -->
|
||||||
|
|
||||||
|
|
||||||
<div class="agent-box-meta">
|
<div class="agent-box-meta">
|
||||||
<h4 class="agent-box-title">
|
<h4 class="agent-box-title">
|
||||||
<a href="<?php echo esc_url( $link ); ?>"><?php echo esc_html( $author_name ); ?></a>
|
<a href="<?php echo esc_url( $link ); ?>"><?php echo esc_html( $author_name ); ?></a>
|
||||||
@ -143,11 +140,8 @@
|
|||||||
<?php if ( $linkedIn && $linkedIn != "#" && ! empty( $linkedIn ) ) { ?>
|
<?php if ( $linkedIn && $linkedIn != "#" && ! empty( $linkedIn ) ) { ?>
|
||||||
<a class="opalestate-social-white radius-x" href="<?php echo esc_url( $linkedIn ); ?>"> <i class="fab fa-linkedIn"></i></a>
|
<a class="opalestate-social-white radius-x" href="<?php echo esc_url( $linkedIn ); ?>"> <i class="fab fa-linkedIn"></i></a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div><!-- /.agent-box-content -->
|
</div><!-- /.agent-box-content -->
|
||||||
|
|
||||||
</div><!-- /.agent-box-->
|
</div><!-- /.agent-box-->
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
@ -1,40 +1,39 @@
|
|||||||
|
|
||||||
<div class="property-submission-form">
|
<div class="property-submission-form">
|
||||||
|
|
||||||
<?php if ( ! empty( $_SESSION['messages'] ) ) : ?>
|
<?php if ( ! empty( $_SESSION['messages'] ) ) : ?>
|
||||||
|
|
||||||
<div class="opalesate_messages">
|
<div class="opalesate_messages">
|
||||||
<?php foreach ( $_SESSION['messages'] as $message ) : ?>
|
<?php foreach ( $_SESSION['messages'] as $message ) : ?>
|
||||||
|
|
||||||
<?php $status = isset( $message[0] ) ? $message[0] : 'success'; ?>
|
<?php $status = isset( $message[0] ) ? $message[0] : 'success'; ?>
|
||||||
<?php $msg = isset( $message[1] ) ? $message[1] : ''; ?>
|
<?php $msg = isset( $message[1] ) ? $message[1] : ''; ?>
|
||||||
<div class="opalesate_message_line <?php echo esc_attr( $status ) ?>">
|
<div class="opalesate_message_line <?php echo esc_attr( $status ) ?>">
|
||||||
<?php printf( '%s', $msg ) ?>
|
<?php printf( '%s', $msg ) ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php endforeach; unset( $_SESSION['messages'] ); ?>
|
<?php endforeach;
|
||||||
</div>
|
unset( $_SESSION['messages'] ); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<div class="opalestate-admin-box">
|
<div class="opalestate-admin-box">
|
||||||
|
|
||||||
<div class="box-content">
|
<div class="box-content">
|
||||||
<h3><?php esc_html_e( 'Edit Agency Profile', 'opalestate-pro' ); ?></h3>
|
<h3><?php esc_html_e( 'Edit Agency Profile', 'opalestate-pro' ); ?></h3>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
do_action( 'opalestate_profile_agency_form_before' );
|
do_action( 'opalestate_profile_agency_form_before' );
|
||||||
// echo '<Pre>'.print_r( $metaboxes ,1 );die;
|
|
||||||
|
|
||||||
if ( function_exists( 'cmb2_get_metabox_form' ) ) {
|
if ( function_exists( 'cmb2_get_metabox_form' ) ) {
|
||||||
echo cmb2_get_metabox_form( $metaboxes[OPALESTATE_AGENCY_PREFIX.'front'], $post_id, array(
|
echo cmb2_get_metabox_form( $metaboxes[ OPALESTATE_AGENCY_PREFIX . 'front' ], $post_id, [
|
||||||
'form_format' => '<form action="//' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . '" class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="object_id" value="%2$s">%3$s<button type="submit" name="submit-cmb" class="button-primary btn btn-primary">%4$s</button></form>',
|
'form_format' => '<form action="//' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . '" class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="object_id" value="%2$s">%3$s<button type="submit" name="submit-cmb" class="button-primary btn btn-primary">%4$s</button></form>',
|
||||||
'save_button' => esc_html__( 'Save Change', 'opalestate-pro' ),
|
'save_button' => esc_html__( 'Save Change', 'opalestate-pro' ),
|
||||||
) );
|
] );
|
||||||
}
|
}
|
||||||
|
|
||||||
do_action( 'opalestate_profile_agency_form_after' );
|
do_action( 'opalestate_profile_agency_form_after' );
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,27 +1,26 @@
|
|||||||
|
|
||||||
<div class="property-submission-form">
|
<div class="property-submission-form">
|
||||||
|
|
||||||
<div class="opalestate-admin-box">
|
<div class="opalestate-admin-box">
|
||||||
|
|
||||||
<div class="box-content">
|
<div class="box-content">
|
||||||
<h3><?php esc_html_e( 'Edit Agent Profile', 'opalestate-pro' ); ?></h3>
|
<h3><?php esc_html_e( 'Edit Agent Profile', 'opalestate-pro' ); ?></h3>
|
||||||
|
|
||||||
<?php if( isset($metaboxes[OPALESTATE_AGENT_PREFIX.'front']) ): ?>
|
<?php if ( isset( $metaboxes[ OPALESTATE_AGENT_PREFIX . 'front' ] ) ): ?>
|
||||||
<?php
|
<?php
|
||||||
do_action( 'opalestate_profile_agency_form_before' );
|
do_action( 'opalestate_profile_agent_form_before' );
|
||||||
|
|
||||||
if ( function_exists( 'cmb2_get_metabox_form' ) ) {
|
if ( function_exists( 'cmb2_get_metabox_form' ) ) {
|
||||||
echo cmb2_get_metabox_form( $metaboxes[ OPALESTATE_AGENT_PREFIX . 'front' ], $post_id, [
|
echo cmb2_get_metabox_form( $metaboxes[ OPALESTATE_AGENT_PREFIX . 'front' ], $post_id, [
|
||||||
'form_format' => '<form action="//' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . '" class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="object_id" value="%2$s">%3$s<button type="submit" name="submit-cmb" class="button-primary btn btn-primary">%4$s</button></form>',
|
'form_format' => '<form action="//' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . '" class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="object_id" value="%2$s">%3$s<button type="submit" name="submit-cmb" class="button-primary btn btn-primary">%4$s</button></form>',
|
||||||
'save_button' => esc_html__( 'Save Change', 'opalestate-pro' ),
|
'save_button' => esc_html__( 'Save Change', 'opalestate-pro' ),
|
||||||
] );
|
] );
|
||||||
}
|
}
|
||||||
|
|
||||||
do_action( 'opalestate_profile_agency_form_after' );
|
do_action( 'opalestate_profile_agency_form_after' );
|
||||||
?>
|
?>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<div class="alert alert-danger"><?php esc_html_e( 'Agent edit profile form is not avariable', 'opalestate-pro' ); ?></div>
|
<div class="alert alert-danger"><?php esc_html_e( 'Agent edit profile form is not avariable', 'opalestate-pro' ); ?></div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user