PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Send email based on user login

  1. everfit
    Member

    I like the feature that allows you to choose who to send an email to based on certain crieria, but it only seems to work with drop down. I would like to send the email to a certain address based on the user login. Is this possible?

    Posted 11 years ago on Friday February 25, 2011 | Permalink
  2. This isn't currently possible using the Notifications interface. The Routing can send an email based on a drop down, radio button or checkbox field selection but not a user login.

    If you wanted to customize how this works you can do so via custom code and the use of api hooks.

    The hook to change the Send To address for the Admin Notification is gform_notification_email and here is an example of using it:

    <?php
    add_filter("gform_notification_email", "change_notification_email", 10, 2);
    function change_notification_email($email, $form){
       return "test@test.com";
    }
    ?>

    The hook to change the Send To address for the User Notification is gform_autoresponder_email and here is an example of using it:

    <?php
    add_filter("gform_autoresponder_email", "change_notification_email", 10, 2);
    function change_notification_email($email, $form){
       return "test@test.com";
    }
    ?>

    These examples don't do exactly what you want, you would have to customize them. You would have to write code to get the user who is logged in and then set it to return the email address appropriate to that user login.

    Posted 11 years ago on Friday February 25, 2011 | Permalink
  3. Carmello
    Member

    Carl, is it possible to customize the email response to the current logged in user for certain forms? For example.. I have a client portal where the client can fill out request forms and the logged in client gets notified by their user meta data but I don't want the autoresponder email hook to take over on the contact page for people that aren't logged in. Should I use conditional tags to target specific pages or should I use an "if then" statement to check if the user is logged in?

    Posted 10 years ago on Wednesday September 7, 2011 | Permalink
  4. Carmello
    Member

    I looked deeper into the autorepsonder email hook and figured out how to resolve the problem above. Without an email address in a form though the ui won't allow me to setup a user notification. The email is being generated by the autorepsonder email hook. Is there a way to fix this?

    Posted 10 years ago on Wednesday September 7, 2011 | Permalink
  5. @Carmellom I am going to close this topic and we'll address your issue in this thread:

    http://www.gravityhelp.com/forums/topic/user-notification-based-on-user-meta

    Posted 10 years ago on Wednesday September 7, 2011 | Permalink

This topic has been resolved and has been closed to new replies.