Skip to:
Content
Pages
Categories
Search
Top
Bottom

Post Update button disable while posting


  • larnoult
    Participant

    @larnoult

    Hey,
    A lot of my (impatient) users double or triple click on the “post update” button (#aw-whats-new-submit), thus creating duplicated activities.
    I only found this 5 year old topic , where @henrywright suggested to insert jquery code in the post-form.php (in a child theme). Which I did:

    <?php
    /**
     * BuddyPress - Activity Post Form
     *
     * @version 3.1.0
     */
    
    ?>
    
    <?php
    /*
     * Template tag to prepare the activity post form checks capability and enqueue needed scripts.
     */
    bp_nouveau_before_activity_post_form();
    ?>
    
    <h2 class="bp-screen-reader-text"><?php echo esc_html_x( 'Post Update', 'heading', 'buddypress' ); ?></h2>
    
    <div id="bp-nouveau-activity-form" class="activity-update-form"></div>
    <script>
    
        jQuery( 'input#aw-whats-new-submit' ).click( function() {
    		jQuery( "input#aw-whats-new-submit ").attr( "disabled", true );
    		jQuery(this).addClass( "loadingBP" );	
        });
    </script>
    <?php
    /*
     * Template tag to load the Javascript templates of the Post form UI.
     */
    bp_nouveau_after_activity_post_form();
    

    Unfortunately, clicking on the button (although it’s the right selector) does not trigger the jQuery event.. I’m puzzled! Any help welcomed!
    Thanks

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar