• Resolved charliemartin89

    (@charliemartin89)


    This is such a brilliant plugin, thank you for all your efforts in building it.

    I have multiple posts on my site that each have a unique submission form. I need to find a way to redirect form submissions to unique ‘thank you’ pages for each form.

    I’ve read some details on how to redirect to a standard, uniform page but need to be able to redirect successful submissions to unique pages.

    Is this something you can help with?

    Many, many thanks in advance,

    Charlie

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

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Gemini Labs

    (@geminilabs)

    Try this:

    1. Use the Custom Fields metabox to add a custom field to your page. Set the key to “redirect_to” and the value to the URL you want to redirect to.
    2. Add the following code to your theme’s functions.php file.

    /**
     * Redirect the page on a successful submission if the "redirect_to" meta_value is set on the page
     * Paste this in your active theme's functions.php file.
     * @return void
     */
    add_action( 'site-reviews/local/review/submitted', function() {
        $referer = trim( get_post_meta( intval( get_the_ID() ), 'redirect_to', true ));
        if( empty( $referer ))return;
        wp_safe_redirect( $referer );
        exit;
    });
    • This reply was modified 5 years, 8 months ago by Gemini Labs.
    Thread Starter charliemartin89

    (@charliemartin89)

    Hi, thanks for getting back to me so quickly.

    I carried out your instructions but am still just getting the on-page ‘thank you for submitting your review’ message.

    The post I added the custom field to is – https://ratednetworking.co.uk/plymouth/bucks-biz/

    And I want it to redirect to this post – https://ratednetworking.co.uk/referral/bucks-biz-referral/

    Any further ideas?

    Thank you for looking at this

    Plugin Author Gemini Labs

    (@geminilabs)

    @charliemartin89

    Sorry you are correct. It doesn’t work because get_the_ID() won’t work here.

    This can only easily be done if you are using the assign_to attribute in the shortcode to automatically assign reviews to a page. Otherwise you may have to wait until v3.0 is released which provides this option.

    i.e. [site_reviews_form assign_to=13]

    If you are doing it this way, then all you have to do is add the Custom Field meta to the assigned page (in the example above, the assigned page is the one that has a WordPress ID of “13”), and then change the code I provided earlier to this:

    /**
     * Redirect the page on a successful submission if the "redirect_to" meta_value is set on the assigned page of the review
     * Paste this in your active theme's functions.php file.
     * @return void
     */
    add_action( 'site-reviews/local/review/submitted', function( $deprecated, $command ) {
        $referer = trim( get_post_meta( intval( $command->assignedTo ), 'redirect_to', true ));
        if( empty( $referer ))return;
        wp_safe_redirect( $referer );
        exit;
    }, 10, 2 );

    OH…and you will also have to add the “no-ajax” class to the shortcode!

    i.e. [site_reviews_form assign_to=post_id class=no-ajax]

    The only caveat to this is that you will also have to disable the reCAPTCHA option if you use the “no-ajax” class.

    Let me know if that works.

    • This reply was modified 5 years, 8 months ago by Gemini Labs.
    • This reply was modified 5 years, 8 months ago by Gemini Labs.
    • This reply was modified 5 years, 8 months ago by Gemini Labs.
    • This reply was modified 5 years, 8 months ago by Gemini Labs.
    • This reply was modified 5 years, 8 months ago by Gemini Labs.
    • This reply was modified 5 years, 8 months ago by Gemini Labs.
    • This reply was modified 5 years, 8 months ago by Gemini Labs.
    Plugin Author Gemini Labs

    (@geminilabs)

    Thread Starter charliemartin89

    (@charliemartin89)

    I’ve followed those steps and a few interesting things happen:

    1. When one hits the submit review button, the page doesn’t redirect but neither does the success message appear – the load icons appears and nothing happens (although the review does register in the backend)

    2. Having set the shortcode to hide email, title and the ‘this is my honest experience’ tickbox – they now all show (original shortcode: [site_reviews_form assign_to=”post_id” hide=”email,terms,title”class=”no-ajax”])

    Note: Custom Field – (Name: redirect_to, Value: https://ratednetworking.co.uk/referral/bucks-biz-referral/)

    Any further ideas? And out of interest, when does V3 come out?

    Thanks again for all your help,

    Plugin Author Gemini Labs

    (@geminilabs)

    You have your shortcode like this:

    [site_reviews_form assign_to=”post_id” hide=”email,terms,title”class=”no-ajax”]

    It should be like this:

    [site_reviews_form assign_to=”post_id” hide=”email,terms,title” class=”no-ajax”]

    Notice the difference? You need to make sure there is a space between each shortcode attribute/option. Both of the issues above are happening because you are missing the space between the “hide” attribute and the “class” attribute.

    You can also write it like this:

    [site_reviews_form assign_to=post_id hide=email,terms,title class=no-ajax]

    • This reply was modified 5 years, 8 months ago by Gemini Labs.
    • This reply was modified 5 years, 8 months ago by Gemini Labs.
    • This reply was modified 5 years, 8 months ago by Gemini Labs.
    • This reply was modified 5 years, 8 months ago by Gemini Labs.
    Thread Starter charliemartin89

    (@charliemartin89)

    Awesome, thank you – it appears to be working now.

    Interesting, the non ” version works but other doesn’t?

    Strange but all is well that ends well – thanks again for your help

    Plugin Author Gemini Labs

    (@geminilabs)

    The reason it didn’t work for you is because yours was like this:

    hide="email,terms,title"class="no-ajax"

    Instead of this:

    hide="email,terms,title" class="no-ajax"

    Or possibly, maybe you pasted the shortcode and WordPress converted reqular quotes to “smart” curly quotes.

    Anyhow, glad it’s working for you!

    Thread Starter charliemartin89

    (@charliemartin89)

    Ah, I see – awesome buddy, thank you.

    One other thing, I’ve just tested a new review on this page – https://ratednetworking.co.uk/exeter/businessbreakfast/

    When I’m logged in, I can see the new review in the feed and the summary has updated but when logged out, the review isn’t registering – is it normal for there to be a delay? Or is there something fundamentally not working?

    Many thanks again,

    Plugin Author Gemini Labs

    (@geminilabs)

    I’m sorry but I don’t really understand the question. If a review is submitted without a page reload (with javascript), the new review will not appear on the page until you refresh/reload the page.

    If the review summary is not updating after new reviews have been submitted, please check whether you are using the category, assign_to, or assigned_to options on the shortcodes as these determine which review ratings are used in the summary calculations.

    if you use the assigned_to option on either the [site_reviews] or [site_reviews_summary] shortcodes, make sure you are also using the assign_to option on the [site_reviews_form] shortcode. These options work together.

    The same goes for the category option. If you use this, make sure it is also used on the other shortcodes that you want to connect to each other.

    For example:

    [site_reviews_form assign_to=post_id]
    [site_reviews_summary assigned_to=post_id]
    [site_reviews assigned_to=post_id]

    OR

    [site_reviews_form category=13]
    [site_reviews_summary category=13]
    [site_reviews category=13]
    • This reply was modified 5 years, 8 months ago by Gemini Labs.
    • This reply was modified 5 years, 8 months ago by Gemini Labs.
    • This reply was modified 5 years, 8 months ago by Gemini Labs.
    • This reply was modified 5 years, 8 months ago by Gemini Labs.
    • This reply was modified 5 years, 8 months ago by Gemini Labs.
    • This reply was modified 5 years, 8 months ago by Gemini Labs.
    • This reply was modified 5 years, 8 months ago by Gemini Labs.
    Thread Starter charliemartin89

    (@charliemartin89)

    It’s okay, it was just a slight delay before the review showed up on the site.

    It’s all looking fine – thanks again buddy.

    Any idea when V3 will be coming out?

    Cheers,

    Plugin Author Gemini Labs

    (@geminilabs)

    Hopefully before end of month.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Unique page re-directs after form submission’ is closed to new replies.