diff --git a/includes/core/class-permalinks.php b/includes/core/class-permalinks.php index d930ab25..776baf6f 100644 --- a/includes/core/class-permalinks.php +++ b/includes/core/class-permalinks.php @@ -27,12 +27,14 @@ if ( ! class_exists( 'um\core\Permalinks' ) ) { * Permalinks constructor. */ public function __construct() { - add_action( 'init', array( &$this, 'set_current_url' ), 0 ); + add_action( 'init', array( &$this, 'set_current_url' ), 0 ); - add_action( 'init', array( &$this, 'check_for_querystrings' ), 1 ); + add_action( 'init', array( &$this, 'check_for_querystrings' ), 1 ); // don't use lower than 2 priority because there is sending email inside, but Action Scheduler is init on 1st priority. - add_action( 'init', array( &$this, 'activate_account_via_email_link' ), 2 ); + add_action( 'init', array( &$this, 'activate_account_via_email_link' ), 2 ); + // Approve the user after the activate account link is verified. + add_action( 'um_approve_user_on_email_confirmation', array( &$this, 'approve_user_on_email_confirmation' ) ); } /** @@ -135,9 +137,25 @@ if ( ! class_exists( 'um\core\Permalinks' ) ) { } // Activate account link is valid. Can be approved below. - - um_fetch_user( $user_id ); // @todo maybe don't need to fetch. - UM()->common()->users()->approve( $user_id, true ); + /** + * Fires for user activation after validation the link for email confirmation. + * + * Internal Ultimate Member callbacks (Priority -> Callback name -> Excerpt): + * 10 - `UM()->permalinks()->approve_user_on_email_confirmation()` Approve the user after the activate account link is verified. + * + * @hook um_approve_user_on_email_confirmation + * + * @param {int} $user_id The user ID. + * + * @since 2.11.2 + * + * @example