Last active
October 29, 2024 14:29
-
-
Save ipokkel/6fe0fd4c7d93333f1311b8c19107215d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add an "Email Confirmation" column to the Approvals List. | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
// Add column header | |
function my_pmpro_approvals_list_extra_cols_header_email_confirmation( $the_user ) { | |
?> | |
<th><?php esc_html_e( 'Email Confirmation', 'pmpro-email-confirmation' ); ?></th> | |
<?php | |
} | |
add_action( 'pmpro_approvals_list_extra_cols_header', 'my_pmpro_approvals_list_extra_cols_header_email_confirmation' ); | |
// Add column body | |
function my_pmpro_approvals_list_extra_cols_body_email_confirmation( $the_user ) { | |
?> | |
<td> | |
<?php | |
$email_confirmation_key = get_user_meta( $the_user->ID, 'pmpro_email_confirmation_key', true ); | |
if ( empty( $email_confirmation_key ) ) { | |
esc_html_e( 'Not requested' ); | |
} elseif ( 'validated' == $email_confirmation_key ) { | |
esc_html_e( 'Validated' ); | |
} else { | |
esc_html_e( 'Not validated' ); | |
} | |
?> | |
</td> | |
<?php | |
} | |
add_action( 'pmpro_approvals_list_extra_cols_body', 'my_pmpro_approvals_list_extra_cols_body_email_confirmation' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment