Simple Membership Plugin › Forums › Simple Membership Plugin › display members on web page
Tagged: user list
- This topic has 6 replies, 3 voices, and was last updated 10 years, 3 months ago by
mbrsolution.
-
AuthorPosts
-
September 4, 2016 at 12:09 am #8126
vjblair
ParticipantHow do I set up a web page to display all members with their name, email, address and phone numbers?
September 4, 2016 at 10:12 am #8140mbrsolution
ModeratorHi, unfortunately at present that is not available in the plugin.
Regards
September 5, 2016 at 10:42 am #8150Anonymous
InactiveHi I needed that too for my website and using that now
<table class="community table table-striped"> <thead> <tr> <td> PIC: </td> <td> FIRST NAME: </td> <td> LAST NAME: </td> <td> E-Mail: </td> </tr> </thead> <?php if ( is_front_page() && SwpmMemberUtils::is_member_logged_in() ) { echo get_page_by_title( '_USERHome' )->post_content; } else { for ($i = 1; $i <= 4; $i++) { $member_id = $i; $field_name = 'first_name'; $fname_value = SwpmMemberUtils::get_member_field_by_id($member_id, $field_name); $field_name = 'last_name'; $lname_value = SwpmMemberUtils::get_member_field_by_id($member_id, $field_name); $field_name = 'email'; $email_value = SwpmMemberUtils::get_member_field_by_id($member_id, $field_name); $field_name = 'membership_level'; $user_role = SwpmMemberUtils::get_member_field_by_id($member_id, $field_name); $role = 'user_role_' . $user_role; echo "<tr class=\"" . $member_id . "\">"; echo "<td class=\"round_img " . $role ."\">" . get_avatar( $email_value ) . "</td>"; echo "<td>" . $fname_value . "</td>"; echo "<td>" . $lname_value . "</td>"; echo "<td>" . $email_value . "</td>"; echo "</tr>"; }} ?> </table>unfortunatly i am struggeling with the row count in the user table…
September 5, 2016 at 11:09 am #8151Anonymous
InactiveUPDATE: (Sorry couldnt find an edit button)
<table class="community table table-striped"> <thead> <tr> <td> PIC: </td> <td> FIRST NAME: </td> <td> LAST NAME: </td> <td> E-Mail: </td> </tr> </thead> <?php if ( is_front_page() && SwpmMemberUtils::is_member_logged_in() ) { echo get_page_by_title( 'Logged in Home' )->post_content; } else { $user_count = $wpdb->get_var( "SELECT COUNT(*) FROM DATABASE_TABLE" ); // Change DATABASE_TABLE to the users table should end with swpm_members_tbl for ($i = 1; $i <= $user_count; $i++) { $member_id = $i; $field_name = 'first_name'; $fname_value = SwpmMemberUtils::get_member_field_by_id($member_id, $field_name); $field_name = 'last_name'; $lname_value = SwpmMemberUtils::get_member_field_by_id($member_id, $field_name); $field_name = 'email'; $email_value = SwpmMemberUtils::get_member_field_by_id($member_id, $field_name); $field_name = 'membership_level'; $user_role = SwpmMemberUtils::get_member_field_by_id($member_id, $field_name); $role = 'user_role_' . $user_role; echo "<tr class=\"" . $member_id . "\">"; echo "<td class=\"round_img " . $role ."\">" . get_avatar( $email_value ) . "</td>"; echo "<td>" . $fname_value . "</td>"; echo "<td>" . $lname_value . "</td>"; echo "<td>" . $email_value . "</td>"; echo "</tr>"; }} ?> </table>September 5, 2016 at 10:05 pm #8154mbrsolution
Moderator@bknakcy is the code you are sharing above working for you? If it is, thank you for sharing your code here. I am sure many who wants to achieve the same results, will use your code to display their members in a page.
September 6, 2016 at 9:19 am #8158Anonymous
InactiveIt works for me and only reeds out the members registered to the plugin.
First I had some trouble with displaying the avatar of the users but had to fix it with getting avatar by email because it used the get_avatar used the ID of all wordpress users.I don’t know how to make a plugin so people could just insert a shortcode. If someone knows feel free to do it 🙂
September 6, 2016 at 10:09 pm #8160mbrsolution
Moderator@bknakcy thank you for the feedback. I have submitted a message to the plugin developers to investigate further your code and see if they can use it in a plugin/add-on.
Regards
-
AuthorPosts
- You must be logged in to reply to this topic.