Update dashboard.
This commit is contained in:
@@ -132,7 +132,7 @@ class Opalestate_Admin_Agency {
|
||||
|
||||
$tabs_setting['tabs'][] = array(
|
||||
'id' => 'p-socials',
|
||||
'icon' => 'dashicons-admin-home',
|
||||
'icon' => 'dashicons-share',
|
||||
'title' => esc_html__( 'Socials', 'opalestate-pro' ),
|
||||
'fields' => $metabox->get_social_fields( $prefix )
|
||||
);
|
||||
|
||||
@@ -84,7 +84,7 @@ class Opalestate_Admin_Agent {
|
||||
|
||||
$tabs_setting['tabs'][] = [
|
||||
'id' => 'p-socials',
|
||||
'icon' => 'dashicons-admin-home',
|
||||
'icon' => 'dashicons-share',
|
||||
'title' => esc_html__( 'Socials', 'opalestate-pro' ),
|
||||
'fields' => $metabox->get_social_fields( $prefix ),
|
||||
];
|
||||
@@ -105,11 +105,9 @@ class Opalestate_Admin_Agent {
|
||||
}
|
||||
|
||||
public function save_post( $post_id, $post, $update ) {
|
||||
///
|
||||
$post_type = get_post_type( $post_id );
|
||||
if ( $post_type == 'opalestate_agent' ) {
|
||||
if ( isset( $_POST[ OPALESTATE_AGENT_PREFIX . 'user_id' ] ) && absint( $_POST[ OPALESTATE_AGENT_PREFIX . 'user_id' ] ) ) {
|
||||
|
||||
$user_id = absint( $_POST[ OPALESTATE_AGENT_PREFIX . 'user_id' ] );
|
||||
update_user_meta( $user_id, OPALESTATE_USER_PROFILE_PREFIX . 'related_id', $post_id );
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ class OpalEstate_Admin_User{
|
||||
|
||||
$tabs_setting['tabs'][] = array(
|
||||
'id' => 'p-socials',
|
||||
'icon' => 'dashicons-admin-home',
|
||||
'icon' => 'dashicons-share',
|
||||
'title' => esc_html__( 'Socials', 'opalestate-pro' ),
|
||||
'fields' => $metabox->get_social_fields( $prefix ),
|
||||
);
|
||||
|
||||
@@ -83,7 +83,7 @@ class Opalestate_Agency_MetaBox extends Opalestate_User_MetaBox {
|
||||
'title' => esc_html__( 'Name and Description', 'opalestate-pro' ),
|
||||
'object_types' => [ 'opalestate_property' ],
|
||||
'context' => 'normal',
|
||||
'object_types' => [ 'user' ], // Tells CMB2 to use user_meta vs post_meta
|
||||
'object_types' => [ 'user' ],
|
||||
'priority' => 'high',
|
||||
'show_names' => true,
|
||||
'fields' => $this->get_fields( $prefix ),
|
||||
@@ -153,7 +153,6 @@ class Opalestate_Agency_MetaBox extends Opalestate_User_MetaBox {
|
||||
'type' => 'text_email',
|
||||
'description' => esc_html__( 'Enter contact name that allow user contact you via the contact form of website.', 'opalestate-pro' ),
|
||||
],
|
||||
|
||||
[
|
||||
'id' => "{$prefix}phone",
|
||||
'name' => esc_html__( 'Phone', 'opalestate-pro' ),
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
<?php
|
||||
/**
|
||||
* $Desc$
|
||||
* OpalEstate_Agency
|
||||
*
|
||||
* @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' ) ) {
|
||||
@@ -54,7 +48,6 @@ class OpalEstate_Agency {
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct( $post_id = null ) {
|
||||
|
||||
global $post;
|
||||
|
||||
$this->post = $post;
|
||||
@@ -99,9 +92,7 @@ class OpalEstate_Agency {
|
||||
* Get url of user avatar by agency id
|
||||
*/
|
||||
public static function get_avatar_url( $userID ) {
|
||||
|
||||
return get_post_meta( $userID, OPALESTATE_AGENCY_PREFIX . "avatar", true );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -164,15 +155,17 @@ class OpalEstate_Agency {
|
||||
$team = [];
|
||||
$ids = get_post_meta( $this->post_id, OPALESTATE_AGENCY_PREFIX . 'team', true );
|
||||
|
||||
foreach ( $ids as $id ) {
|
||||
$user = get_user_by( 'id', $id ); // echo '<pre>' . print_r( $user, 1 );die;
|
||||
$team[] = [
|
||||
'id' => $user->ID,
|
||||
'name' => $user->display_name,
|
||||
'avatar_url' => OpalEstate_User::get_author_picture( $user->ID ),
|
||||
'username' => $user->user_login,
|
||||
'description' => 'okokok',
|
||||
];
|
||||
if ( $ids ) {
|
||||
foreach ( $ids as $id ) {
|
||||
$user = get_user_by( 'id', $id );
|
||||
$team[] = [
|
||||
'id' => $user->ID,
|
||||
'name' => $user->display_name,
|
||||
'avatar_url' => OpalEstate_User::get_author_picture( $user->ID ),
|
||||
'username' => $user->user_login,
|
||||
'description' => 'okokok',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $team;
|
||||
@@ -241,10 +234,11 @@ class OpalEstate_Agency {
|
||||
}
|
||||
|
||||
/**
|
||||
* Update user data.
|
||||
*
|
||||
* @param $user_id User ID.
|
||||
*/
|
||||
public static function update_user_data( $user_id ) {
|
||||
|
||||
$fields = self::metaboxes_fields();
|
||||
|
||||
$others = [
|
||||
@@ -254,7 +248,7 @@ class OpalEstate_Agency {
|
||||
|
||||
foreach ( $fields as $key => $field ) {
|
||||
$kpos = $field['id'];
|
||||
$tmp = str_replace( OPALESTATE_AGENCY_PREFIX, "", $field['id'] );
|
||||
$tmp = str_replace( OPALESTATE_AGENCY_PREFIX, '', $field['id'] );
|
||||
if ( isset( $_POST[ $kpos ] ) && $tmp ) {
|
||||
$data = is_string( $_POST[ $kpos ] ) ? sanitize_text_field( $_POST[ $kpos ] ) : $_POST[ $kpos ];
|
||||
update_user_meta( $user_id, OPALESTATE_USER_PROFILE_PREFIX . $tmp, $data );
|
||||
@@ -272,20 +266,20 @@ class OpalEstate_Agency {
|
||||
}
|
||||
|
||||
/**
|
||||
* Update data from user.
|
||||
*
|
||||
* @param $related_id Post ID
|
||||
*/
|
||||
public static function update_data_from_user( $related_id ) {
|
||||
|
||||
|
||||
$fields = self::metaboxes_fields();
|
||||
|
||||
$others = [
|
||||
'avatar_id' => '',
|
||||
'map' => '',
|
||||
];
|
||||
foreach ( $fields as $key => $field ) {
|
||||
|
||||
$tmp = str_replace( OPALESTATE_AGENCY_PREFIX, "", $field['id'] );
|
||||
foreach ( $fields as $key => $field ) {
|
||||
$tmp = str_replace( OPALESTATE_AGENCY_PREFIX, '', $field['id'] );
|
||||
$kpos = OPALESTATE_USER_PROFILE_PREFIX . $tmp;
|
||||
|
||||
if ( isset( $_POST[ $kpos ] ) && $tmp ) {
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
<?php
|
||||
/**
|
||||
* $Desc$
|
||||
* OpalEstate_Agent
|
||||
*
|
||||
* @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' ) ) {
|
||||
@@ -41,7 +35,6 @@ class OpalEstate_Agent {
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct( $post_id = null ) {
|
||||
|
||||
global $post;
|
||||
|
||||
if ( $post ) {
|
||||
@@ -151,8 +144,19 @@ class OpalEstate_Agent {
|
||||
return array_merge_recursive( $fields, $metabox->get_social_fields( OPALESTATE_AGENT_PREFIX ) );
|
||||
}
|
||||
|
||||
public static function update_user_data( $user_id ) {
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_trusted() {
|
||||
return $this->is_trusted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update user data.
|
||||
*
|
||||
* @param $user_id User ID.
|
||||
*/
|
||||
public static function update_user_data( $user_id ) {
|
||||
$fields = self::metaboxes_fields();
|
||||
|
||||
$others = [
|
||||
@@ -160,6 +164,7 @@ class OpalEstate_Agent {
|
||||
'opalestate_agt_map' => '',
|
||||
'map' => '',
|
||||
];
|
||||
|
||||
foreach ( $fields as $key => $field ) {
|
||||
$kpos = $field['id'];
|
||||
$tmp = str_replace( OPALESTATE_AGENT_PREFIX, '', $field['id'] );
|
||||
@@ -180,27 +185,20 @@ class OpalEstate_Agent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Update data from user.
|
||||
*
|
||||
*/
|
||||
public function get_trusted() {
|
||||
return $this->is_trusted;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param $related_id Post ID.
|
||||
*/
|
||||
public static function update_data_from_user( $related_id ) {
|
||||
|
||||
|
||||
$fields = self::metaboxes_fields();
|
||||
|
||||
$others = [
|
||||
'avatar_id' => '',
|
||||
'map' => '',
|
||||
];
|
||||
foreach ( $fields as $key => $field ) {
|
||||
|
||||
$tmp = str_replace( OPALESTATE_AGENT_PREFIX, "", $field['id'] );
|
||||
foreach ( $fields as $key => $field ) {
|
||||
$tmp = str_replace( OPALESTATE_AGENT_PREFIX, '', $field['id'] );
|
||||
$kpos = OPALESTATE_USER_PROFILE_PREFIX . $tmp;
|
||||
|
||||
if ( isset( $_POST[ $kpos ] ) && $tmp ) {
|
||||
@@ -273,5 +271,3 @@ class OpalEstate_Agent {
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -107,6 +107,7 @@ class OpalEstate_Nocaptcha_Recaptcha {
|
||||
'off' => esc_html__( 'No', 'opalestate-pro' ),
|
||||
'on' => esc_html__( 'Yes', 'opalestate-pro' ),
|
||||
],
|
||||
'default' => 'on',
|
||||
],
|
||||
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user