]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/js/user-profile.js
WordPress 4.1-scripts
[autoinstalls/wordpress.git] / wp-admin / js / user-profile.js
index 95847310bf1cb00cff5f5898a24a5be6dd3d1804..ae4b97ab899bca1c636a92253afc3731bd9716d6 100644 (file)
 
                        // Set color scheme
                        if ( user_id === current_user_id ) {
-                               // Load the colors stylesheet
+                               // Load the colors stylesheet.
+                               // The default color scheme won't have one, so we'll need to create an element.
+                               if ( 0 === $stylesheet.length ) {
+                                       $stylesheet = $( '<link rel="stylesheet" />' ).appendTo( 'head' );
+                               }
                                $stylesheet.attr( 'href', $this.children( '.css_url' ).val() );
 
                                // repaint icons
                });
        });
 
+       $( '#destroy-sessions' ).on( 'click', function( e ) {
+               var $this = $(this);
+
+               wp.ajax.post( 'destroy-sessions', {
+                       nonce: $( '#_wpnonce' ).val(),
+                       user_id: $( '#user_id' ).val()
+               }).done( function( response ) {
+                       $this.prop( 'disabled', true );
+                       $this.siblings( '.notice' ).remove();
+                       $this.before( '<div class="notice notice-success inline"><p>' + response.message + '</p></div>' );
+               }).fail( function( response ) {
+                       $this.siblings( '.notice' ).remove();
+                       $this.before( '<div class="notice notice-error inline"><p>' + response.message + '</p></div>' );
+               });
+
+               e.preventDefault();
+       });
+
 })(jQuery);