Add Action to a hustle button

Is there a way to add an action to a hustle opt in form button? I would like the user to be taken to another page on submission….

Bradley

  • Rupok
    • Support Ninja

    Hi Bradley,

    Thanks for asking. I’m afraid, there is no native way to redirect your users to another page when they click on the “Sign Up” button. But you can do this by creating a MU Plugin. For creating a MU Plugin, create a folder named “mu-plugins” inside your “wp-content” folder. Then inside that “mu-plugins” folder, create a file with any name and with a .php extension. Now paste the code inside that file and save.

    <?php
    add_action( 'wp_footer', 'hustle_submit_redirect' );
    function hustle_submit_redirect() {
    ?>
    <script type="text/javascript">
    jQuery(document).ready(function() {
    jQuery(".wpoi-subscribe-send").click(function() {
    window.location = "http://google.com";
    });
    });
    </script>
    <?php
    }

    For getting more idea on mu plugins, you can go through this article: http://premium.wpmudev.org/manuals/wpmu-manual-2/using-mu-plugins/

    Please let us know if this doesn’t work of if you have any confusion. We will be glad to help.

    Have a nice day. Cheers!

    Rupok

  • Simon
    • Flash Drive

    Ok got it working, however it seems to be a macism. I’m using a mac and using mountainduck to mount the remote server folders.

    When I created the *.php file, I noticed a load of apple gumph to the top of the page. Turns out the mac had created a hidden file with a php extension which was some sort of backup file.

    My colleague on a Windows machine saw this, deleted it and it worked fine!

  • Rupok
    • Support Ninja

    Hi Bradley,

    if I could just get my js mautic form fields into it

    I’m afraid, you can’t add any additional form or fields in your Hustle popup. But you can always show your custom form in a PopUp with our PopUp Pro plugin. And if you need to show both opt-in fields and your custom form, you can use Hustle Opt-in Shortcode and your custom form shortcode both in the same PopUp. You will get full usage guide of our PopUp plugin here: https://premium.wpmudev.org/project/the-pop-over-plugin/#product-usage

    Please let us know if you have any confusion. We will be glad to help.

    Have a nice day. Cheers!

    Rupok

  • Bradley
    • The Incredible Code Injector

    That’s what I ended up doing more or less. mautic allows you to post an html version form of the form anywhere so I just dropped it into pop up pro. It’s just that if you make changes to the form you have to update pp manually. Java script version of the form does not work which would change PP dynamically …

    B

  • Ricardo
    • WPMU DEV Initiate

    Hi WPMUDEV team,

    I did use this code and it worked… somehow, the problem I have is that I have a multisite setup in wordpress and now it uses the page that I told hustle to redirect to all hustle opt-ins. How can I assigne this code to a particular hustle opt-in?

    Thank you.

  • Rupok
    • Support Ninja

    Hi Ricardo,

    Thanks for asking. Actually each opt-in has it's own unique ID. Please check the attached screenshot for reference.

    You can easily trace your Opt-In ID with Firebug or Chrome Dev Tools

    So instead of the previous code, you can use that code in the following way:

    <?php
    add_action( 'wp_footer', 'hustle_submit_redirect' );
    function hustle_submit_redirect() {
    ?>
    <script type="text/javascript">
    jQuery(document).ready(function() {

    // Code for Opt-In with ID 1
    jQuery(".inc_optin_1 .wpoi-subscribe-send").click(function() {
    window.location = "http://google.com";
    });

    // Code for Opt-In with ID 2
    jQuery(".inc_optin_2 .wpoi-subscribe-send").click(function() {
    window.location = "http://microsoft.com";
    });

    // Code for Opt-In with ID 3
    jQuery(".inc_optin_3 .wpoi-subscribe-send").click(function() {
    window.location = "http://bing.com";
    });

    });
    </script>
    <?php
    }

    You can add more blocks for more opt-ins in the way I shown above. I believe, this will resolve your issue.

    Please let us know if you have any further query. We will be glad to help.

    Have a nice day. Cheers!

    Rupok

  • Rupok
    • Support Ninja

    Hi helder,

    I’m sorry but I’m not sure if Hustle has any filter or function to override for redirecting to another URL on form submit. But I’ve already pinged our developer regarding this and I’ll update you as soon as I get something from him.

    Please keep in mind, our developers work round the clock and they have to deal with lots of critical issues and other things. So it may take a little while for them to check this and provide a feedback.

    Have a nice day. Cheers!

    Rupok

  • Rupok
    • Support Ninja

    Hi jetmac,

    That’s really a great idea IMHO. If more people like this idea, more chances that it will grab the attention of our developers and more chances that they will include this feature in our future releases. I also hope that it made it in our upcoming releases.

    I appreciate your feedback.

    Have a nice day. Cheers!

    Rupok

  • jetmac
    • Recruit

    Rupok ,

    Again, I don’t think this is a “if people request it” feature. It’s more of a “if we expect people to use and like it, we should do this” feature.

    It’s come up before – I do hope it was included in the upcoming release.

    I’ve said it before, and I’ll say it again – the gold standard for this kind of plugin is, IMO, SeedProd’s “Coming Soon Pro.” WPMU should adapt to popup/slide-ins what SeedProd did for landing pages. They got it right.

  • Rupok
    • Support Ninja

    Hi Bradley,

    So sorry for the inconvenience. As this is a different issue than the original post, can you please create a new thread regarding this issue? Having a single thread for any specific issue helps both you and us to track down the steps taken already and facilitates the troubleshooting process.

    Our awesome and super friendly Support Staffs will jump in very soon after you create your thread. I hope you understand.

    Have a nice day. Cheers!

    Rupok

  • jetmac
    • Recruit

    Team WPMU,

    I saw this feature did not make it into the big 2.0 update — is it planned for the next round?

    The ability to tailor the message button and direct where it goes is an extremely desirable feature, one present on competitor plugins. This is allowed in the Custom Content portion of the plugin, but not in the email-opt-in portion.

    If you haven’t already done so, please add it to the plugin roadmap — and soon.

    Thanks,

    Rob

  • Rupok
    • Support Ninja

    Hi Bill South,

    This should work with PopUp Opt-ins too if the proper selector is used. Can you please provide me your site URL where I can see your PopUp Opt-in and also let me know what exact code are you using?

    I’m looking forward to hearing from you and resolving this for you as soon as possible.

    Have a nice day. Cheers!

    Rupok

  • Bill South
    • Flash Drive

    Sorry for the late reply, unfortunately, I can't give you the URL as I am designing the site locally right now, here is a screenshot of the html though. The jQuery code I used is a simplified class just to see if it worked. It has to be something to with the modal because it works on page without the popup.

    <?php
    add_action( 'wp_footer', 'hustle_submit_redirect' );
    function hustle_submit_redirect() {
    ?>
    <script type="text/javascript">
    jQuery(document).ready(function() {
    jQuery(".wpoi-subscribe-send").click(function() {
    window.location = "http://localhost/designwws";
    });
    });
    </script>
    <?php
    }

    I also tried just adding the javascript to end of the body of the page without the hook, still no luck.

  • Kasia Swiderska
    • Support nomad

    Hello Bill,

    Code you have will work for popup that are triggered immediately, because their code is already there.

    But popups that are triggered by something else are not loading their code right away, but it is created “on the fly” by JS after trigger. So that should work:

    <?php

    add_action( 'wp_footer', 'hustle_submit_redirect' );
    function hustle_submit_redirect() {
    ?>
    <script type="text/javascript">
    jQuery(document).ready(function() {
    jQuery( document ).on( 'click', ".wpoi-subscribe-send", function( e ) {
    e.preventDefault();
    window.location = "http://localhost/designwws";
    });
    });
    </script>
    <?php
    }

    I tested that on my site and it works correctly.

    If you have further questions please contact our live support here https://premium.wpmudev.org/live-support/ so we will not annoy author of the thread with email notification that are not related anymore to their question.

    kind regards,

    Kasia

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.