Community Support Forums — WordPress® ( Users Helping Users ) — 2011-12-30T16:41:47-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=16516 2011-12-30T16:41:47-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16516&p=59264#p59264 <![CDATA[Re: Protecting my subdirectory site?]]> Thanks for the heads up on this thread.

Is assigning user level-1 all that is required for s2members to then kick in and allow access to the member?
Or is there other data that also must be checked/saved?

**If that is all that is required, could you ask Jason or one of the devs to give me a quick action snippet that I can add to woocommerce which I can hook to 'order_status_completed' which will tie s2members together?
That's what it looks like to me. I would do something like this.
Code:
<?php
add_action
('woocommerce_order_status_completed', 'woocommerce_paying_customer');
function woocommerce_paying_customer($order_id)
    {
        if(is_object($order = &new woocommerce_order($order_id)) && !empty($order->user_id))
            {
                update_user_meta($order->user_id, 'paying_customer', 1);
                
                $user 
= new WP_User($order->user_id);
                $user->set_role("s2member_level1");
                /**/
                /* Or, do this if the Role clashes. */
                // $user->add_cap("access_s2member_level0");
                // $user->add_cap("access_s2member_level1");
            }
    }
?>

Statistics: Posted by Jason Caldwell — December 30th, 2011, 4:41 pm


]]>
2011-12-27T04:12:27-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16516&p=58891#p58891 <![CDATA[Re: Protecting my subdirectory site?]]>
Here's a post by Jason on how to add/remove s2Member roles/capabilities with PHP. It may help you see how you can achieve what you suggested. viewtopic.php?f=36&t=2599

I'll email Jason a link to your post in case he has something to add.

Thanks! :)

Statistics: Posted by Cristián Lávaque — December 27th, 2011, 4:12 am


]]>
2011-12-26T07:02:25-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16516&p=58816#p58816 <![CDATA[Re: Protecting my subdirectory site?]]>
That brings up a good question:

Scenario:
1. I use s2members to protect my entire 'secondary blog' site to all users not level+1 or greater.

2. I use woocommerce to sell a digital product. When the product is sold there is a hook I can tie into 'order_status_completed'
--I then add an action to the multisite user management plugin to add that user to my s2members 'secondary blog' membership blog with the proper role.

*there would be an opportunity for s2members to market a woocommerce paid module here by replacing the digital download system used by woocommerce which sucks, with the much better s2members system*

3. When that fires woothemes adds metadata to the user
Code:
add_action('woocommerce_order_status_completed', 'woocommerce_paying_customer');

function woocommerce_paying_customer( $order_id ) {

$order = &new woocommerce_order( $order_id );

if ( $order->user_id > 0 ) update_user_meta( $order->user_id, 'paying_customer', 1 );
}

source https://github.com/woothemes/woocommerc ... s.php#L409

that gives me a couple of things to work with.
1. The users role becomes 'customer'
2. The user_meta adds 'paying_customer'
3. The multisite user manager plugin adds the customer to my s2members 'secondary blog' with role 'level+1'

Given those tools, I now have all the pieces outside of s2members to differentiate a user who has purchased a product from a regular user, and the user is added to my 'secondary blog' members blog.

I can easily add an action to change the user_role to 'level-1' upon achieving 'paying_customer'.

Is assigning user level-1 all that is required for s2members to then kick in and allow access to the member?
Or is there other data that also must be checked/saved?

**If that is all that is required, could you ask Jason or one of the devs to give me a quick action snippet that I can add to woocommerce which I can hook to 'order_status_completed' which will tie s2members together?

This seems to be the most simple way around the current weakness in s2members network mode.

Benefits:
1. I get to use a great free shopping cart
2. I get the full benefits of s2members protecting 'secondary blogs'
3. OPens up an entire new area for s2members by adding woocommerce

Statistics: Posted by anointed — December 26th, 2011, 7:02 am


]]>
2011-12-26T05:56:10-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16516&p=58814#p58814 <![CDATA[Re: Protecting my subdirectory site?]]>
anointed wrote:
they all seem to operate independently.

My primary blog uri restrictions have no effect on another site in the network


This is correct. s2Member in a multisite network will work within the scope of each blog, not across them. So the restrictions from one won't work in another, even if you try it from the main blog.

Have you looked at the Multisite User Management plugin? Maybe it can be used combined in some way with s2Member to accomplish what you want? http://wordpress.org/extend/plugins/mul ... anagement/

Statistics: Posted by Cristián Lávaque — December 26th, 2011, 5:56 am


]]>
2011-12-24T23:24:16-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16516&p=58746#p58746 <![CDATA[Re: Protecting my subdirectory site?]]> Statistics: Posted by Harty — December 24th, 2011, 11:24 pm


]]>
2011-12-24T23:08:11-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16516&p=58744#p58744 <![CDATA[Re: Protecting my subdirectory site?]]> thanks for the link, but that is a totally different situation from what I am asking for.

The 'folder' I am trying to protect is simply a 'child-blog' on a multisite wordpress network install.
Jeff answered me in another thread, and unfortunately it looks like s2members isn't really setup for WordPress multisite unless you are talking about running a blog farm. :(

Statistics: Posted by anointed — December 24th, 2011, 11:08 pm


]]>
2011-12-24T22:20:35-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16516&p=58742#p58742 <![CDATA[Re: Protecting my subdirectory site?]]> viewtopic.php?f=4&t=2798

Statistics: Posted by Harty — December 24th, 2011, 10:20 pm


]]>
2011-12-24T15:01:09-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16516&p=58736#p58736 <![CDATA[Re: Protecting my subdirectory site?]]> I spent the entire evening reading through the actual code and I believe the problem lies in that one blog on the network cannot control settings for another blog. (I am using multisite subdirectory setup)

My best guess is that there is no REAL network support with s2members yet. Yeah, the plugin can activate and be activated to run separately on each blog in the network, but other than that, they all seem to operate independently.

My primary blog uri restrictions have no effect on another site in the network, as I described in my opening topic.

I'll create a few separate topics in the forums to describe each problem independently.

Statistics: Posted by anointed — December 24th, 2011, 3:01 pm


]]>
2011-12-24T10:31:18-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16516&p=58718#p58718 <![CDATA[Re: Protecting my subdirectory site?]]> Statistics: Posted by Raam Dev — December 24th, 2011, 10:31 am


]]>
2011-12-24T03:37:14-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16516&p=58709#p58709 <![CDATA[Protecting my subdirectory site?]]> I installed s2members and filled out every configuration available.

Under 'uri' protection I added /support/ to level +1 which is the directory that my support blog resides.

root.com = primary site
root.com/support/ = support network site

No matter what I try, all users are still able to access this subdirectory site.

What in the world am I missing?

I simply want to block access to all resources on my network support site to all members/public who are not level +1 or greater. simple enough?

thnx

*If I can make a suggestion:
I've got to imagine that there would be a number of people who simply want to use s2members to protect one site on their network (i.e. providing support only to paying customers), yet there is no docs anywhere readily available.

Statistics: Posted by anointed — December 24th, 2011, 3:37 am


]]>