Created
March 3, 2020 20:12
-
-
Save ronalfy/4db4fee323149cc0caeb7df132483113 to your computer and use it in GitHub Desktop.
Paid Memberships Pro - List Sponsored (Child) Accounts in Directory Listing
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
<td> | |
<?php | |
// For use in a custom directory.php template after $auser has been defined. | |
$user_ids = pmprosm_getChildren( $auser->ID ); | |
if ( ! empty( $user_ids ) ) { | |
$user_list = new WP_User_Query( array( | |
'include' => $user_ids, | |
'orderby' => 'name', | |
'order' => 'ASC' | |
) ); | |
$sponsored_members = $user_list->get_results(); | |
if ( ! empty( $sponsored_members ) ) { | |
echo '<strong>Sponsored Members</strong>'; | |
echo '<ul>'; | |
foreach( $sponsored_members as $sponsored_member ) { | |
echo '<li>' . esc_html( $sponsored_member->data->display_name ) . '</li>'; | |
} | |
echo '</ul>'; | |
} | |
} | |
?> | |
</td> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment