Update
This commit is contained in:
parent
c93c699a77
commit
7ee9f6ecb0
@ -1,29 +1,39 @@
|
||||
<?php
|
||||
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( 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;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
49
inc/vendors/cmb2-plugins/cmb2/custom-fields/iconpicker/assets/script.js
vendored
Executable file
49
inc/vendors/cmb2-plugins/cmb2/custom-fields/iconpicker/assets/script.js
vendored
Executable file
@ -0,0 +1,49 @@
|
||||
(function( $ ) {
|
||||
'use strict';
|
||||
$( document ).ready( function() {
|
||||
|
||||
|
||||
$( ".adduser-team" ).delegate( ".remove-user", "click", function() {
|
||||
if( confirm( $(this).data('alert') ) ){
|
||||
$(this).parents( '.user-team' ).remove();
|
||||
}
|
||||
});
|
||||
|
||||
$( '.opalestate-add-user-field' ).each( function() {
|
||||
var $this = $(this);
|
||||
$('.button', this).click( function () {
|
||||
|
||||
|
||||
var user_search = $( '.opalestate-adduser-search', $(this).parent().parent() ).val();
|
||||
|
||||
|
||||
$('.opalestate-ajax').show();
|
||||
|
||||
var data = {
|
||||
action: 'opalestate_ajax_search_username',
|
||||
user_name: user_search,
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: data,
|
||||
dataType: "json",
|
||||
url: ajaxurl,
|
||||
success: function ( response ) {
|
||||
if( response.status == true ){
|
||||
var template = wp.template( 'adduser-team-template' );
|
||||
$('.adduser-team', $this ).append( template( response.user ) );
|
||||
}else {
|
||||
alert( response.message );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
|
||||
})( jQuery );
|
29
inc/vendors/cmb2-plugins/cmb2/custom-fields/iconpicker/assets/style.css
vendored
Executable file
29
inc/vendors/cmb2-plugins/cmb2/custom-fields/iconpicker/assets/style.css
vendored
Executable file
@ -0,0 +1,29 @@
|
||||
.adduser-team{
|
||||
width: 80%;
|
||||
}
|
||||
.user-team{
|
||||
padding: 12px 10px;
|
||||
display: block;
|
||||
border-bottom: solid 1px #f3f3f3
|
||||
}
|
||||
.user-team > div{
|
||||
display: inline-block;
|
||||
width: 33%;
|
||||
|
||||
}
|
||||
|
||||
.user-team > div img{
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border: solid 3px #CCC;
|
||||
border-radius: 50%;
|
||||
float: left;
|
||||
margin-right: 6px;
|
||||
}
|
||||
|
||||
.remove-user {
|
||||
cursor: pointer;
|
||||
}
|
||||
.remove-user:hover {
|
||||
color: red;
|
||||
}
|
95
inc/vendors/cmb2-plugins/cmb2/custom-fields/iconpicker/iconpicker.php
vendored
Executable file
95
inc/vendors/cmb2-plugins/cmb2/custom-fields/iconpicker/iconpicker.php
vendored
Executable file
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
/**
|
||||
* Opalestate_Field_Iconpicker
|
||||
*
|
||||
* @package opalestate
|
||||
* @author Opal Team <info@wpopal.com >
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
class Opalestate_Field_Iconpicker {
|
||||
|
||||
/**
|
||||
* Current version number
|
||||
*/
|
||||
const VERSION = '1.0.0';
|
||||
|
||||
/**
|
||||
* Initialize the plugin by hooking into CMB2
|
||||
*/
|
||||
public static function init() {
|
||||
add_filter( 'cmb2_render_opal_iconpicker', [ __CLASS__, 'render_iconpicker' ], 10, 5 );
|
||||
add_filter( 'cmb2_sanitize_opal_iconpicker', [ __CLASS__, 'sanitize_map' ], 10, 4 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render field
|
||||
*/
|
||||
public static function render_iconpicker( $field, $field_escaped_value, $field_object_id, $field_object_type, $field_type_object ) {
|
||||
self::setup_admin_scripts();
|
||||
|
||||
$users = $field->value;
|
||||
|
||||
echo '<div class="opalestate-add-user-field ' . apply_filters( 'opalestate_row_container_class', 'row opal-row' ) . '"> '; ?>
|
||||
<div class="col-lg-12">
|
||||
<h5 class=""><?php esc_html_e( 'As an author, you can add other users to your agency.', 'opalestate-pro' ); ?></h5>
|
||||
<div>
|
||||
<p><?php esc_html_e( 'Add someone to your agency, please enter extractly username in below input:', 'opalestate-pro' ); ?></p>
|
||||
|
||||
<div class="<?php echo apply_filters( 'opalestate_row_container_class', 'row opal-row' ); ?>">
|
||||
|
||||
<div class="col-lg-8"><input class="regular-text opalestate-adduser-search" name="opalestate_adduser_search" id="opalestate_adduser_search" value="" type="text"></div>
|
||||
<div class="col-lg-4"><input name="search" class="button button-primary button-large pull-left" id="publish" value="<?php esc_html_e( 'add', 'opalestate-pro' ); ?>" type="button">
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear clearfix"></div>
|
||||
</div>
|
||||
<div class="adduser-team">
|
||||
<?php if ( $users ): $users = array_unique( $users ); ?>
|
||||
<?php foreach ( $users as $user_id ): $user = get_user_by( 'id', $user_id );
|
||||
$user = $user->data ?>
|
||||
<div class="user-team">
|
||||
<input type="hidden" name="<?php echo $field->args( '_name' ) ?>[]" value="<?php echo $user_id; ?>">
|
||||
<div>
|
||||
<img src="<?php echo get_avatar_url( $user_id ); ?>">
|
||||
<a href="<?php get_author_posts_url( $user_id ); ?>" target="_blank"> <?php echo $user->user_login; ?> </a></div>
|
||||
<div><span class="remove-user" data-alert="<?php esc_html_e( 'Are you sure to delete this', 'opalestate-pro' ); ?>"><?php esc_html_e( 'Remove',
|
||||
'opalestate-pro' ); ?></span></div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="tmpl-adduser-team-template">
|
||||
<div class="user-team">
|
||||
<input type="hidden" name="<?php echo $field->args( '_name' ) ?>[]" value="{{{data.ID}}}">
|
||||
<div><img src="{{{data.avatar}}}"> <a href="{{{data.author_link}}}" target="_blank"> {{{data.user_login}}} </a></div>
|
||||
<div><span class="remove-user" data-alert="<?php esc_html_e( 'Are you sure to delete this', 'opalestate-pro' ); ?>"><?php esc_html_e( 'Remove', 'opalestate-pro' ); ?></span></div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<?php echo '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Optionally save the latitude/longitude values into two custom fields
|
||||
*/
|
||||
public static function sanitize_map( $override_value, $value, $object_id, $field_args ) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue scripts and styles
|
||||
*/
|
||||
public static function setup_admin_scripts() {
|
||||
wp_enqueue_script( 'opalestate-adduser', plugins_url( 'assets/script.js', __FILE__ ), [], self::VERSION );
|
||||
wp_enqueue_style( 'opalestate-adduser', plugins_url( 'assets/style.css', __FILE__ ), [], self::VERSION );
|
||||
}
|
||||
}
|
||||
|
||||
Opalestate_Field_Iconpicker::init();
|
@ -1,20 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* $Desc$
|
||||
* Opalestate_Field_Adduser
|
||||
*
|
||||
* @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_Field_Adduser {
|
||||
|
||||
/**
|
||||
@ -26,8 +21,8 @@ class Opalestate_Field_Adduser {
|
||||
* Initialize the plugin by hooking into CMB2
|
||||
*/
|
||||
public static function init() {
|
||||
add_filter( 'cmb2_render_adduser', array( __CLASS__, 'render_map' ), 10, 5 );
|
||||
add_filter( 'cmb2_sanitize_adduser', array( __CLASS__, 'sanitize_map' ), 10, 4 );
|
||||
add_filter( 'cmb2_render_adduser', [ __CLASS__, 'render_map' ], 10, 5 );
|
||||
add_filter( 'cmb2_sanitize_adduser', [ __CLASS__, 'sanitize_map' ], 10, 4 );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -38,44 +33,45 @@ class Opalestate_Field_Adduser {
|
||||
|
||||
$users = $field->value;
|
||||
|
||||
// echo '<pre>'.print_r( $value, 1 );die;
|
||||
echo '<div class="opalestate-add-user-field '.apply_filters('opalestate_row_container_class', 'row opal-row').'"> '; ?>
|
||||
<div class="col-lg-12">
|
||||
<h5 class=""><?php esc_html_e( 'As an author, you can add other users to your agency.', 'opalestate-pro'); ?></h5>
|
||||
<div>
|
||||
<p><?php esc_html_e( 'Add someone to your agency, please enter extractly username in below input:', 'opalestate-pro' ); ?></p>
|
||||
echo '<div class="opalestate-add-user-field ' . apply_filters( 'opalestate_row_container_class', 'row opal-row' ) . '"> '; ?>
|
||||
<div class="col-lg-12">
|
||||
<h5 class=""><?php esc_html_e( 'As an author, you can add other users to your agency.', 'opalestate-pro' ); ?></h5>
|
||||
<div>
|
||||
<p><?php esc_html_e( 'Add someone to your agency, please enter extractly username in below input:', 'opalestate-pro' ); ?></p>
|
||||
|
||||
<div class="<?php echo apply_filters('opalestate_row_container_class', 'row opal-row'); ?>">
|
||||
<div class="<?php echo apply_filters( 'opalestate_row_container_class', 'row opal-row' ); ?>">
|
||||
|
||||
<div class="col-lg-8"><input class="regular-text opalestate-adduser-search" name="opalestate_adduser_search" id="opalestate_adduser_search" value="" type="text"></div>
|
||||
<div class="col-lg-4"><input name="search" class="button button-primary button-large pull-left" id="publish" value="<?php esc_html_e( 'add', 'opalestate-pro' ); ?>" type="button"></div>
|
||||
</div>
|
||||
<div class="clear clearfix"></div>
|
||||
</div>
|
||||
<div class="adduser-team">
|
||||
<?php if( $users ): $users = array_unique( $users ); ?>
|
||||
<div class="col-lg-8"><input class="regular-text opalestate-adduser-search" name="opalestate_adduser_search" id="opalestate_adduser_search" value="" type="text"></div>
|
||||
<div class="col-lg-4"><input name="search" class="button button-primary button-large pull-left" id="publish" value="<?php esc_html_e( 'add', 'opalestate-pro' ); ?>" type="button">
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear clearfix"></div>
|
||||
</div>
|
||||
<div class="adduser-team">
|
||||
<?php if ( $users ): $users = array_unique( $users ); ?>
|
||||
<?php foreach ( $users as $user_id ): $user = get_user_by( 'id', $user_id );
|
||||
$user = $user->data ?>
|
||||
<div class="user-team">
|
||||
<input type="hidden" name="<?php echo $field->args( '_name' ) ?>[]" value="<?php echo $user_id; ?>">
|
||||
<div>
|
||||
<img src="<?php echo get_avatar_url( $user_id ); ?>">
|
||||
<a href="<?php get_author_posts_url( $user_id ); ?>" target="_blank"> <?php echo $user->user_login; ?> </a></div>
|
||||
<div><span class="remove-user" data-alert="<?php esc_html_e( 'Are you sure to delete this', 'opalestate-pro' ); ?>"><?php esc_html_e( 'Remove',
|
||||
'opalestate-pro' ); ?></span></div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php foreach( $users as $user_id ): $user = get_user_by( 'id', $user_id ); $user = $user->data ?>
|
||||
<div class="user-team">
|
||||
<input type="hidden" name="<?php echo $field->args( '_name' )?>[]" value="<?php echo $user_id; ?>">
|
||||
<div>
|
||||
<img src="<?php echo get_avatar_url( $user_id ) ; ?>">
|
||||
<a href="<?php get_author_posts_url( $user_id ); ?>" target="_blank"> <?php echo $user->user_login; ?> </a> </div>
|
||||
<div> <span class="remove-user" data-alert="<?php esc_html_e( 'Are you sure to delete this', 'opalestate-pro' ); ?>"><?php esc_html_e( 'Remove', 'opalestate-pro' ); ?></span></div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="tmpl-adduser-team-template">
|
||||
<div class="user-team">
|
||||
<input type="hidden" name="<?php echo $field->args( '_name' )?>[]" value="{{{data.ID}}}">
|
||||
<div> <img src="{{{data.avatar}}}"> <a href="{{{data.author_link}}}" target="_blank"> {{{data.user_login}}} </a> </div>
|
||||
<div> <span class="remove-user" data-alert="<?php esc_html_e( 'Are you sure to delete this', 'opalestate-pro' ); ?>"><?php esc_html_e( 'Remove', 'opalestate-pro' ); ?></span></div>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="tmpl-adduser-team-template">
|
||||
<div class="user-team">
|
||||
<input type="hidden" name="<?php echo $field->args( '_name' ) ?>[]" value="{{{data.ID}}}">
|
||||
<div><img src="{{{data.avatar}}}"> <a href="{{{data.author_link}}}" target="_blank"> {{{data.user_login}}} </a></div>
|
||||
<div><span class="remove-user" data-alert="<?php esc_html_e( 'Are you sure to delete this', 'opalestate-pro' ); ?>"><?php esc_html_e( 'Remove', 'opalestate-pro' ); ?></span></div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<?php echo '</div>';
|
||||
}
|
||||
@ -84,7 +80,6 @@ class Opalestate_Field_Adduser {
|
||||
* Optionally save the latitude/longitude values into two custom fields
|
||||
*/
|
||||
public static function sanitize_map( $override_value, $value, $object_id, $field_args ) {
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
@ -92,8 +87,8 @@ class Opalestate_Field_Adduser {
|
||||
* Enqueue scripts and styles
|
||||
*/
|
||||
public static function setup_admin_scripts() {
|
||||
wp_enqueue_script( 'opalestate-adduser', plugins_url( 'assets/script.js', __FILE__ ), array( ), self::VERSION );
|
||||
wp_enqueue_style( 'opalestate-adduser', plugins_url( 'assets/style.css', __FILE__ ), array(), self::VERSION );
|
||||
wp_enqueue_script( 'opalestate-adduser', plugins_url( 'assets/script.js', __FILE__ ), [], self::VERSION );
|
||||
wp_enqueue_style( 'opalestate-adduser', plugins_url( 'assets/style.css', __FILE__ ), [], self::VERSION );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ $fields = [
|
||||
'required' => 'required',
|
||||
],
|
||||
];
|
||||
|
||||
$form = OpalEstate()->html->render_form( $fields );
|
||||
$id = 'agency-add-member';
|
||||
?>
|
||||
|
@ -8,31 +8,31 @@
|
||||
$properties_count = [];
|
||||
$properties_count[] = [
|
||||
'icon' => 'fa fa-list',
|
||||
'count' => $statistics->get_count_properties(),
|
||||
'label' => esc_html__( 'My Properties', 'opalestate-pro' ),
|
||||
'class' => '',
|
||||
'count' => $statistics->get_count_published_properties(),
|
||||
'label' => esc_html__( 'Published Listings', 'opalestate-pro' ),
|
||||
'class' => 'dash-published-listings',
|
||||
];
|
||||
|
||||
$properties_count[] = [
|
||||
'icon' => 'fa fa-star',
|
||||
'count' => $statistics->get_count_featured(),
|
||||
'label' => esc_html__( 'Featured Properties', 'opalestate-pro' ),
|
||||
'class' => '',
|
||||
'label' => esc_html__( 'Featured Listings', 'opalestate-pro' ),
|
||||
'class' => 'dash-featured-listings',
|
||||
];
|
||||
|
||||
$properties_count[] = [
|
||||
'icon' => 'fa fa-file',
|
||||
'count' => $statistics->get_count_pending_properties(),
|
||||
'label' => esc_html__( 'Pending Properties', 'opalestate-pro' ),
|
||||
'class' => '',
|
||||
'class' => 'dash-pending-listings',
|
||||
];
|
||||
?>
|
||||
|
||||
<?php foreach ( $properties_count as $item ): ?>
|
||||
<div class="col-lg-4 col-md-4">
|
||||
<div class="card-item inner <?php echo esc_attr( $item['class'] ); ?>">
|
||||
<div class="heading"><i class="<?php echo esc_attr( $item['icon'] ); ?>"></i> <span><?php echo esc_html( $item['label'] ); ?></span></div>
|
||||
<h5><?php echo esc_html( $item['count'] ); ?></h5>
|
||||
<div class="card-item inner dash-widget <?php echo esc_attr( $item['class'] ); ?>">
|
||||
<h5 class="dash-count"><?php echo esc_html( $item['count'] ); ?></h5>
|
||||
<div class="heading"><span><?php echo esc_html( $item['label'] ); ?></span></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
@ -49,9 +49,12 @@
|
||||
$comments = get_comments( $args );
|
||||
?>
|
||||
|
||||
<div class="col-lg-8 col-md-8">
|
||||
<div class="col-lg-12 col-md-12">
|
||||
<div class="card-item inner">
|
||||
<div class="heading"><i class="fa fa-comment"></i> <span><?php esc_html_e( 'Latest review' ) ?></span></div>
|
||||
<div class="heading"><i class="fa fa-comment"></i> <span><?php esc_html_e( 'Latest review' ) ?></span>
|
||||
<a href="<?php echo esc_url( opalestate_get_user_management_page_uri() . '?tab=reviews' ); ?>" class="dash-view-all"><?php esc_html_e( 'View All', 'opalestate-pro' );
|
||||
?></a>
|
||||
</div>
|
||||
|
||||
<?php if ( ! isset( $comments ) || ! $comments ) : ?>
|
||||
<p class="opalestate-my-reviews-no-reviews"><?php esc_html_e( 'You have not written any reviews yet.', 'opalestate-pro' ); ?> </p>
|
||||
|
Loading…
Reference in New Issue
Block a user