• Resolved lindsaylovespets

    (@lindsaylovespets)


    Hi, I have a site that uses multiple forms for our pet-sitting service. We want to be notified when any form is updated, and to receive an email with the form contents. We then use automation to parse the email and take appropriate action based on the content.

    Right now we use a code snippet that emails us whenever any form is updated (so far, so good!).

    `add_action( ‘um_after_user_updated’, function( $user_id, $args, $to_update ){
    um_fetch_user($user_id);
    $admin_email = UM()->options()->get( ‘admin_email’ );
    $profile_url = um_user_profile_url($user_id);
    $mail_content = ‘<a href=”‘.$profile_url.'”>’.um_user(‘display_name’).'</a> has updated their profile’;
    wp_mail( $admin_email,’Profile updated’, $mail_content );
    },10,3 );`

    What do I need to add here to include the name/content of the submitted form? Surely there’s a way, but I don’t know code… ??

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Support Aswin Giri

    (@aswingiri)

    Thread Starter lindsaylovespets

    (@lindsaylovespets)

    Hi, I tried that, both in addition to the first snippet (no change) and instead of the other snipped (no email at all), so that doesn’t seem to fix my problem. Doesn’t matter which form/profile tab – doesn’t seem to send an email at all.

    Thread Starter lindsaylovespets

    (@lindsaylovespets)

    EDIT: Should have looked closer – this is VERY close!

    Thank you so much! This is SO close to exactly what I’m looking for, but I’m looking for a little more.

    Is it possible to include the contents of the fields when the form is submitted? Like in the new registration form? Is that possible with UM?

    Thank you again!! ??

    Thread Starter lindsaylovespets

    (@lindsaylovespets)

    UPDATE:

    So, I implemented the snippet and the template, and it’s pretty awesome. I get an email when the form is submitted, but it’s always showing me the contents of the original registration form, not the profile form.

    I found the {submitted_registration} piece… is there a way to output any other forms?

    @lindsaylovespets

    The UM {submitted_registration} placeholder is being updated by UM core at Profile update with current Profile page field values.

    Other new fields in the Profile page are not included.

    Thread Starter lindsaylovespets

    (@lindsaylovespets)

    Thank you for your help, I really appreciate it. It’s weird… the emails I get contain the registration form fields and not the full profile page fields. I may not be using the terms correctly?

    My registration form contains some basic questions about identity, location, and services wanted. This is a Registration type form. My customer profile form contains all the customer info and this is a Profile type form, the one that shows up when there are no tabs. I have another tab with a different Profile type form for updates on the current job. And I have another profile form for employee applications which are a separate user role. The emails I receive from this script seems to contain the same data as the New User Notification, which uses the same {submitted_registration}? I would like the output of the primary “Profile” form.

    I am waaaay out of my depth here, so forgive if it doesn’t make sense. Am I doing this all wrong? TIA

    @lindsaylovespets

    This code snippet can not solve your profile form issue as it depends only on the Registration form fields.

    Thread Starter lindsaylovespets

    (@lindsaylovespets)

    I see. So it seems a “profile” in this case is determined purely by what is submitted during registration, and not during the form creation process (registration/profile/login)? Then it would seem to get what I want I need to include these fields in the registration form somehow. Is there a way to hide/not display these fields on the initial form?

    @lindsaylovespets

    I can make this merge of your Profile form with the Registration form in the code snippet each time a Profile form is updated.

    This will give you the updated Profile form values and still with the {submitted_registration} placeholder and also pointing at which Profile form was updated.

    UM is using the current form for displaying submitted form values so Registration values will be excluded in the email this time.

    Wait for code snippet version 2.0.

    • This reply was modified 2 years, 2 months ago by missveronica.
    • This reply was modified 2 years, 2 months ago by missveronica.
    • This reply was modified 2 years, 2 months ago by missveronica.

    @lindsaylovespets

    Now you can download version 2.0 of the code snippet and replace the old one.
    No changes are required in the email template setup.

    https://github.com/MissVeronica/UM-Admin-User-Profile-Update-Email

    Thread Starter lindsaylovespets

    (@lindsaylovespets)

    @missveronicatv You are the best – I really appreciate you helping with this!!! That would absolutely solve my problem. I added the code and got:

    The snippet has been deactivated due to an error on line 13:

    Cannot redeclare function custom_profile_is_updated_email_backend.

    @lindsaylovespets

    You have not removed all of the old code snippet.

    Thread Starter lindsaylovespets

    (@lindsaylovespets)

    OH MY GAWD, @missveronicatv you are AMAZING!!!!
    Thank you thank you thank you!!!

    I don’t know how you did this but it’s doing what I asked for!! I’m still getting new registration emails, and now I also get emails and contents whenever my most important form is updated.

    I’m so happy I could cry. ?? I wish I could buy you a drink!

    Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Thanks for letting us know how you’ve resolved the issue with the above solutions.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Send email with form contents on form submission’ is closed to new replies.