PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Limit the number of members...

Common Questions/Problems/Tips. Posted by Administrators & Support Reps.

Limit the number of members...

Postby ryannagy » May 30th, 2010, 12:15 am

I should probably try to figure this out before posting...BUT..I want to limit one of my membership levels to a certain number. For example, I may have a level that gets to have a monthly coaching webinar with me at $99 or something, but want to limit that group to 10 people (or similar).

Cheers - Ryan
User avatar
ryannagy
Registered User
Registered User
 
Posts: 68
Joined: May 18, 2010

Re: Limit the number of members...

Postby Elizabeth » June 2nd, 2010, 4:06 am

Thanks for the great suggestion. You might want to send an email directly to Jason for a quote:
http://www.primothemes.com/support/
User avatar
Elizabeth
Moderator
Moderator
 
Posts: 160
Joined: May 12, 2010

Re: Limit the number of members...

Postby Jason Caldwell » June 23rd, 2010, 8:16 pm

Hi, I don't think this is a feature that will make it into the official release of s2Member. It's a fairly uncommon request; from what I've seen. That being said, it's definitely do-able. You'll just need to wrap your Button Code inside Advanced Conditionals. You'll probably want to get a freelancer to help you with the scripting.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Limit the number of members...

Postby lmllewellyn » September 17th, 2011, 9:36 pm

Did anything ever come of this request? I would also like to limit my groups to 10 (or so) members.

Thanks,
Lisa
User avatar
lmllewellyn
Registered User
Registered User
 
Posts: 17
Joined: August 31, 2011

Re: Limit the number of members...

Postby antseo » September 18th, 2011, 1:18 am

I would be interested as well in this feature.
User avatar
antseo
Experienced User
Experienced User
 
Posts: 127
Joined: September 2, 2011

Re: Limit the number of members...

Postby Jason Caldwell » September 20th, 2011, 6:13 pm

Thanks for the votes on this feature.

Nothing integrated into s2Member in this regard yet. For now, I'll provide a code sample that you might find useful. In order to use this, you will need to have the PHP Execution plugin installed first, so that PHP tags are parsed in your Posts/Pages.

Code: Select all
<?php
if 
(count (get_users ("role=s2member_level1")) >= 10)
    {
?>
        Sorry, we are no longer accepting Membership signups.
<?php
    
} else {
?>
        [s2Member-PayPal-Button .. /]
<?php
    
}
?>
* See also: http://codex.wordpress.org/Function_Reference/get_users
Other Roles include: subscriber, s2member_level1, s2member_level2, etc.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Limit the number of members...

Postby antseo » September 20th, 2011, 6:19 pm

thanks Jason!
User avatar
antseo
Experienced User
Experienced User
 
Posts: 127
Joined: September 2, 2011

Re: Limit the number of members...

Postby lmllewellyn » January 4th, 2012, 11:38 am

Thanks for this code. How would I limit the number of people with a certain custom capability. Is this also possible?
User avatar
lmllewellyn
Registered User
Registered User
 
Posts: 17
Joined: August 31, 2011

Re: Limit the number of members...

Postby Jason Caldwell » January 5th, 2012, 1:20 am

lmllewellyn wrote:Thanks for this code. How would I limit the number of people with a certain custom capability. Is this also possible?
Something like this perhaps.
Code: Select all
<?php
global $wpdb
;
$ccap = "music";
if(
count($wpdb->get_results("SELECT `user_id` as `ID` FROM `".$wpdb->usermeta."` WHERE `meta_key` = '".$wpdb->prefix."capabilities' AND `meta_value` LIKE '%\"access_s2member_ccap_".esc_sql($ccap)."\"%'")) >= 10)
    {
?>
        Sorry, we are no longer accepting Membership signups.
<?php
    
}
else
    {
?>
        [s2Member-PayPal-Button .. /]
<?php
    
}
?>
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Limit the number of members...

Postby lmllewellyn » January 5th, 2012, 5:45 pm

Thanks so much, Jason. The count statement isn't quite right (it comes out at 0 even though I know several people have my defined custom capability) - but this will work if I can figure out what's wrong with it. Does someone want to quote me a price to get this php Select statement just right?
User avatar
lmllewellyn
Registered User
Registered User
 
Posts: 17
Joined: August 31, 2011

Re: Limit the number of members...

Postby peeld » January 5th, 2012, 7:14 pm

Just wanted to get in on this topic, limiting the number of people who can have a ccap is something I'm interested in, want to get email updates to this topic :)
User avatar
peeld
Registered User
Registered User
 
Posts: 97
Joined: August 24, 2011

Re: Limit the number of members...

Postby peeld » January 11th, 2012, 3:20 pm

I'll chime in with lmllewellyn and will pay as well ;)
User avatar
peeld
Registered User
Registered User
 
Posts: 97
Joined: August 24, 2011

Re: Limit the number of members...

Postby Jason Caldwell » January 14th, 2012, 8:58 pm

Thanks for the follow-ups.
I just tested this again. I can confirm that this code does work as expected.
Jason Caldwell wrote:
lmllewellyn wrote:Thanks for this code. How would I limit the number of people with a certain custom capability. Is this also possible?
Something like this perhaps.
Code: Select all
<?php
global $wpdb
;
$ccap = "music";
if(
count($wpdb->get_results("SELECT `user_id` as `ID` FROM `".$wpdb->usermeta."` WHERE `meta_key` = '".$wpdb->prefix."capabilities' AND `meta_value` LIKE '%\"access_s2member_ccap_".esc_sql($ccap)."\"%'")) >= 10)
    {
?>
        Sorry, we are no longer accepting Membership signups.
<?php
    
}
else
    {
?>
        [s2Member-PayPal-Button .. /]
<?php
    
}
?>
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Limit the number of members...

Postby peeld » January 16th, 2012, 1:01 pm

Bugger all, the PHP Execution plugin doesn't work - just returns the code. Know of any other trustworthy plugins that allow for the PHP code to execute?
User avatar
peeld
Registered User
Registered User
 
Posts: 97
Joined: August 24, 2011

Re: Limit the number of members...

Postby Jason Caldwell » January 16th, 2012, 1:05 pm

~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Limit the number of members...

Postby peeld » January 16th, 2012, 1:31 pm

That works, sweet :)
User avatar
peeld
Registered User
Registered User
 
Posts: 97
Joined: August 24, 2011

Re: Limit the number of members...

Postby lmllewellyn » January 16th, 2012, 6:18 pm

AWESOME!! It works with the Exec-PHP plugin. Thanks so much!
User avatar
lmllewellyn
Registered User
Registered User
 
Posts: 17
Joined: August 31, 2011


Return to Common Questions/Problems/Tips

Who is online

Users browsing this forum: No registered users and 1 guest

cron