Update
This commit is contained in:
@@ -1,29 +1,39 @@
|
||||
<?php
|
||||
class OpalEstate_User_Statistics {
|
||||
public $user_id;
|
||||
<?php
|
||||
|
||||
public function __construct () {
|
||||
$this->user_id = get_current_user_id();
|
||||
}
|
||||
|
||||
public function get_count_properties() {
|
||||
$query = Opalestate_Query::get_properties_by_user( array(), $this->user_id );
|
||||
return $query->found_posts;
|
||||
}
|
||||
|
||||
public function get_count_featured() {
|
||||
$query = Opalestate_Query::get_properties_by_user( array(
|
||||
'featured' => 1
|
||||
), $this->user_id );
|
||||
return $query->found_posts;
|
||||
}
|
||||
|
||||
public function get_count_pending_properties() {
|
||||
$query = Opalestate_Query::get_properties_by_user( array(
|
||||
'post_status' => 'pending'
|
||||
), $this->user_id );
|
||||
return $query->found_posts;
|
||||
}
|
||||
class OpalEstate_User_Statistics {
|
||||
public $user_id;
|
||||
|
||||
public function __construct() {
|
||||
$this->user_id = get_current_user_id();
|
||||
}
|
||||
?>
|
||||
|
||||
public function get_count_properties() {
|
||||
$query = Opalestate_Query::get_properties_by_user( [], $this->user_id );
|
||||
|
||||
return $query->found_posts;
|
||||
}
|
||||
|
||||
public function get_count_featured() {
|
||||
$query = Opalestate_Query::get_properties_by_user( [
|
||||
'featured' => 1,
|
||||
], $this->user_id );
|
||||
|
||||
return $query->found_posts;
|
||||
}
|
||||
|
||||
public function get_count_published_properties() {
|
||||
$query = Opalestate_Query::get_properties_by_user( [
|
||||
'post_status' => 'publish',
|
||||
], $this->user_id );
|
||||
|
||||
return $query->found_posts;
|
||||
}
|
||||
|
||||
public function get_count_pending_properties() {
|
||||
$query = Opalestate_Query::get_properties_by_user( [
|
||||
'post_status' => 'pending',
|
||||
], $this->user_id );
|
||||
|
||||
return $query->found_posts;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,10 +164,12 @@ function opalestate_management_user_menu_tabs() {
|
||||
'id' => isset( $opalestate_options['submission_page'] ) ? $opalestate_options['submission_page'] : 0,
|
||||
];
|
||||
|
||||
$statistics = new OpalEstate_User_Statistics();
|
||||
|
||||
$menu['myproperties'] = [
|
||||
'icon' => 'fa fa-building',
|
||||
'link' => 'submission_list',
|
||||
'title' => esc_html__( 'My Properties', 'opalestate-pro' ),
|
||||
'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,
|
||||
];
|
||||
|
||||
@@ -255,5 +257,3 @@ if ( ! function_exists( 'opalestate_create_user' ) ) {
|
||||
return $user_id;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user