Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › Display Member Count
- This topic has 11 replies, 4 voices, and was last updated 11 years, 1 month ago by admin.
-
AuthorPosts
-
February 26, 2011 at 2:09 am #2816derixcMember
Hi again.
Is there a shortcode or php code to display the current number of members?
February 27, 2011 at 12:25 am #29522amin007ParticipantThere is no shortcode but you can use the following code to retrieve the total member count
global $wpdb;
$members_table_name = $wpdb->prefix . "wp_eMember_members_tbl";
$wp_member_count = $wpdb->get_row("SELECT count(*) as count FROM $members_table_name");
$total_number_of_members = $wp_member_count->count;February 27, 2011 at 3:31 am #29523derixcMemberThank you for providing me these codes though I’m not quite sure how to use it but do you think there is a good chance of having it up in the future?
I think it adds more credibility to the site if they know how many members are up there already.
February 27, 2011 at 3:40 am #29524amin007ParticipantYeah it shouldn’t be hard to add in a shortcode that displays the total number of members. I will add it in.
February 27, 2011 at 5:12 am #29525derixcMemberGreat. Thanks a lot. looking forward into this.
February 28, 2011 at 2:37 am #29526amin007ParticipantActually I forgot that such a shortcode already exists.
Use the following shortcode to show a total member count:
[wp_eMember_total_members]
February 28, 2011 at 5:21 am #29527derixcMemberThanks. I was able to test it on page and it works.
I tried using this <?php echo print_eMember_total_memebers(); ?> for my sidebar but getting error.
What would be the correct php code for the sidebar?
February 28, 2011 at 5:42 am #29528amin007ParticipantThe correct function to call is:
<?php echo emember_get_total_members(); ?>
February 28, 2011 at 5:49 am #29529derixcMemberGREAT! it’s now live on my site. thanks a lot. The support here is absolutely fantastic.
February 21, 2012 at 5:14 pm #29530reepsyMemberBoth
<?php echo emember_get_total_members(); ?>
and [emember_total_memebers] bring back teh total number of all memberships, as the names would imply. I am trying to make a goal meter showing progress towards selling xx memberhips at a specific membership level. So let’s say id=3. Any suggestions?February 21, 2012 at 6:19 pm #29531reepsyMemberThis will work if you are interest in just the one level like I am (Level ID 3 in this example):
function paid_membership_count() {
global $wpdb;
$members_table_name = $wpdb->prefix . "wp_eMember_members_tbl";
$wp_member_count = $wpdb->get_row("SELECT count(*) as count FROM $members_table_name WHERE membership_level='3'");
$total_number_of_members = $wp_member_count->count;
}
add_shortcode( 'paid_membership_count', 'paid_membership_count' );So you use it like any shortcode: [paid_membership_count]
But you could easily parameritize it to do any specific level passed in as an attribute:
[paid_membership_count level=’3′]
October 7, 2013 at 11:38 pm #29532adminKeymasterWe expanded our existing shortcode so you can get a total member count from a particular membership level.
The following shortcode will give you a count of all the members from level 2:
[wp_eMember_total_members level="2"]
-
AuthorPosts
- You must be logged in to reply to this topic.