• Resolved Giray

    (@giray)


    Hi. Is there a way to automatically create an email or forwarder upon the user’s successful registration on the WordPress site. Otherwise, is there a way for the user to auto-generate a forwarder? I’m trying to avoid having to manually intervene.

    Thanks for doing this!! Much needed for some of us!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Knut Sparhell

    (@knutsp)

    Yes, most methods of the UAPI class are public static ones. To hook into the registration, or user cration, process, use

    add_action( 'user_register', static function( int $user_id, array $userdata ): void {
    // What to do after reg. here, like:

    if ( method_exists( 'WebFacing\cPanel\UAPI', 'add_forwarder' ) ) {
    \WebFacing\cPanel\UAPI::add_forwarder( '[email protected], '$userdata['user_email'] );
    }
    } );

    See all public static methods in includes/UAPI.php from line 175, or from line 328 for the add_* functions.

    Your code must go into a custom plugin, a child theme functions.php or as a snippet.

    Plugin Author Knut Sparhell

    (@knutsp)

    Let last line be
    }, 2 );
    to avoid ArgumentCountError.

    Thread Starter Giray

    (@giray)

    Thank you so so much. This is going to be great. Will implement in a few weeks when the new site is up. Wonderful.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Auto create on registration’ is closed to new replies.