]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/js/user-suggest.js
WordPress 3.9
[autoinstalls/wordpress.git] / wp-admin / js / user-suggest.js
index 130c3d1adfbaf9b845741447f9c1acdb528a8679..0113ded0e970204133d145c7bf153ff3b84ba141 100644 (file)
@@ -8,17 +8,23 @@
                        position.my = 'right top';
                        position.at = 'right bottom';
                }
-               $( '.wp-suggest-user' ).autocomplete({
-                       source:    ajaxurl + '?action=autocomplete-user&autocomplete_type=add' + id,
-                       delay:     500,
-                       minLength: 2,
-                       position:  position,
-                       open: function() {
-                               $( this ).addClass( 'open' );
-                       },
-                       close: function() {
-                               $( this ).removeClass( 'open' );
-                       }
+               $( '.wp-suggest-user' ).each( function(){
+                       var $this = $( this ),
+                               autocompleteType = ( typeof $this.data( 'autocompleteType' ) !== 'undefined' ) ? $this.data( 'autocompleteType' ) : 'add',
+                               autocompleteField = ( typeof $this.data( 'autocompleteField' ) !== 'undefined' ) ? $this.data( 'autocompleteField' ) : 'user_login';
+
+                       $this.autocomplete({
+                               source:    ajaxurl + '?action=autocomplete-user&autocomplete_type=' + autocompleteType + '&autocomplete_field=' + autocompleteField + id,
+                               delay:     500,
+                               minLength: 2,
+                               position:  position,
+                               open: function() {
+                                       $( this ).addClass( 'open' );
+                               },
+                               close: function() {
+                                       $( this ).removeClass( 'open' );
+                               }
+                       });
                });
        });
-})( jQuery );
\ No newline at end of file
+})( jQuery );