diff --git a/inc/admin/agency/class-agency.php b/inc/admin/agency/class-agency.php index ddba2db9..028858cb 100755 --- a/inc/admin/agency/class-agency.php +++ b/inc/admin/agency/class-agency.php @@ -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 ) ); diff --git a/inc/admin/agent/class-agent.php b/inc/admin/agent/class-agent.php index 95c000fa..0504f61b 100755 --- a/inc/admin/agent/class-agent.php +++ b/inc/admin/agent/class-agent.php @@ -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 ); diff --git a/inc/admin/class-user.php b/inc/admin/class-user.php index fd78aa05..6f4a567b 100755 --- a/inc/admin/class-user.php +++ b/inc/admin/class-user.php @@ -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 ), ); diff --git a/inc/agency/class-opalestate-agency-metabox.php b/inc/agency/class-opalestate-agency-metabox.php index 27529e44..8ffd77af 100755 --- a/inc/agency/class-opalestate-agency-metabox.php +++ b/inc/agency/class-opalestate-agency-metabox.php @@ -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' ), diff --git a/inc/agency/class-opalestate-agency.php b/inc/agency/class-opalestate-agency.php index db25e1f0..30845e69 100755 --- a/inc/agency/class-opalestate-agency.php +++ b/inc/agency/class-opalestate-agency.php @@ -1,15 +1,9 @@ - * @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 '
' . 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 ) {
diff --git a/inc/agent/class-opalestate-agent.php b/inc/agent/class-opalestate-agent.php
index 14c1bcbd..edfc02f7 100755
--- a/inc/agent/class-opalestate-agent.php
+++ b/inc/agent/class-opalestate-agent.php
@@ -1,15 +1,9 @@
 
- * @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;
 	}
 }
-
-?>
diff --git a/inc/class-no-captcha-recaptcha.php b/inc/class-no-captcha-recaptcha.php
index e4aaf9c3..d48ff647 100755
--- a/inc/class-no-captcha-recaptcha.php
+++ b/inc/class-no-captcha-recaptcha.php
@@ -107,6 +107,7 @@ class OpalEstate_Nocaptcha_Recaptcha {
 					'off' => esc_html__( 'No', 'opalestate-pro' ),
 					'on'  => esc_html__( 'Yes', 'opalestate-pro' ),
 				],
+				'default' => 'on',
 			],
 
 			[
diff --git a/templates/user-management.php b/templates/user-management.php
index c3645f57..fc0df229 100755
--- a/templates/user-management.php
+++ b/templates/user-management.php
@@ -18,8 +18,16 @@ if ( ! class_exists( 'OpalEstate_User' ) ) {
 }
 
 get_header( 'no-sidebar' );
+$user_id = get_current_user_id();
+$current_user = wp_get_current_user();
+
+$user_info = "{$current_user->display_name}";
+
+if ( $current_user->display_name !== $current_user->user_login ) {
+	$user_info .= "{$current_user->user_login}";
+}
 ?>
-
+