latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

How to hide the home page for none-members?

Home Forums Community Forum How to hide the home page for none-members?

This topic contains 7 replies, has 5 voices. Last updated by  Bruno 4 years, 2 months ago.

Topic Author Topic
Posted: Tuesday Nov 6th, 2012 at 12:55 am #30735

Hi,

I have the S2member pro version and I want to block the homepage for none-members. I haven’t figured out how to do this yet.

On my homepage, the newest posts/articles show up in the same way as on a standard blog and the posts’ page are hidden for none-members, but not the homepage itself so the none-members can read the posts from the homepage.

**UPDATE** I FIXED IT!

But now the problem is that non-members only see a empty homepage and not being redirected to the Membership Option Page. Can anyone please help me with this?

But it’s a great plugin! I’ve enjoyed it very much so far!

Thanks,

Jimmy

List Of Topic Replies

Viewing 7 replies - 1 through 7 (of 7 total)
Author Replies
Author Replies
Posted: Tuesday Nov 6th, 2012 at 3:21 pm #30793
Eduan
Username: Eduan
Moderator

Hello Jimmy,

Well one way you can do this, that I can think of, is using s2Member conditionals, find an article about them here:
Knowledge Base » s2Member® Conditionals

So you would do the following (this is pseudo-code):

(if user can't access your content)
	do JavaScript redirect to membership options page
(if user can access your content)
	show content

That’s a good starting point. :)

BTW, here’s the JavaScript redirect you would use:

<script type="text/javascript">
window.location = "http://www.yourwebsite.com/url/to/membership-options-page"
</script>

Hope this helps. :)

Posted: Wednesday Nov 7th, 2012 at 9:05 am #30890

Hi Jimmy.

**UPDATE** I FIXED IT!

But now the problem is that non-members only see a empty homepage and not being redirected to the Membership Option Page. Can anyone please help me with this?

Glad you fixed it. Did you use the Alternative View protection? [hilite path]Dashboard -› s2Member® -› Restriction Options -› Alternative View Protection[/hilite]

If you want part of your post to show in the homepage, you can use the WordPress “more” tag, then the post will be shown up to that with a link to go to the actual post, which is protected and will send the person to the Membership Options page.

But it’s a great plugin! I’ve enjoyed it very much so far!

Thanks for the kudos! :)

Posted: Wednesday Nov 7th, 2012 at 3:56 pm #30932
Bruno
Username: brunoedig

Hi,

I’d be interested on this, more specifically on this:

(if user can't access your content)
	do JavaScript redirect to membership options page
(if user can access your content)
	show content

Any easy way to implement that?

Another quick question: even though I was able to to hide my posts on the homepage using that alternative view protection, some stuff still show up on my navbar, more specifically categories.

So I’ve tried restristring access to all categories but now what it will do it will show scattered posts in my menu navbar that were previously inside that catregory that is now restricted.

Solutions?

Well I guess I liked that first solution as I was planning to have something like Kajabi where if you go to a page not-logged in, it jsut redirect you to a simple page asking you to login.

How could I install something like that and where should I place that code?

Thanks!

Posted: Wednesday Nov 7th, 2012 at 7:30 pm #30966
Raam Dev
Username: Raam
Staff Member

I’d be interested on this, more specifically on this:

(if user can’t access your content)
do JavaScript redirect to membership options page
(if user can access your content)
show content
Any easy way to implement that?

Yes, like this:

[s2If !current_user_can(access_s2member_level1)]
	<script type="text/javascript">
	<!--
	window.location = "http://example.com/";
	//-->
	</script>
[/s2If]

[s2If current_user_can(access_s2member_level1)]
    Some content for Members who are logged in with an s2Member Level >= 1.
[/s2If]
Posted: Thursday Nov 8th, 2012 at 6:43 am #31001
Bruno
Username: brunoedig

Thanks mate! That helps!

And what is the best place to insert that code so all pages got it?

I use Catalyst theme so it’s quite easy to use hooks to insert that code where I wont.

I suppose it should be right after the tag, but I’m not sure. Perhaps inside the tag?

Thanks again!

Posted: Thursday Nov 8th, 2012 at 5:36 pm #31066
Raam Dev
Username: Raam
Staff Member

You’d need to insert that code into the WordPress Post/Page itself. If you want to edit your theme files so that this applies to all posts/pages, you won’t be able to use the shortcode conditionals in my example above. Instead, you should use their PHP equivalents in Dashboard -› s2Member® -› API / Scripting -› Advanced PHP Conditionals.

Where exactly you insert the code will depend on your WordPress theme. Every theme is slightly different and I’m not familiar with the Catalyst theme.

Posted: Thursday Nov 8th, 2012 at 6:24 pm #31078
Bruno
Username: brunoedig

Coolio! No worries, I get it now

Yeah Catalyst is great, it has a ton of hooks I can use to insert that shortcode to all post/pages easily

Thanks again!

Viewing 7 replies - 1 through 7 (of 7 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.