Created
August 31, 2018 20:00
-
-
Save pbrocks/2bde6998e0533af2371bd20dea00e8c9 to your computer and use it in GitHub Desktop.
Add Company information from usermeta to PMPro Memberslist
This file contains hidden or 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 Company information from usermeta to PMPro Memberslist | |
* | |
*/ | |
// Add 'Company' Column to Members List Header | |
add_action( 'pmpro_memberslist_extra_cols_header', 'pmpro_add_company_to_memberslist_header' ); | |
// Add 'Company' Column to Members List Rows | |
add_action( 'pmpro_memberslist_extra_cols_body', 'pmpro_add_company_to_memberslist_body' ); | |
function pmpro_add_company_to_memberslist_header( $theusers ) { | |
?> | |
<th><?php _e( 'Company', 'paid-memberships-pro' ); ?></th> | |
<?php | |
} | |
function pmpro_add_company_to_memberslist_body( $theuser ) { | |
?> | |
<td> | |
<?php | |
if ( ! empty( $theuser->company ) ) { | |
echo $theuser->company; | |
} else { | |
echo '¯\_(ツ)_/¯'; | |
} | |
?> | |
</td> | |
<?php | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment