• Resolved celinehag

    (@celinehag)


    Topic says it all. How would I go about adding an admin notification mail triggered e.g. when a new user checks custom checkbox in the registration form?

    There is a hook “um_registration_complete” that might be useful for this. But how to evalute registration fields and send mails based on conditions?

    Thanks for pointers or code samples.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @celinehag

    You can try this tutorial on how to create a custom notification.

    Here’s an example on how to validate the submitted checkbox values:

    add_action("um_registration_complete","um_061521_evaluate_checkbox", 1, 2 );
    function um_061521_evaluate_checkbox( $user_id, $args ){
        
        // evaluate_checkbox is the checkbox field name
        if( in_array( $args['evaluate_checkbox'], ['Apple','Banana'] ) ){
            
            UM()->mail()->send( $recipient, 'email_template_apple_banana', array(
                        'plain_text'	 => 1,
                        'tags'				 => array(
                            '{profile_name}',
                            '{profile_url}',
                        ),
                        'tags_replace' => array(
                            $profile_name,
                            $profile_url,
                        )
            ) );
        }
    }

    It’s not a working sample but this gives you an idea with the tutorial in the link and with the above code snippets.

    Regards,

    • This reply was modified 3 years, 5 months ago by Champ Camba.
    Thread Starter celinehag

    (@celinehag)

    Hi @champsupertramp,
    Nice, thanks for the pointers. Will try to work it out. I’ll post my solution here in case I manage to make it work.
    Best, Hagbard

    • This reply was modified 3 years, 5 months ago by celinehag.
    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hey there!

    This thread has been inactive for a while so we’re going to go ahead and mark it Resolved.

    Please feel free to re-open this thread by changing the Topic Status to ‘Not Resolved’ if any other questions come up and we’d be happy to help. ??

    Regards,

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Send Admin Notifaction based on Custom Field Value in Registration Form’ is closed to new replies.