WIP: Iconpicker
This commit is contained in:
@@ -1,49 +0,0 @@
|
||||
(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 );
|
||||
@@ -1,29 +0,0 @@
|
||||
.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;
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
<?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();
|
||||
Binary file not shown.
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "mustardbees/cmb_field_map",
|
||||
"description": "Google Maps field type for Custom Metaboxes and Fields for WordPress",
|
||||
"type": "wordpress-plugin",
|
||||
"keywords": ["wordpress", "plugin"],
|
||||
"homepage": "https://github.com/mustardBees/cmb_field_map/",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Phil Wylie",
|
||||
"homepage": "http://www.philwylie.co.uk/"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
.opal-map {
|
||||
min-height: 300px;
|
||||
width: 100%;
|
||||
margin: 5px 1px 1px;
|
||||
border: solid 1px #DDD;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.opal-map img {
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
.opalestate-map-wrap {
|
||||
display: block;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
padding: 12px;
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
(function( $ ) {
|
||||
'use strict';
|
||||
|
||||
var maps = [];
|
||||
|
||||
$( '.cmb-type-opal-map' ).each( function() {
|
||||
initializeMap( $( this ) );
|
||||
});
|
||||
|
||||
function initializeMap( mapInstance ) {
|
||||
var searchInput = mapInstance.find( '.opal-map-search' );
|
||||
var mapCanvas = mapInstance.find( '.opal-map' );
|
||||
var latitude = mapInstance.find( '.opal-map-latitude' );
|
||||
var longitude = mapInstance.find( '.opal-map-longitude' );
|
||||
var latLng = new google.maps.LatLng( 54.800685, -4.130859 );
|
||||
var zoom = 5;
|
||||
|
||||
// If we have saved values, let's set the position and zoom level
|
||||
if ( latitude.val().length > 0 && longitude.val().length > 0 ) {
|
||||
latLng = new google.maps.LatLng( latitude.val(), longitude.val() );
|
||||
zoom = 17;
|
||||
}
|
||||
|
||||
// Map
|
||||
var mapOptions = {
|
||||
center: latLng,
|
||||
zoom: zoom
|
||||
};
|
||||
var map = new google.maps.Map( mapCanvas[0], mapOptions );
|
||||
|
||||
latitude.on('change', function() {
|
||||
map.setCenter( new google.maps.LatLng( latitude.val(), longitude.val() ) );
|
||||
});
|
||||
|
||||
longitude.on('change', function() {
|
||||
map.setCenter( new google.maps.LatLng( latitude.val(), longitude.val() ) );
|
||||
});
|
||||
|
||||
// Marker
|
||||
var markerOptions = {
|
||||
map: map,
|
||||
draggable: true,
|
||||
title: 'Drag to set the exact location'
|
||||
};
|
||||
var marker = new google.maps.Marker( markerOptions );
|
||||
|
||||
//if ( latitude.val().length > 0 && longitude.val().length > 0 ) {
|
||||
marker.setPosition( latLng );
|
||||
// }
|
||||
|
||||
// Search
|
||||
var autocomplete = new google.maps.places.Autocomplete( searchInput[0] );
|
||||
autocomplete.bindTo( 'bounds', map );
|
||||
|
||||
google.maps.event.addListener( autocomplete, 'place_changed', function() {
|
||||
var place = autocomplete.getPlace();
|
||||
if ( ! place.geometry ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( place.geometry.viewport ) {
|
||||
map.fitBounds( place.geometry.viewport );
|
||||
} else {
|
||||
map.setCenter( place.geometry.location );
|
||||
map.setZoom( 17 );
|
||||
}
|
||||
|
||||
marker.setPosition( place.geometry.location );
|
||||
|
||||
latitude.val( place.geometry.location.lat() );
|
||||
longitude.val( place.geometry.location.lng() );
|
||||
});
|
||||
|
||||
$( searchInput ).keypress( function( event ) {
|
||||
if ( 13 === event.keyCode ) {
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
// Allow marker to be repositioned
|
||||
google.maps.event.addListener( marker, 'drag', function() {
|
||||
latitude.val( marker.getPosition().lat() );
|
||||
longitude.val( marker.getPosition().lng() );
|
||||
});
|
||||
|
||||
maps.push( map );
|
||||
}
|
||||
|
||||
// Resize map when meta box is opened
|
||||
if ( typeof postboxes !== 'undefined' ) {
|
||||
postboxes.pbshow = function () {
|
||||
var arrayLength = maps.length;
|
||||
for (var i = 0; i < arrayLength; i++) {
|
||||
var mapCenter = maps[i].getCenter();
|
||||
google.maps.event.trigger( maps[i], 'resize' );
|
||||
maps[i].setCenter( mapCenter );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// When a new row is added, reinitialize Google Maps
|
||||
$( '.cmb-repeatable-group' ).on( 'cmb2_add_row', function( event, newRow ) {
|
||||
var groupWrap = $( newRow ).closest( '.cmb-repeatable-group' );
|
||||
groupWrap.find( '.cmb-type-opal-map' ).each( function() {
|
||||
initializeMap( $( this ) );
|
||||
});
|
||||
});
|
||||
|
||||
})( jQuery );
|
||||
@@ -1,116 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* $Desc$
|
||||
*
|
||||
* @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_Map {
|
||||
|
||||
/**
|
||||
* Current version number
|
||||
*/
|
||||
const VERSION = '1.0.0';
|
||||
|
||||
/**
|
||||
* Initialize the plugin by hooking into CMB2
|
||||
*/
|
||||
public function __construct() {
|
||||
add_filter( 'cmb2_render_opal_map', array( $this, 'render_map' ), 10, 5 );
|
||||
add_filter( 'cmb2_sanitize_opal_map', array( $this, 'sanitize_map' ), 10, 4 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render field
|
||||
*/
|
||||
public function render_map( $field, $field_escaped_value, $field_object_id, $field_object_type, $field_type_object ) {
|
||||
$this->setup_admin_scripts();
|
||||
$address = (isset( $field_escaped_value['address'] ) ? $field_escaped_value['address'] : '');
|
||||
|
||||
echo '<div class="'.apply_filters('opalestate_row_container_class', 'row opal-row').'">
|
||||
<div class="opalestate-map-wrap col-sm-6">
|
||||
<div class="opal-map"></div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label>'.__( 'Map Address', 'opalestate-pro' ).'</label>
|
||||
<input type="text" class="large-text regular-text opal-map-search form-control" id="' . $field->args( 'id' ) . '"
|
||||
name="'.$field->args( '_name' ).'[address]" value="'.$address.'"/>';
|
||||
echo '</div>';
|
||||
|
||||
$field_type_object->_desc( true, true );
|
||||
|
||||
echo ' <div class="form-group">';
|
||||
echo '<label>'.__( 'Latitude', 'opalestate-pro' ).'</label>';
|
||||
echo $field_type_object->input( array(
|
||||
'type' => 'text',
|
||||
'name' => $field->args( '_name' ) . '[latitude]',
|
||||
'value' => isset( $field_escaped_value['latitude'] ) ? $field_escaped_value['latitude'] : '',
|
||||
'class' => 'opal-map-latitude form-control',
|
||||
'desc' => '',
|
||||
) );
|
||||
echo '</div>';
|
||||
echo ' <div class="form-group">';
|
||||
echo '<label>'.__( 'Longitude', 'opalestate-pro' ).'</label>';
|
||||
echo $field_type_object->input( array(
|
||||
'type' => 'text',
|
||||
'name' => $field->args( '_name' ) . '[longitude]',
|
||||
'value' => isset( $field_escaped_value['longitude'] ) ? $field_escaped_value['longitude'] : '',
|
||||
'class' => 'opal-map-longitude form-control',
|
||||
'desc' => '',
|
||||
) );
|
||||
echo '</div>';
|
||||
echo '<p class="opal-map-desc">' . __( 'You need to register <a href="https://developers.google.com/maps/documentation/javascript/get-api-key" target="_blank">Google API Key</a>, then put the key in plugin setting.',
|
||||
'opalestate-pro' ) . '</p>';
|
||||
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Optionally save the latitude/longitude values into two custom fields
|
||||
*/
|
||||
public function sanitize_map( $override_value, $value, $object_id, $field_args ) {
|
||||
if ( isset( $field_args['split_values'] ) && $field_args['split_values'] ) {
|
||||
if ( ! empty( $value['latitude'] ) ) {
|
||||
update_post_meta( $object_id, $field_args['id'] . '_latitude', $value['latitude'] );
|
||||
}
|
||||
|
||||
if ( ! empty( $value['longitude'] ) ) {
|
||||
update_post_meta( $object_id, $field_args['id'] . '_longitude', $value['longitude'] );
|
||||
}
|
||||
|
||||
if ( ! empty( $value['address'] ) ) {
|
||||
update_post_meta( $object_id, $field_args['id'] . '_address', $value['address'] );
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue scripts and styles
|
||||
*/
|
||||
public function setup_admin_scripts() {
|
||||
$api = opalestate_get_map_api_uri();
|
||||
|
||||
wp_enqueue_script("opalestate-google-maps", $api, null, "0.0.1", false);
|
||||
|
||||
wp_enqueue_script( 'opalestate-google-maps-js', plugins_url( 'js/script.js', __FILE__ ), array( ) );
|
||||
wp_enqueue_style( 'opalestate-google-maps', plugins_url( 'css/style.css', __FILE__ ), array() );
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
new Opalestate_Field_Map();
|
||||
@@ -1,39 +0,0 @@
|
||||
# CMB2 Field Type: Google Maps
|
||||
|
||||
## Description
|
||||
|
||||
Google Maps field type for [CMB2](https://github.com/WebDevStudios/CMB2).
|
||||
|
||||
The `pw_map` field stores the latitude/longitude values which you can then use to display a map in your theme.
|
||||
|
||||
## Installation
|
||||
|
||||
You can install this field type as you would a WordPress plugin:
|
||||
|
||||
1. Download the plugin
|
||||
2. Place the plugin folder in your `/wp-content/plugins/` directory
|
||||
3. Activate the plugin in the Plugin dashboard
|
||||
|
||||
## Usage
|
||||
|
||||
### `pw_map`
|
||||
|
||||
Save a location on a map. Example:
|
||||
|
||||
```php
|
||||
array(
|
||||
'name' => 'Location',
|
||||
'desc' => 'Drag the marker to set the exact location',
|
||||
'id' => $prefix . 'location',
|
||||
'type' => 'pw_map',
|
||||
// 'split_values' => true, // Save latitude and longitude as two separate fields
|
||||
),
|
||||
```
|
||||
|
||||
#### Extra Parameters:
|
||||
|
||||
* `split_values` Save the latitude/longitude values into two custom fields, they will be stored as `$id . '_latitude'` and `$id . '_longitude'`.
|
||||
|
||||
## Screenshot
|
||||
|
||||

|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 87 KiB |
@@ -1,49 +0,0 @@
|
||||
(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 );
|
||||
@@ -1,29 +0,0 @@
|
||||
.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;
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Opalestate_Field_Adduser
|
||||
*
|
||||
* @package opalestate
|
||||
* @author Opal Team <info@wpopal.com >
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
class Opalestate_Field_Adduser {
|
||||
|
||||
/**
|
||||
* Current version number
|
||||
*/
|
||||
const VERSION = '1.0.0';
|
||||
|
||||
/**
|
||||
* Initialize the plugin by hooking into CMB2
|
||||
*/
|
||||
public static function init() {
|
||||
add_filter( 'cmb2_render_adduser', [ __CLASS__, 'render_map' ], 10, 5 );
|
||||
add_filter( 'cmb2_sanitize_adduser', [ __CLASS__, 'sanitize_map' ], 10, 4 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render field
|
||||
*/
|
||||
public static function render_map( $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_Adduser::init();
|
||||
Reference in New Issue
Block a user