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™

Offering group access

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

Offering group access

Postby holowan » September 8th, 2011, 2:56 pm

Hi everyone,

Just a quick question today. Our site offers 30+ online learning products, which are all behind S2member pro. Once an individual has subscribed (either monthly or annually), they gain access to all 30+ products.

What we'd like to do is begin offering group access -- which is sometimes called a "site license," meaning that an organization might purchase 50, 100, or 200 "seats." We don't want to be setting up accounts for each individual seat, but rather, we want to set up a single account for the whole organization, limited to the number of seats purchased.

Any suggestions as to how to do something like this with S2 member pro? I dug around quite a bit but came up empty. The only option I'm seeing at this point is to set the "Maximum Unique IP Addresses Allowed" option under "s2Member General Options > Unique IP Access Restrictions" to "Allow infinite IPs" but this causes two problems: 1) it affects individual subscribers accounts (allowing the possibility of username/link sharing), and 2) it's a sitewide setting...it can't be set for specific users (ie: User A is restricted to 75 IPs, User B is restricted to 100 IPs, etc).

Your thoughts would be greatly appreciated!

Geoff
User avatar
holowan
Registered User
Registered User
 
Posts: 17
Joined: April 13, 2011

Re: Offering group access

Postby Eduan » September 8th, 2011, 2:58 pm

Maybe you should think about telling the organization about only giving the username and password to a limited amount of users.
Now officially accepting Professional s2Member installations along with Bruce C (a.k.a. Ace).

If you're interested in a Professional s2Member Installation, or a Custom Coding Job, you can send your request here.
User avatar
Eduan
Experienced User
Experienced User
 
Posts: 1154
Joined: August 27, 2011
Location: Taxco de Alarcón, Guerrero, México.

Re: Offering group access

Postby holowan » September 8th, 2011, 3:55 pm

Hi Eduan,

Thanks for the reply. That sounds like a pretty simple solution, except that there'd be no security restrictions...both for the organization and for regular subscribers. We could go with the "infinite IPs" option, but that would open things right up security-wise...Any other thoughts?
User avatar
holowan
Registered User
Registered User
 
Posts: 17
Joined: April 13, 2011

Re: Offering group access

Postby Cristián Lávaque » September 9th, 2011, 1:44 am

Hi Geoff.

Maybe this video will help you with that: viewtopic.php?f=36&t=2842
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Offering group access

Postby holowan » September 9th, 2011, 6:27 am

Hi Cristián,

Thanks a lot for posting that link -- that was a very interesting set of videos (and it's so amazing to see what S2 is capable of!). That solution was nearly bang on the money for me, but my only concern is that once the Level 1 manager passes out the 50 subscriptions, each user would have to manually create an account (which is fine if we sold a site license to a business).

But what if a school purchased a license and wanted 100 computers in their computer lab to be able to have access. In the above solution, each computer would have to have their own unique account (along with an email address, as required by WordPress). I was hoping we could create just a single account for all 100 computers to use (or 50 computers, or 200 computers, or whatever the case may be). So in other words, a single account for each site license sold. Does that make sense?

Any thoughts?

Geoff
User avatar
holowan
Registered User
Registered User
 
Posts: 17
Joined: April 13, 2011

Re: Offering group access

Postby Cristián Lávaque » September 10th, 2011, 12:58 am

Ah, I see your problem. Then you will need to work with the unique IP restrictions, but then you'd be allowing too many IPs to other users...

I don't know if there's a hack that'd allow for different IP limits for different accounts/levels/capabilities. I'll ask Jason.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Offering group access

Postby holowan » September 10th, 2011, 6:08 am

Thanks Cristián, I appreciate you asking Jason about it.

If there were a way to set IP restrictions on a user-by-user basis, perhaps for a different membership level, that would be perfect. Alternatively, I've begun thinking that perhaps the best way to do this would be to set up a completely new install of WP and S2 specifically for this purpose. The problem this raises is having to duplicate all of our learning materials onto the new installation though...and that would be a lot of work.

Thanks again,

Geoff
User avatar
holowan
Registered User
Registered User
 
Posts: 17
Joined: April 13, 2011

Re: Offering group access

Postby Cristián Lávaque » September 13th, 2011, 2:36 am

Yeah, I understand what you mean.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Offering group access

Postby Jason Caldwell » September 13th, 2011, 2:13 pm

Thanks for the heads up on this thread.
Yes, this is possible. You could do something like this if you like.

Please create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
Code: Select all
<?php
add_action 
("ws_plugin__s2member_before_ip_restrictions_ok", "s2_dynamic_ip_controller");
function s2_dynamic_ip_controller ($vars = array ())
    {
        if (($username = $vars["restriction"]) && is_object ($user = new WP_User ($username)) && isset ($user->ID) && ($user_id = $user->ID))
            {
                if (c_ws_plugin__s2member_user_access::user_access_level ($user) === 2) /* Is Level#2 ( indicating site license for 50 seats ). */
                    {
                        $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"] = "50"; /* Allow up to 50 unique IP addresses. */
                    }
                else if (c_ws_plugin__s2member_user_access::user_access_level ($user) === 3) /* Is Level#3 ( indicating site license for 100 seats ). */
                    {
                        $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"] = "100"; /* Allow up to 100 unique IP addresses. */
                    }
            }
    }
?>
* Please be sure there are no extra spaces/tabs/line breaks before or after the <?php ?> tags.

Also, you might need some assistance from a developer to bring this all the way home. The script above is just a way to get you started. In addition, it might be prudent to allow a 50-seat license up to 100 unique IPs, since some people may access the site from both a home and work computer.
~ 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: Offering group access

Postby holowan » September 14th, 2011, 5:23 am

Hi Jason,

Thank you VERY much for your assistance with this. Admittedly, I'm not very skilled with PHP, but I can read through what you posted and understand what it'll do. Further, I'm a touch nervous to actually attempt to implement it myself (for fear of blowing something up!) -- are you available for custom work like this? Or do you know any developers who might be able to help?

Again, many thanks!

- Geoff
User avatar
holowan
Registered User
Registered User
 
Posts: 17
Joined: April 13, 2011

Re: Offering group access

Postby Jason Caldwell » September 14th, 2011, 10:17 am

Thanks Geoff.
Sorry, I'm unavailable for custom work myself, but please check this thread for project assistance:
viewforum.php?f=37
~ 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: Offering group access

Postby holowan » October 18th, 2011, 10:13 am

Hi All,

First off, a big thank you to everyone on this thread. I've been experimenting with the code that Jason provided for the past few weeks and so far, everything's running very well. However, another issue has come up: Is it possible to restrict users from changing info on the account's profile page? For instance, let's say a school has purchased a "site license" for 100 users. We wouldn't want those 100 users to be able to go into the account and change things like the login password, email address, etc. associated with the account. Is there a way to make Level 2 users, for example, unable to edit profile information?

Again, many thanks for all the help on this one!

Geoff
User avatar
holowan
Registered User
Registered User
 
Posts: 17
Joined: April 13, 2011

Re: Offering group access

Postby Jason Caldwell » October 20th, 2011, 2:57 pm

Thanks for the follow-up.

First off, I would suggest that you tell s2Member to block all /wp-admin/ areas of your installation.
( this is always a good idea anyway, but in your case, it's very important )
SNAG-0040.png

Then, if you want to block Profile editing for Members at Level #2,
please create this directory and file: /wp-content/mu-plugins/s2-disable-profile-mods.php
Code: Select all
<?php
add_action 
("init", "disable_s2_profile_mods", 1);
function disable_s2_profile_mods ()
    {
        if (!empty ($_GET["s2member_profile"]) || !empty ($_POST["ws_plugin__s2member_profile_save"]))
            if (current_user_is ("s2member_level2") /* Disable for Level #2 Members here. */)
                exit ("Profile modifications are not possible for your account.");
    }
/**/
add_filter ("ws_plugin__s2member_sc_profile", "disable_s2_profile_shortcode");
function disable_s2_profile_shortcode ($code)
    {
        if (current_user_is ("s2member_level2") /* Disable [s2Member-Profile /] Shortcode. */)
            return /* Disable for Level #2 Members here. */ false;
        return /* Else return Shortcode output by default. */ $code;
    }
?>
s2-disable-profile-mods.zip
(513 Bytes) Downloaded 32 times

Now, you can work to further prevent this error message from ever being seen by Level #2 Members, by simply NOT introducing a Profile editing panel to them at all. This could be accomplished through the use of Basic and/or Advanced Conditionals documented by s2Member. Please check your Dashboard here: s2Member -> API Scripting -> Basic/Simple Conditionals.
~ 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: Offering group access

Postby xberserker » November 8th, 2011, 8:46 am

Jason Caldwell wrote:Thanks for the heads up on this thread.
Yes, this is possible. You could do something like this if you like.

Please create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
Code: Select all
<?php
add_action 
("ws_plugin__s2member_before_ip_restrictions_ok", "s2_dynamic_ip_controller");
function s2_dynamic_ip_controller ($vars = array ())
    {
        if (($username = $vars["restriction"]) && is_object ($user = new WP_User ($username)) && isset ($user->ID) && ($user_id = $user->ID))
            {
                if (c_ws_plugin__s2member_user_access::user_access_level ($user) === 2) /* Is Level#2 ( indicating site license for 50 seats ). */
                    {
                        $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"] = "50"; /* Allow up to 50 unique IP addresses. */
                    }
                else if (c_ws_plugin__s2member_user_access::user_access_level ($user) === 3) /* Is Level#3 ( indicating site license for 100 seats ). */
                    {
                        $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"] = "100"; /* Allow up to 100 unique IP addresses. */
                    }
            }
    }
?>
* Please be sure there are no extra spaces/tabs/line breaks before or after the <?php ?> tags.

Also, you might need some assistance from a developer to bring this all the way home. The script above is just a way to get you started. In addition, it might be prudent to allow a 50-seat license up to 100 unique IPs, since some people may access the site from both a home and work computer.


This is exactly the code I was looking for. But I would like to have unlimited logins for Subscribers only. Reason being, I have a demo of the item I'm selling. But people keep getting the "503: Service Temporarily Unavailable" message. So would this work?

Code: Select all

<?php
    add_action 
("ws_plugin__s2member_before_ip_restrictions_ok""s2_dynamic_ip_controller");
    function 
s2_dynamic_ip_controller ($vars = array ())
        {
            if ((
$username $vars["restriction"]) && is_object ($user = new WP_User ($username)) && isset ($user->ID) && ($user_id $user->ID))
                {
                    if (
c_ws_plugin__s2member_user_access::user_access_level ($user) === 0/* Is Subscriber */
                        
{
                            
$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"] = "99999999999999"/* Allow up to 99999999999 unique IP addresses. */
                        
}
                }
        }
?>
User avatar
xberserker
Registered User
Registered User
 
Posts: 1
Joined: November 8, 2011

Re: Offering group access

Postby Jason Caldwell » November 8th, 2011, 5:39 pm

Please see this thread regarding demo accounts, and the other code sample that I posted.
viewtopic.php?f=4&t=666&p=46810#p46810
( If you still have questions, please DO let us know )
~ 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: Offering group access

Postby holowan » November 15th, 2011, 3:01 pm

Hi Jason,

Thank you very much for posting your latest round of code. Much appreciated! Unfortunately, I couldn't seem to get it to work. I already have an s2-hacks.php file in the directory you specified, which I created earlier on in this thread when you'd posted your initial code. I simply pasted your latest code directly below the previous code in the s2-hacks.php file (no spaces) and tested it and it didn't block the profile page for a multi-user (Level#2) account. Please note that this sort of coding is not where my skills are, and I literally fumble around until something seems to work, so I could have easily missed something or not followed your instructions quite right. (?)

In any regard, I got looking at the API/Scripting and Conditionals that you'd suggested (as an aside, the more I learn about S2 Member, the more I'm amazed at how powerful it is. Hats off to you for building such an amazing plug-in, sir!), and I did discover a solution. It may be a bit "amateurish" and "hacky" but it seems to work well.

On the membership profile page, I simply put the following:

[s2If current_user_is(s2member_level2)]
Profile modifications are not possible for this account.
[/s2If]

Then below that, I surrounded my original profile page code, including the iframe, etc. with [s2If current_user_is(s2member_level0) OR current_user_is(s2member_level1)] (as we allow free subscribers at Level#0).

As I say, initial testing seems to be working very well, although perhaps because I bypassed your second round of PHP code and went this route, I feel that it might be a bit of an amateur's fix.

Any thoughts on what I've done here?

Once again, many thanks for your help on this thread. Not only have you created an amazing plugin, that seems to just get deeper and deeper the more I learn about it, but your support is incredible too. Thank you!!!

Geoff
User avatar
holowan
Registered User
Registered User
 
Posts: 17
Joined: April 13, 2011

Re: Offering group access

Postby Jason Caldwell » November 17th, 2011, 11:15 am

Thanks for the follow-up and kudos!
Certainly, those Simple Conditionals should work nicely for you.
I did go back and update the hack that I posted earlier, so you might try it again with the updated details that I posted here: viewtopic.php?f=36&t=14925&p=48397#p48397
~ 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


Return to Common Questions/Problems/Tips

Who is online

Users browsing this forum: No registered users and 2 guests

cron