-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #208 from ipokkel/email-confirm-column-4-approvals
Add email confirmation status column
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/** | ||
* This recipe adds an "Email Confirmation" column to the Approvals admin screen when using PMPro Approvals. | ||
* | ||
* The recipe assumes the Email Confirmation Add On is active. | ||
* | ||
* title: Add Email Confirmation status to Approvals admin screen. | ||
* layout: snippet | ||
* collection: add-ons | ||
* category: pmpro-approvals, pmpro-email-confirmation | ||
* | ||
* 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' ); |