bbp_notice_edit_user_pending_email()

Display pending email change notice on user edit page


Description Description


Source Source

File: includes/users/template.php

function bbp_notice_edit_user_pending_email() {

	// Bail if not on users own profile
	if ( ! bbp_is_user_home_edit() ) {
		return;
	}

	// Check for pending email address change
	$user_id   = bbp_get_displayed_user_id();
	$key       = '_new_email';
	$new_email = get_user_meta( $user_id, $key, true );

	// Bail if no pending email address change
	if ( empty( $new_email['newemail'] ) ) {
		return;
	}

	// Build the nonced URL to dismiss the pending change
	$user_url = bbp_get_user_profile_edit_url( $user_id );
	$nonce    = "dismiss-{$user_id}{$key}";
	$args     = array(
		'action'  => 'bbp-update-user-email',
		'dismiss' => "{$user_id}{$key}"
	);

	// Build the variables to pass into printf()
	$dismiss_url  = wp_nonce_url( add_query_arg( $args, $user_url ), $nonce );
	$dismiss_link = '<a href="' . esc_url( $dismiss_url ) . '">' . esc_html_x( 'Cancel', 'Dismiss pending user email address change', 'bbpress' ) . '</a>';
	$coded_email  = '<code>' . esc_html( $new_email['newemail'] ) . '</code>'; ?>

	<div class="bbp-template-notice info">
		<ul>
			<li><?php printf( esc_html__( 'There is a pending email address change to %1$s. %2$s', 'bbpress' ), $coded_email, $dismiss_link ); ?></li>
		</ul>
	</div>

	<?php
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.