Skip to:
Content

BuddyPress.org

Changeset 12773


Ignore:
Timestamp:
10/30/2020 11:57:03 PM (4 weeks ago)
Author:
imath
Message:

BP Nouveau: make sure users can delete their account from front end

  • Avoid using hashtags into tag attributes.
  • Improve the function to toggle the availability of the "delete my account" submit button.

Props dragoeco

Fixes #8383

Location:
trunk/src/bp-templates/bp-nouveau
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-nouveau/buddypress/members/single/settings/delete-account.php

    r12272 r12773  
    44 *
    55 * @since 3.0.0
    6  * @version 4.0.0
     6 * @version 7.0.0
    77 */
    88
     
    1515<?php bp_nouveau_user_feedback( 'member-delete-account' ); ?>
    1616
    17 <form action="<?php echo esc_url( bp_displayed_user_domain() . bp_get_settings_slug() . '/delete-account' ); ?>" name="account-delete-form" id="#account-delete-form" class="standard-form" method="post">
     17<form action="<?php echo esc_url( bp_displayed_user_domain() . bp_get_settings_slug() . '/delete-account' ); ?>" name="account-delete-form" id="account-delete-form" class="standard-form" method="post">
    1818
    1919    <label id="delete-account-understand" class="warn" for="delete-account-understand">
    20         <input class="disabled" type="checkbox" name="delete-account-understand" value="1" data-bp-disable-input="#delete-account-button" />
     20        <input class="disabled" type="checkbox" name="delete-account-understand" value="1" data-bp-disable-input="delete-account-button" />
    2121        <?php esc_html_e( 'I understand the consequences.', 'buddypress' ); ?>
    2222    </label>
  • trunk/src/bp-templates/bp-nouveau/common-styles/_bp_buttons.scss

    r12398 r12773  
    8484        input[type="reset"].disabled,
    8585        input[type="submit"][disabled="disabled"],
     86        input[type="submit"]:disabled,
    8687        button.pending,
    8788        button.disabled,
  • trunk/src/bp-templates/bp-nouveau/css/buddypress-rtl.css

    r12734 r12773  
    41064106.buddypress .buddypress-wrap input[type="reset"].disabled,
    41074107.buddypress .buddypress-wrap input[type="submit"][disabled="disabled"],
     4108.buddypress .buddypress-wrap input[type="submit"]:disabled,
    41084109.buddypress .buddypress-wrap button.pending,
    41094110.buddypress .buddypress-wrap button.disabled,
  • trunk/src/bp-templates/bp-nouveau/css/buddypress.css

    r12734 r12773  
    41064106.buddypress .buddypress-wrap input[type="reset"].disabled,
    41074107.buddypress .buddypress-wrap input[type="submit"][disabled="disabled"],
     4108.buddypress .buddypress-wrap input[type="submit"]:disabled,
    41084109.buddypress .buddypress-wrap button.pending,
    41094110.buddypress .buddypress-wrap button.disabled,
  • trunk/src/bp-templates/bp-nouveau/js/buddypress-nouveau.js

    r12526 r12773  
    22/* jshint devel: true */
    33/* jshint browser: true */
    4 /* @version 3.2.0 */
     4/* @since 3.0.0 */
     5/* @version 7.0.0 */
    56window.wp = window.wp || {};
    67window.bp = window.bp || {};
     
    465466
    466467        /**
    467          * [enableDisabledInput description]
    468          * @param  {[type]} event [description]
    469          * @param  {[type]} data  [description]
    470          * @return {[type]}       [description]
    471          */
    472         toggleDisabledInput: function() {
    473 
    474             // Fetch the data attr value (id)
    475             // This a pro tem approach due to current conditions see
    476             // https://github.com/buddypress/next-template-packs/issues/180.
    477             var disabledControl = $(this).attr('data-bp-disable-input');
    478 
    479             if ( $( disabledControl ).prop( 'disabled', true ) && !$(this).hasClass('enabled') ) {
    480                 $(this).addClass('enabled').removeClass('disabled');
    481                 $( disabledControl ).removeProp( 'disabled' );
    482 
    483             } else if( $( disabledControl ).prop( 'disabled', false ) && $(this).hasClass('enabled') ) {
    484                 $(this).removeClass('enabled').addClass('disabled');
    485                 // Set using attr not .prop else DOM renders as 'disable=""' CSS needs 'disable="disable"'.
    486                 $( disabledControl ).attr( 'disabled', 'disabled' );
     468         * Toggle the availability of Delete My account button.
     469         *
     470         * @param  {Object} event The change event.
     471         */
     472        toggleDisabledInput: function( event ) {
     473            var target = $( event.currentTarget ), disabledControl = '#' + target.data( 'bp-disable-input' ),
     474                isChecked = target.prop( 'checked' );
     475
     476            target.removeClass( 'enabled disabled' );
     477
     478            if ( isChecked ) {
     479                target.addClass( 'enabled' );
     480                $( disabledControl ).prop( 'disabled', false );
     481            } else {
     482                $( disabledControl ).prop( 'disabled', true );
     483                target.addClass( 'disabled' );
    487484            }
    488485        },
Note: See TracChangeset for help on using the changeset viewer.