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™

Hiding Posts for non Members

s2Member Plugin. A Membership plugin for WordPress®.

Hiding Posts for non Members

Postby jl0810 » April 2nd, 2011, 1:12 pm

Im sure there is an easy answer here..

I want to use one single home page for my blog posts
* Non members would see probably just one post - like welcome to my site, please register
* Members would see ALL posts


So for non members i don't even want them to see the post snippets


Tried categories, private posts, etc...nothing works so far
Ideas?
User avatar
jl0810
Registered User
Registered User
 
Posts: 3
Joined: April 2, 2011

Re: Hiding Posts for non Members

Postby Cristián Lávaque » April 2nd, 2011, 1:30 pm

You could probably edit the homepage's template to display the message for non-members, or the posts for members, depending on their access level using s2Member's conditionals WP Admin -> s2Member -> API / Scripting -> Using Advanced Conditionals and maybe Advanced Query Conditionals.
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: Hiding Posts for non Members

Postby jl0810 » April 2nd, 2011, 1:46 pm

thanks for the lead - if anyone has done this let me know - would love to steal a snippet of code or something
User avatar
jl0810
Registered User
Registered User
 
Posts: 3
Joined: April 2, 2011

Re: Hiding Posts for non Members

Postby Cristián Lávaque » April 2nd, 2011, 2:08 pm

It'd be quite simple, really, because you don't even have to check what access level they have, only if they are a member or not, so checking if they're logged in would be enough.

Code: Select all
if (is_user_logged_in())
{
    
// Show the posts. Use the code in the template to do this.
}
else
{
    
// Give message for non-members.
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: Hiding Posts for non Members

Postby jl0810 » April 2nd, 2011, 4:54 pm

ok - got it -now another question - use php execution I know how I can add php to a page - but what about the homepage (i'm using the default one)
User avatar
jl0810
Registered User
Registered User
 
Posts: 3
Joined: April 2, 2011

Re: Hiding Posts for non Members

Postby Cristián Lávaque » April 2nd, 2011, 5:04 pm

If you're editing the template file, you are in a PHP file already, you don't need a plugin for that. ;)
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


Return to s2Member Plugin

Who is online

Users browsing this forum: Exabot [Bot], Yahoo [Bot] and 1 guest

cron