Skip to:
Content

BuddyPress.org

Ticket #5091: 5091.diff

File 5091.diff, 1.6 KB (added by imath, 12 years ago)
  • bp-themes/bp-default/functions.php

     
    165165                'close'             => __( 'Close', 'buddypress' ),
    166166                'view'              => __( 'View', 'buddypress' ),
    167167                'mark_as_fav'       => __( 'Favorite', 'buddypress' ),
    168                 'remove_fav'        => __( 'Remove Favorite', 'buddypress' )
     168                'remove_fav'        => __( 'Remove Favorite', 'buddypress' ),
     169                'unsaved_changes'   => __( 'Your profile has unsaved changes. If you leave the page, the changes will be lost.', 'buddypress' ),
    169170        );
    170171        wp_localize_script( 'dtheme-ajax-js', 'BP_DTheme', $params );
    171172
  • bp-themes/bp-default/_inc/global.js

     
    873873                return false;
    874874        } );
    875875
     876        jq("#profile-edit-form input:not(:submit), #profile-edit-form textarea, #profile-edit-form select, #signup_form input:not(:submit), #signup_form textarea, #signup_form select").change( function() {
     877                var shouldconfirm = true;
    876878
     879                jq('#profile-edit-form input:submit, #signup_form input:submit').on( 'click', function() {
     880                        shouldconfirm = false;
     881                });
     882               
     883                window.onbeforeunload = function(e) {
     884                        if ( shouldconfirm ) {
     885                                return BP_DTheme.unsaved_changes;
     886                        }
     887                };
     888        });
     889
    877890        /** Friendship Requests **************************************/
    878891
    879892        /* Accept and Reject friendship request buttons */