• Resolved dareadel

    (@h2ofilters)


    Hello and thank you for the plugin. I was trying to use this code from one of your posts for an extra field but I got an error message. Here’s the code I used but of course I changed the title, placeholder, and text:

    add_action( 'give_fields_after_donation_amount', function( $group ) {
        $group->append(
            give_field( 'text', 'mothersName' )
                ->showInReceipt()
                ->minLength(2)
                ->label( __( 'Mother\'s Name' )
                ->maxLength(30)
                ->placeholder('Mother\'s name')
                ->required() // Could instead be marked as readOnly() (optional)
                ->helpText( __( 'This is a field used to add your mother\'s name' ) ) //how this is displayed is up to the template, but if the template has help text displayed, this is how to set it.
        );
    });

    I got this error in my functions.php:

    Exception thrown without a stack frame

    I will appreciate your help.

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Support Matheus Martins

    (@matheusfd)

    Hey, @h2ofilters.

    ​Glad you reached out. I can help you with that.

    You are missing a parathesis on the label property. Your code should look like this instead:

    
    add_action( 'give_fields_after_donation_amount', function( $group ) {
        $group->append(
            give_field( 'text', 'mothersName' )
                ->showInReceipt()
                ->minLength(2)
                ->label( __( 'Mother\'s Name' ))
                ->maxLength(30)
                ->placeholder('Mother\'s name')
                ->required() // Could instead be marked as readOnly() (optional)
                ->helpText( __( 'This is a field used to add your mother\'s name' ) ) //how this is displayed is up to the template, but if the template has help text displayed, this is how to set it.
        );
    });

    ​Please let us know if you have further questions or need additional assistance!

    Thread Starter dareadel

    (@h2ofilters)

    It works! Thank you so much

    • This reply was modified 2 years, 3 months ago by dareadel.
    Plugin Support Matheus Martins

    (@matheusfd)

    You are welcome, @h2ofilters.

    Can you help me too? We’d love to get a public review about what you think of GiveWP, both from a product standpoint and how it is to deal with our team. Here are some options:

    G2: https://www.g2.com/products/givewp/reviews
    WordPress: https://wordpress.org/support/view/plugin-reviews/give
    Google: https://g.page/givewp/review?rc
    Facebook: https://www.facebook.com/pg/wpgive/reviews/

    The reviews help others decide if it’s worth doing business with us!

    Have a great day!

    Thread Starter dareadel

    (@h2ofilters)

    Certainly. I can write a review.

    However, I have one more question. How do you get the field to appear on a donor’s confirmation messages?

    We did a test but the field did not appear in a confirmation message or the receipt.

    Thank you

    Thread Starter dareadel

    (@h2ofilters)

    Never mind. I found the tag in the settings

    Plugin Support Matheus Martins

    (@matheusfd)

    Happy to hear that it is working, @h2ofilters.

    I’d you need further assistance, we are happy to help.

    Have a great day! 🙂

    Thread Starter dareadel

    (@h2ofilters)

    Hi @matheusfd,

    Unfortunately, the field is not displayed in confirmation emails.

    Here’s the email setup:

    Donor: {fullname}
    Donation: {donation}
    Donation on behalf of...: {guest Name}
    
    Donation Date: {date}
    
    Amount: {amount}
    Payment Method: {payment_method}
    Payment ID: {payment_id}
    
    {receipt_link}
    
    Sincerely,
    {sitename}

    The field output for “Donation on behalf of…” is not showing in the confirmation email messages.

    Thread Starter dareadel

    (@h2ofilters)

    Just a followup, I have no space in {guestName}

    Plugin Support Rick Alday

    (@mrdaro)

    Hi @h2ofilters,

    I’m unable to replicate this. Can you share the code that you’re using to add the custom field?

    Thanks!

    Thread Starter dareadel

    (@h2ofilters)

    Thank you @mrdaro,

    Here is the code. I hope I can get this resolved quite soon. The event is in July, just a week away.

    //Extra field for donations
    add_action( 'give_fields_after_donation_amount', function( $group ) {
        $group->append(
            give_field( 'text', 'guestName' )
                ->showInReceipt()
                ->minLength(2)
                ->label( __( 'Donation on behalf of...' ))
                ->maxLength(30)
                ->placeholder('Name of alumnus')
                ->required() // Could instead be marked as readOnly() (optional)
                ->helpText( __( 'This is a field used to add the alumnus name on behalf whom you you are donating' ) ) //how this is displayed is up to the template, but if the template has help text displayed, this is how to set it.
        );
    });
    Thread Starter dareadel

    (@h2ofilters)

    I gave a reply @mrdaro over 4 days now. So what’s next?

    Plugin Support Rick Alday

    (@mrdaro)

    Hi @h2ofilters,

    I tested your code and it’s working for me. Here’s quick screencast to demonstrate what I did and how I tested: https://somup.com/c31t3Kt9f4

    Thread Starter dareadel

    (@h2ofilters)

    Thank you @mrdaro,

    Unfortunately I didn’t see the same thing you’re seeing. It appears you have a different plugin. My Give post type name is “Donations” but yours is “Contributions.” Even when I go to the list of donors and I viewed it doesn’t show “receipt.”

    The question is do you need the pro version of the plugin for the code to work, and show “Contributions” instead of “Donations?”

    Plugin Support Rick Alday

    (@mrdaro)

    It’s the same plugin. Mine says “Contributions” because I translated the term for a different ticket. Sorry for the confusion, nonetheless, everything else is the same.

    Thread Starter dareadel

    (@h2ofilters)

    Thank you so much, @mrdaro. I tried again and it works now. Not sure what happened before.

    • This reply was modified 2 years, 3 months ago by dareadel.
    • This reply was modified 2 years, 3 months ago by dareadel.
Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Text Field Code Error’ is closed to new replies.