ACF Photo Gallery Field - Version 1.7.9

Version Description

Download this release

Release Info

Developer navzme
Plugin Icon 128x128 ACF Photo Gallery Field
Version 1.7.9
Comparing to
See all releases

Code changes from version 1.7.8 to 1.7.9

assets/css/acf-photo-gallery-field.css CHANGED
@@ -74,7 +74,8 @@
74
  }
75
 
76
  #acf-photo-gallery-metabox-edit .acf-edit-photo-gallery textarea {
77
- min-height: 100px
 
78
  }
79
 
80
  .acf-photo-gallery-metabox-list li.acf-photo-gallery-sortable-placeholder {
74
  }
75
 
76
  #acf-photo-gallery-metabox-edit .acf-edit-photo-gallery textarea {
77
+ min-height: 100px;
78
+ width: 100%;
79
  }
80
 
81
  .acf-photo-gallery-metabox-list li.acf-photo-gallery-sortable-placeholder {
assets/js/acf-photo-gallery-field.js CHANGED
@@ -62,7 +62,7 @@
62
  function acf_photo_gallery_add_media($el) {
63
  var acf_photo_gallery_ids = new Array();
64
  if ($('.acf-photo-gallery-metabox-add-images').length > 0) {
65
-
66
  if (typeof wp !== 'undefined' && wp.media && wp.media.editor) {
67
 
68
  $(document).on('click', '.acf-photo-gallery-metabox-add-images', function(e) {
62
  function acf_photo_gallery_add_media($el) {
63
  var acf_photo_gallery_ids = new Array();
64
  if ($('.acf-photo-gallery-metabox-add-images').length > 0) {
65
+
66
  if (typeof wp !== 'undefined' && wp.media && wp.media.editor) {
67
 
68
  $(document).on('click', '.acf-photo-gallery-metabox-add-images', function(e) {
includes/acf_photo_gallery_save.php CHANGED
@@ -37,3 +37,15 @@ function acf_photo_gallery_save( $post_id ){
37
  add_action( 'save_post', 'acf_photo_gallery_save' );
38
  }
39
  add_action( 'save_post', 'acf_photo_gallery_save' );
 
 
 
 
 
 
 
 
 
 
 
 
37
  add_action( 'save_post', 'acf_photo_gallery_save' );
38
  }
39
  add_action( 'save_post', 'acf_photo_gallery_save' );
40
+
41
+ add_action( 'profile_update', 'my_profile_update', 10, 2 );
42
+ function my_profile_update( $user_id, $old_user_data ){
43
+ $field = $_POST['acf-photo-gallery-field'];
44
+ $group = $_POST['acf-photo-gallery-groups'];
45
+ if( is_array($group) && count($group) > 0 ){
46
+ foreach($group as $item){
47
+ $d = $_POST[$item];
48
+ update_user_meta($user_id, $item, implode(',', $d));
49
+ }
50
+ }
51
+ }
includes/elementor_register_tag.php CHANGED
@@ -110,23 +110,24 @@ public function render() {
110
 
111
  public function get_value( array $options = [] ) {
112
  $images = [];
 
113
  $key = $this->get_settings( 'Key' );
114
 
115
  list( $field, $meta_key ) = explode( ':', $key );
116
 
117
- //$field = get_field($meta_key, get_the_ID());
118
- //$value = explode(',', $field);
119
  $value = get_field($meta_key, get_the_ID());
120
 
121
- if ( is_array( $value ) && !empty( $value ) ) {
122
- foreach ( $value as $image ) {
 
123
  $images[] = [
124
- 'id' => $image['id'],
125
  ];
126
  }
 
 
 
127
  }
128
-
129
- return $images;
130
  }
131
 
132
 
110
 
111
  public function get_value( array $options = [] ) {
112
  $images = [];
113
+
114
  $key = $this->get_settings( 'Key' );
115
 
116
  list( $field, $meta_key ) = explode( ':', $key );
117
 
 
 
118
  $value = get_field($meta_key, get_the_ID());
119
 
120
+ if( is_admin() ){
121
+ $img_ids = array_filter(explode(',', $value));
122
+ foreach ( $img_ids as $image ) {
123
  $images[] = [
124
+ 'id' => $image
125
  ];
126
  }
127
+ return $images;
128
+ } else {
129
+ return $value;
130
  }
 
 
131
  }
132
 
133
 
includes/input_admin_enqueue_scripts.php CHANGED
@@ -6,6 +6,7 @@ if( ! defined( 'ABSPATH' ) ) exit;
6
  // vars
7
  $url = $this->settings['url'];
8
  $version = $this->settings['version'];
 
9
 
10
  // register & include JS
11
  wp_enqueue_script( 'jquery-ui-sortable' );
6
  // vars
7
  $url = $this->settings['url'];
8
  $version = $this->settings['version'];
9
+ wp_enqueue_media();
10
 
11
  // register & include JS
12
  wp_enqueue_script( 'jquery-ui-sortable' );
includes/render_field.php CHANGED
@@ -30,6 +30,14 @@
30
  $images_limit = (!empty($field['fields[' . $fieldname]['images_limit']))? esc_attr($field['fields[' . $fieldname]['images_limit']):null;
31
  $replace_textarea_editor = (!empty($field['fields[' . $fieldname]['replace_caption_tinymce']))? esc_attr($field['fields[' . $fieldname]['replace_caption_tinymce']):null;
32
  }
 
 
 
 
 
 
 
 
33
  ?>
34
  <div class="acf-photo-gallery-group-<?php echo esc_attr($key); ?>">
35
  <input type="hidden" name="acf-photo-gallery-edit-modal" value="<?php echo esc_attr($edit_model); ?>" />
30
  $images_limit = (!empty($field['fields[' . $fieldname]['images_limit']))? esc_attr($field['fields[' . $fieldname]['images_limit']):null;
31
  $replace_textarea_editor = (!empty($field['fields[' . $fieldname]['replace_caption_tinymce']))? esc_attr($field['fields[' . $fieldname]['replace_caption_tinymce']):null;
32
  }
33
+ if($pagenow == 'profile.php'){
34
+ $value = get_user_meta(get_current_user_id(), $fieldname);
35
+ if(is_array($value) && !empty($value[0])){
36
+ $value = $value[0];
37
+ } else {
38
+ $value = null;
39
+ }
40
+ }
41
  ?>
42
  <div class="acf-photo-gallery-group-<?php echo esc_attr($key); ?>">
43
  <input type="hidden" name="acf-photo-gallery-edit-modal" value="<?php echo esc_attr($edit_model); ?>" />
navz-photo-gallery.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: ACF Photo Gallery Field
5
  Plugin URI: http://www.navz.me/
6
  Description: An extension for Advance Custom Fields which lets you add photo gallery functionality on your websites.
7
- Version: 1.7.8
8
  Author: Navneil Naicker
9
  Author URI: http://www.navz.me/
10
  License: GPLv2 or later
@@ -38,7 +38,7 @@ if( !class_exists('acf_plugin_photo_gallery') ) :
38
 
39
  function __construct() {
40
  $this->settings = array(
41
- 'version' => '1.7.8',
42
  'url' => plugin_dir_url( __FILE__ ),
43
  'path' => plugin_dir_path( __FILE__ )
44
  );
4
  Plugin Name: ACF Photo Gallery Field
5
  Plugin URI: http://www.navz.me/
6
  Description: An extension for Advance Custom Fields which lets you add photo gallery functionality on your websites.
7
+ Version: 1.7.9
8
  Author: Navneil Naicker
9
  Author URI: http://www.navz.me/
10
  License: GPLv2 or later
38
 
39
  function __construct() {
40
  $this->settings = array(
41
+ 'version' => '1.7.9',
42
  'url' => plugin_dir_url( __FILE__ ),
43
  'path' => plugin_dir_path( __FILE__ )
44
  );
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: navzme
3
  Tags: acf, advanced, custom, fields, photo, gallery, album, fancybox, litebox, lightbox
4
  Requires at least: 4.7.0
5
  Tested up to: 5.8.1
6
- Stable tag: 1.7.8
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -128,6 +128,10 @@ Just like any other WordPress plugin, this plugin can also cause issues with oth
128
  4. Please refer to the description for more info regarding the field type settings
129
 
130
  == Changelog ==
 
 
 
 
131
  =1.7.8=
132
  * [Bugfix] Sanitizing and escaping inputs
133
 
3
  Tags: acf, advanced, custom, fields, photo, gallery, album, fancybox, litebox, lightbox
4
  Requires at least: 4.7.0
5
  Tested up to: 5.8.1
6
+ Stable tag: 1.7.9
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
128
  4. Please refer to the description for more info regarding the field type settings
129
 
130
  == Changelog ==
131
+ =1.7.9=
132
+ * [Bugfix] Elementor Pro gallery images preview
133
+ * [Added] Support for user profile
134
+
135
  =1.7.8=
136
  * [Bugfix] Sanitizing and escaping inputs
137