• Resolved Nikos Kavvadas

    (@nikoslefkas)


    Hello there,
    In this website https://museumfinder.gr/ I am using the Listeo directory theme.

    In listings page, Listeo using by default the Contact Form 7, so the users can send a message to the listing owner email address.

    In contact for 7 settings in the field of recipient email address, the Listeo developers they use this shortcode: [custom-post-author-email-shortcode] so the message will be sent to the listing owner email address.

    Check here a listing example: https://museumfinder.gr/listing/mouseio-marmarotechnias-tinou/

    However, since no other plugin is better than Forminator, I want to avoid using Contact Form 7 and use Forminator for this purpose.

    Can you please tell if it possible to use the Grate Forminator with this shortcode or with an other modification to do the job?

    Thank you!
    Nikos

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

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Support Dmytro – WPMU DEV Support

    (@wpmudevsupport16)

    Hello Nikos,

    There is no such option or shortcode in Forminator out of the box.

    Could you please test it with this PHP code snippet as a workaround:
    https://gist.github.com/wpmudev-sls/ce692035e4eb0efbdb551ad1a37929df

    – download, and rename it to a PHP file, for example: wpmudev-forminator-listing-author.php

    Upload the saved file to /wp-content/mu-plugins/ directory, so that it runs as a must use plugin.

    It should be adding the listing author to the email notification recipients.

    You’ll need to create an email notification in the form (use your admin email address, if you’d like to see that the form was submitted):
    https://prnt.sc/DH_VcKN8Vo26

    and then the email notification will be also sent to the listing author email on submit.

    Hope this helps. Please let us know if you have any questions.

    Best Regards,
    Dmytro

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @nikoslefkas

    We didn’t hear back from you for quite some time already so I’m marking this topic as resolved.

    But if you have any additional questions about the issue, let us know and we can get back to it.

    Best regards,
    Adam

    Thread Starter Nikos Kavvadas

    (@nikoslefkas)

    Hi there!

    I must thank you for your time and for being willing to help me.

    I tried the solution that you suggested to me and I must say that you are very close to solving the issue.

    So, now when a user uses the Forminator to contact with owner, actually a message is sent to the owner’s email! That is great!

    But please note this: In Listeo theme there is an email field in the listing add form, so the Contact Form 7 with this shortcode [custom-post-author-email-shortcode] send the users message to this email and not to the owner registration email.

    For example, when an owner registers on a website that uses the Listeo theme, and he use for his registration this email “[email protected]” and when he creates his listing in the email field he adds the “[email protected]”. Now when a user submits a message thought the Contact Form 7, the message will be sent to the “[email protected]” and not to “[email protected]”.

    Now with Forminator, in the above example, the message will be sent to “[email protected]

    Is it possible to change this so the messages will be sent to the “[email protected]” ?

    Thank you in advanced.

    Forminator for Ever!

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @nikoslefkas

    Thank you for response and additional information!

    I’m glad we could help so far. I think that it should be rather easy to fix that to use different e-mail address and it all comes down to a slight modification of this line of code

    $recipients[] = get_the_author_meta( 'user_email', get_post_field( 'post_author', $listing_id ) );

    However, the problem here is that we need to know where/how exactly that e-mail is stored in DB. I suppose it’s either some additional user profile field or a post custom meta. Unfortunately, the theme that you are using is a 3rd-party premium theme and we don’t have any access to it to test it and no knowledge of its code.

    Do you know where/how exactly that correct e-mail is stored in DB or would you be able to check it? Is it user meta data or a custom field of the listing post (post meta) and what is the name (as in DB) of it?

    Kind regards,
    Adam

    Thread Starter Nikos Kavvadas

    (@nikoslefkas)

    Hi Adam!

    I greatly appreciate your help!

    I asked from the Listeo theme developer team to help me, so when I get a reply from them, I will write you here.

    Thanks again!
    Nikos

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @nikoslefkas

    That’s great, just let us know once you get response and we’ll look into it again.

    Best regards,
    Adam

    Thread Starter Nikos Kavvadas

    (@nikoslefkas)

    Hi Adam!

    Here is the answer that they send me:

    we first check if the listing the form is displayed on has a custom post meta field with ID _email, if it’s empty we use the standard WordPress user_email from usermeta

    Is that helpful for you?

    Best regards,
    Nikos

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @nikoslefkas

    Thanks for response!

    Assuming that this information is correct, I think following modification of the custom code (that we shared earlier) should do the trick:

    replace this specific line

    $recipients[] = get_the_author_meta( 'user_email', get_post_field( 'post_author', $listing_id ) );

    with this code

    $umail = '';
    $umail = get_user_meta( get_post_field( 'post_author', $listing_id ), ' _email', true );
    if ( empty( $umail ) ) {
    	$umail = get_the_author_meta( 'user_email', get_post_field( 'post_author', $listing_id ) );
    }
    
    $recipients[] = $umail;

    Best regards,
    Adam

    Thread Starter Nikos Kavvadas

    (@nikoslefkas)

    Hi Adam!

    Firstly, I want to thank you for your time and your help.

    I made the change as you wrote to me.

    I tried again, but unfortunately the message goes to the user registration email once more as before and not to listing contact email.

    Can you please check this screenshot and see if I made the change correctly, https://freeimage.host/i/d3gHisj ?

    Thank you, once again!
    Nikos

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @nikoslefkas,

    Could you please try updating the following function in your code ie from:

    function wpmudev_forminator_author_email( $recipients, $notification, $data, $custom_form, $entry ){


    if( isset( $data['page_id'] ) ){
    $listing_id = $data['page_id'];
    }else{
    $listing_id = url_to_postid( wp_get_referer() );
    if( !isset( $listing_id ) ) return $recipients;
    }

    // Add post author email to recipients
    $recipients[] = get_the_author_meta( 'user_email', get_post_field( 'post_author', $listing_id ) );

    return $recipients;


    }

    To:

            function wpmudev_forminator_author_email( $recipients, $notification, $data, $custom_form, $entry ) {

    if ( isset( $data['page_id'] ) ) {
    $listing_id = $data['page_id'];
    } else {
    $listing_id = url_to_postid( wp_get_referer() );
    if ( ! isset( $listing_id ) ) return $recipients;
    }

    $listing_email = get_post_meta( $listing_id, '_email', true );

    if ( ! empty( $listing_email ) ) {
    $recipients[] = $listing_email;
    } else {

    $recipients[] = get_the_author_meta( 'user_email', get_post_field( 'post_author', $listing_id ) );
    }

    return $recipients;
    }

    and then check whether it works fine?

    Please do let us know how that goes.

    Kind Regards,

    Nithin

    Thread Starter Nikos Kavvadas

    (@nikoslefkas)

    Nithin and Adam you are simple the best!

    Yes, now it’s working fine!

    Thank so so so so much!

    Forminator and WPMU DEV Support Team is the BEST!

    Thanks again!
    Nikos

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Use Forminator instead of Contact Form 7 in Listeo theme’ is closed to new replies.