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™

Member Access WP MU

s2Member Plugin. A Membership plugin for WordPress®.

Member Access WP MU

Postby januitgever » November 15th, 2010, 4:08 am

Hi,

I have the following:
- WP 3.0.1 MU
- s2Member Plugin
- 1 buddypress site
- 1 wp site

I have been trying to create members who only can access the buddypress site but have no access to the second site. After some time of trying the s2Member plugin I got very confused as a new member still gets access to both sites.

I do not want to work with the Membership Options Page!

Maybe someone can help me how to achieve this.
User avatar
januitgever
Registered User
Registered User
 
Posts: 7
Joined: November 15, 2010

Re: Member Access WP MU

Postby crushthenet » November 15th, 2010, 12:31 pm

How are your sites configured? Are they on sub-folders or sub-domains? And are you using domain mapping so they have their own domain?
User avatar
crushthenet
Registered User
Registered User
 
Posts: 63
Joined: November 1, 2010

Re: Member Access WP MU

Postby januitgever » November 16th, 2010, 7:31 am

On sub-domains ... and I added a wild card record to my Apache settings.
Like this:
ServerAlias yourdomain.com *.yourdomain.com
User avatar
januitgever
Registered User
Registered User
 
Posts: 7
Joined: November 15, 2010

Re: Member Access WP MU

Postby crushthenet » November 16th, 2010, 7:52 am

Okay, so right now they sign up and they're added to all of the sites and after logging in they can access all the subdomain sites right?

I was going to recommend URI Access Restrictions, but that probably wouldn't work on subdomains.

Something you could probably do (that i've been playing with) is to set up s2member on the subdomains and restrict access to whatever you want. I'm not exactly sure what you're trying to achieve but when they sign up they'll be Level 0 members on the subdomains. If s2 was set up on a subdomain and posts were set at level 1, they shouldn't be able to access them. This has been working for me on my test machine, but I'm not sure the number of subdomains you have or what exactly you're trying to achieve.

Also, when you set up s2 it tells you to patch files, here's the 3rd patch... I think that's the part that adds users to the other blogs databases. If you left it out, perhaps it wouldn't add them? I'm not really sure, haven't tested it.

Patch #3 ( /wp-admin/user-new.php )

Code: Select all
// Modified for full plugin compatiblity.
    //wpmu_signup_user( $new_user_login, $_REQUEST[ 'email' ], array( 'add_to_blog' => $wpdb->blogid, 'new_role' => $_REQUEST[ 'role' ] ) );
    wpmu_signup_user( $new_user_login, $_REQUEST[ 'email' ], apply_filters( 'add_signup_meta', array( 'add_to_blog' => $wpdb->blogid, 'new_role' => $_REQUEST[ 'role' ] ) ) );
User avatar
crushthenet
Registered User
Registered User
 
Posts: 63
Joined: November 1, 2010

Re: Member Access WP MU

Postby crushthenet » November 16th, 2010, 8:12 am

Just so you know I will be testing my second suggestion to set up s2 on node sites (as I call them) online to make sure it does what I think it does. I've been doing it on my local machine and adding/modifying members subscriptions manually in the users area of the admin. I'll report back when I have more info for you.

Cal
User avatar
crushthenet
Registered User
Registered User
 
Posts: 63
Joined: November 1, 2010

Re: Member Access WP MU

Postby januitgever » November 16th, 2010, 10:12 am

I already implemented the third patch!

To give you an idea what I am aiming at.

The buddypress site is under the main domain.
People cannot register online for buddypress, but this will be done in the backend.
Every member has free access for buddypress but the subdomain site(s) should have restrictions so every member can be assigned or restricted to specific subdomain site(s).

Thanks for your support here! ;)
User avatar
januitgever
Registered User
Registered User
 
Posts: 7
Joined: November 15, 2010

Re: Member Access WP MU

Postby crushthenet » November 16th, 2010, 10:21 am

Okay, I understand what you're saying.

How many subdomains are we talking?

Are you trying to block posts, pages, or everything you can?

And you'll be adding members in the backend? So you probably don't plan on having many members right?
User avatar
crushthenet
Registered User
Registered User
 
Posts: 63
Joined: November 1, 2010

Re: Member Access WP MU

Postby januitgever » November 16th, 2010, 10:34 am

Hi,

At this moment 1 subdomain but this will be more in the future. Maybe max 6 subdomains.
I want to block everything ... so if someone tries to access the subdomain without membership, will be redirected to the login page.

The amount of members will probably start with about 150 members. And gradually growing.
This will surely not become a high traffic site!
User avatar
januitgever
Registered User
Registered User
 
Posts: 7
Joined: November 15, 2010

Re: Member Access WP MU

Postby crushthenet » November 16th, 2010, 11:03 am

The simplest thing I can think of right now is this.......

You go to subdomain1 (for example) and activate S2 Member plugin.

You set Posts, Pages, Categories, and Tags to "all" at Level 4. (and set up generic login welcome page and membership options page, these can be blank, do whatever with them)

So only level 4 members on subdomain1 can access all that... pages, posts, cats, and tags.

Now when you add someone to main site, level 1-4 doesn't matter, they'll be a level 0 on subdomain1.

When they go to subdomain1 they will not have permission so they'll be redirected to the Membership Options page for subdomain1.

All we have to figure out then is how to redirect them automatically from that Membership Options page (which could be blank by the way) to wherever you want them to go, i.e. mainsite.com.

We can probably accomplish this with some code in the .htaccess file, which is in the root of your site. We put a temporary redirect from Subdomain1.mainsite.com/membership-options -> Mainsite.com.

Look up .htaccess temporary redirects in google.

Now if you decide you want someone to access subdomain1, you just go to subdomain1's WP-ADMIN and edit the user to LEVEL 4 and they will be able to access pages, posts, tags, and categories on subdomain1.

Hopefully that makes sense, let me know.
User avatar
crushthenet
Registered User
Registered User
 
Posts: 63
Joined: November 1, 2010

Re: Member Access WP MU

Postby januitgever » November 16th, 2010, 11:14 am

thanks ... Tomorrow I will look further into this!
User avatar
januitgever
Registered User
Registered User
 
Posts: 7
Joined: November 15, 2010

Re: Member Access WP MU

Postby crushthenet » November 16th, 2010, 11:54 am

Another thing you could try if you don't mind digging into your subdomains theme is a PHP redirect......

Using S2 conditionals like this...... (haven't tested this)

Code: Select all
<?php if (S2MEMBER_CURRENT_USER_ACCESS_LEVEL === 0){ ?>
    <?php header("location: http://mainsite.com"); ?>
<?php } else if(S2MEMBER_CURRENT_USER_ACCESS_LEVEL === -1){ ?>
    <?php header("location: http://mainsite.com"); ?>
<?php } ?>


The code above basically says, if they're a free subscriber or not registered, redirect to mainsite.com

S2 probably has to be active on the subdomain.

This code would go into your header.php in your theme folder that you're using for subdomain, right at the top of the file. As I said though, I haven't tried this yet.

Cal
User avatar
crushthenet
Registered User
Registered User
 
Posts: 63
Joined: November 1, 2010

Re: Member Access WP MU

Postby crushthenet » November 16th, 2010, 12:09 pm

Okay, just tested code above and it does seem to work. S2 must be active on subdomain site though, otherwise it has no idea what S2_MEMBER_CURRENT_USER is........

So just go into your themes header.php and paste that at the top. If you use that theme for multiple sites that are different, just copy/paste the theme as a new folder/theme and rename the folder to something like "twentytenmodified" or something. Then go to that new themes style.css and rename the theme.....

Code: Select all
Theme Name: Twenty Ten


to

Code: Select all
Theme Name: Twenty Ten for subdomains


Then just activate that new theme on whichever subdomains you want to use it and redirect people.
User avatar
crushthenet
Registered User
Registered User
 
Posts: 63
Joined: November 1, 2010

Re: Member Access WP MU

Postby januitgever » November 17th, 2010, 4:48 am

Hi,

I have been trying the conditionals option and get an error after pasting the code in the header.php of the theme. I only activated the s2Member for the subdomain.

Error:
Warning: Cannot modify header information - headers already sent by
and the location is refering to the header.php line 4
User avatar
januitgever
Registered User
Registered User
 
Posts: 7
Joined: November 15, 2010

Re: Member Access WP MU

Postby crushthenet » November 17th, 2010, 9:43 am

Okay, maybe try a http redirect instead....

Code: Select all
<?php if (S2MEMBER_CURRENT_USER_ACCESS_LEVEL === 0){ ?>
    <meta http-equiv="Refresh" content="0; url=http://www.example.com/" />
<?php } else if(S2MEMBER_CURRENT_USER_ACCESS_LEVEL === -1){ ?>
    <meta http-equiv="Refresh" content="0; url=http://www.example.com/" />
<?php } ?>
User avatar
crushthenet
Registered User
Registered User
 
Posts: 63
Joined: November 1, 2010

Re: Member Access WP MU

Postby januitgever » November 17th, 2010, 10:17 am

Hi, this is working ... thanks for helping me with this issue!
User avatar
januitgever
Registered User
Registered User
 
Posts: 7
Joined: November 15, 2010

Re: Member Access WP MU

Postby crushthenet » November 17th, 2010, 11:38 am

No problem, glad it's working. :)
User avatar
crushthenet
Registered User
Registered User
 
Posts: 63
Joined: November 1, 2010


Return to s2Member Plugin

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 3 guests

cron