Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Devin Walker

    (@dlocc)

    That’s strange! We test thoroughly with Avada (latest version). Could you perhaps have accidentally included the same form via shortcode on the page twice using a page builder?

    Thread Starter amiroo

    (@amiroo)

    I’ve checked everything, its not duplicated from admin side.
    Also when I check codes from browser dev-tools, I see form is not duplicated but div with class=”give-total-wrap” and a button have been duplicated.
    Can you help me to solve it?
    Thanks

    Plugin Author Devin Walker

    (@dlocc)

    Can you provide a link to your site?

    Thread Starter amiroo

    (@amiroo)

    Sure, Here you are.
    Thanks

    Plugin Author Matt Cromwell

    (@webdevmattcrom)

    Hi there. That’s a nice site! I found the form here:
    http://www.cah.wellwebsite.com/donations/donation/

    It’s only duplicating the actual form elements, not the whole single page, which is really strange.

    Do you have any custom code related to Give which you’ve added at all? Do you have something in the content area of your Give form? Do you have any Give template files in your theme at all?

    Also, have you tried changing the form to display on page rather than with the popup? Just wondering how that would look like and maybe provide additional information for us to troubleshoot.

    Thanks!

    Thread Starter amiroo

    (@amiroo)

    Hi There,
    Thanks for your compliment!
    Yes, I did some edit in an external php file to change “Give Plugin” appearance works with my theme.
    the content of php file is here:

    <?php
    
    /* Editing Give Plugin */
    
    /* Remove Old Action (containing old function) */
    remove_action('give_checkout_form_top', 'give_output_donation_levels');
    
    /* Define new Action */
    function give_output_donation_levels_edited( $form_id = 0, $args = array() ) {
    
        global $give_options;
    
        $variable_pricing    = give_has_variable_prices( $form_id );
        $allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true );
        $currency_position   = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
        $symbol              = isset( $give_options['currency'] ) ? give_currency_symbol( $give_options['currency'] ) : '$';
        $currency_output     = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
        $default_amount      = give_format_amount( give_get_default_form_amount( $form_id ) );
        $custom_amount_text  = get_post_meta( $form_id, '_give_custom_amount_text', true );
    
        do_action( 'give_before_donation_levels', $form_id );
    
        //Set Price, No Custom Amount Allowed means hidden price field
        if ( $allow_custom_amount == 'no' ) {
            ?>
    
            <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" value="<?php echo $default_amount; ?>" required>
            <p class="set-price give-donation-amount form-row-wide">
                <?php
                if ( $currency_position == 'before' ) {
                    echo $currency_output;
                }
                ?>
                <span id="give-amount" class="give-text-input"><?php echo $default_amount; ?></span>
            </p>
            <?php
        } else {
            //Custom Amount Allowed
            ?>
            <div class="give-total-wrap">
                <div class="give-donation-amount form-row-wide">
                    <?php
    
                    if ( $currency_position == 'before' ) {
                        echo $currency_output;
                    }
                    ?>
    
                    <input class="give-text-input" id="give-amount" name="give-amount" type="tel" placeholder="" value="<?php echo $default_amount; ?>" required autocomplete="off">
    
                    <?php if ( $currency_position == 'after' ) {
                        echo $currency_output;
                    } ?>
    
                    <p class="give-loading-text give-updating-price-loader" style="display: none;">
                        <span class="give-loading-animation"></span> <?php _e( 'Updating Amount', 'give' ); ?>
                        <span class="elipsis">.</span><span class="elipsis">.</span><span class="elipsis">.</span></p>
                </div>
            </div>
        <?php }
    
        //Custom Amount Text
        if ( ! empty( $custom_amount_text ) && ! $variable_pricing && $allow_custom_amount == 'yes' ) { ?>
            <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p>
        <?php }
    
        //Output Variable Pricing Levels
        if ( $variable_pricing ) {
            give_output_levels_edited( $form_id );
        }
        do_action( 'give_after_donation_levels', $form_id, $args );
    }
    
    /* Add New Action to Removed Action */
    add_action( 'give_checkout_form_top', 'give_output_donation_levels_edited', 10, 2 );
    
    /* Create New Function as Output */
    function give_output_levels_edited( $form_id ) {
    
        //Get variable pricing
        $prices             = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
        $display_style      = get_post_meta( $form_id, '_give_display_style', true );
        $custom_amount      = get_post_meta( $form_id, '_give_custom_amount', true );
        $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
        $output             = '';
        $counter            = 0;
    
        switch ( $display_style ) {
            case 'buttons':
    
                $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">';
    
                foreach ( $prices as $price ) {
                    $counter ++;
    
                    $output .= '<li>';
                    $output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class="give-donation-level-btn give-btn give-btn-level-' . $counter . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ) . '" value="' . give_format_amount( $price['_give_amount'] ) . '">';
                    $output .= ( ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ) );
                    $output .= '</button>';
                    $output .= '</li>';
    
                }
    
                //Custom Amount
                if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
                    $output .= '<li>';
                    $output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">';
                    $output .= $custom_amount_text;
                    $output .= '</button>';
                    $output .= '</li>';
                }
    
                $output .= '</ul>';
    
                break;
    
            case 'radios':
    
                $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">';
    
                foreach ( $prices as $price ) {
                    $counter ++;
    
                    $output .= '<li>';
    
                    $output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="give-radio-input give-radio-input-level give-radio-level-' . $counter . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ) . '" name="give-radio-donation-level" id="give-radio-level-' . $counter . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">';
    
                    $output .= '<label for="give-radio-level-' . $counter . '">' . ( ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ) ) . '</label>';
    
                    $output .= '</li>';
    
                }
    
                //Custom Amount
                if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
                    $output .= '<li>';
                    $output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">';
                    $output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>';
                    $output .= '</li>';
                }
    
                $output .= '</ul>';
    
                break;
    
            case 'dropdown':
    
                $output .= '<p><label></label><span class="wpcf7-form-control-wrap"><div class="wpcf7-select-parent">';
    
                $output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level">';
    
                //first loop through prices
                foreach ( $prices as $price ) {
    
                    $output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="give-donation-level-' . $form_id . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">';
                    $output .= ( ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ) );
                    $output .= '</option>';
    
                }
    
                //Custom Amount
                if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
                    $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>';
                }
    
                $output .= '</select>';
    
                $output .= '</div></span></p>';
    
                break;
        }
    
        echo apply_filters( 'give_form_level_output', $output, $form_id );
    }

    Could you please guide me what’s wrong as it was working properly before update?

    Thanks

    Plugin Author Matt Cromwell

    (@webdevmattcrom)

    It’s not totally clear to me what you’re trying to accomplish with this code, but it is the problem. I just added it into Twenty Twelve and am getting the same results.

    What are you trying to change about the donation levels?

    Thread Starter amiroo

    (@amiroo)

    Just now I remove the php file and seems work properly!
    Did you do some edit in your last update to match it with Avada theme?
    Because previously it didnt follow my theme styles but now is following!
    Hope it interact fine as well with PayPal.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Duplicated Form!’ is closed to new replies.