Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Coop920/c871e4154ba1c514f2f64524a9617cc3 to your computer and use it in GitHub Desktop.
Save Coop920/c871e4154ba1c514f2f64524a9617cc3 to your computer and use it in GitHub Desktop.
if ( $bnfw->notifier->notification_exists( 'new-user', false ) ) {
$notifications = $bnfw->notifier->get_notifications( 'new-user' );
$password_url = '<a href="'.network_site_url( 'password/?somresetpass=true&somfrp_action=rp&key==' . $key . '&uid=' . rawurlencode( $user->ID ), 'login' ).'" target="_blank">'.network_site_url( 'password/?somresetpass=true&somfrp_action=rp&key==' . $key . '&uid=' . rawurlencode( $user->ID ), 'login' ).'</a>';
foreach ( $notifications as $notification ) {
$setting = $bnfw->notifier->read_settings( $notification->ID );
$trigger_notification = apply_filters( 'bnfw_trigger_new-user_notification', true, $setting, $user );
if ( $trigger_notification ) {
$bnfw->engine->send_registration_email( $setting, $user, $password_url );
}
}
} elseif ( $bnfw->notifier->notification_exists( 'user-password', false ) ) {
$notifications = $bnfw->notifier->get_notifications( 'user-password' );
$password_reset_link = '<a href="'.network_site_url( 'password/?somresetpass=true&somfrp_action=rp&key==' . $key . '&uid=' . rawurlencode( $user->ID ), 'login' ).'" target="_blank">'.network_site_url( 'password/?somresetpass=true&somfrp_action=rp&key==' . $key . '&uid=' . rawurlencode( $user->ID ), 'login' ).'</a>';
foreach ( $notifications as $notification ) {
$setting = $bnfw->notifier->read_settings( $notification->ID );
$trigger_notification = apply_filters( 'bnfw_trigger_new-user_notification', true, $setting, $user );
if ( $trigger_notification ) {
$bnfw->engine->send_registration_email( $setting, $user, $password_reset_link );
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment