About: CodeClips
Web Developer / Programmer
PHP/MySQL, Wordpress
Check out my site at: http://codeclips.info
Topics I'm Subscribed To
Topic | Count | Last Reply |
---|---|---|
Index page seems unprotected
By: |
voices: 3 replies: 11 |
|
Page Access Restrictions – Parent Pages only?
By: |
voices: 2 replies: 1 |
My Latest Replies (From Various Topics)
Author | Replies |
---|---|
Author | Replies |
Posted: Tuesday Jul 10th, 2012 at 9:47 pm #18854 | |
|
|
The [s2If current_user_is(s2member_level0)] shows the enclosed content only to the logged in users. If you want to show it to non logged in users or to the public, use [s2If !is_user_logged_in()] instead. Note the ! means “not”. For the logged in users, use [s2If is_user_logged_in()] or [s2If current_user_is(s2member_level0)] |
|
Posted: Monday Jul 9th, 2012 at 12:45 am #18642 | |
|
|
@Tom Golden What theme are you using? If it’s a Genesis child theme then the approach would be much different. Anyway, the sample that I gave filters the post from being included on the posts list. Now if you want to show some sample intro into the post, you might use the [ s2If ] tag. For example:
Or a more advance approach would be (if you are using a theme like TwentyEleven or a Wootheme Theme or something similar): You could enter some teasers on the Excerpt of the post while the Content contains the restricted article and video. Then add this inside your Loop routine, along after the “the_post();” statement:
This way the teaser which is from the Excerpt will be shown to the users who are not logged in. But if the user has logged in and if they have access to the post, the content of the posts will be shown. You can still use some combinations of the [ s2If ] and other shortcodes to get your desired results. |
|
Posted: Saturday Jul 7th, 2012 at 9:34 pm #18583 | |
|
|
Ok, I see your point now. If the post is called directly using mysite.com/?p=71 the post is protected. But if you go to your home page especially if the setting is to show the latest posts, that protected post is shown along with the other new posts as though it was not protected. The solution to this is to edit your index.php to include the S2Member protection when listing the posts that may include the protected ones. Here’s what you’ll do: Add the following code before the “the Loop”:
For example, it will appear somewhat like this:
This will filter all the posts, custom posts, or pages to be publicly shown. The protected posts, custom posts or pages are included is the user has access to the post, custom post, or page. You can also add this code clip to other areas of your theme like the archive, blog, etc. that lists all the posts or pages on your site. |
|
Posted: Friday Jul 6th, 2012 at 11:10 pm #18511 | |
|
|
If you want the “?p=71” post restricted, you should specify its restriction by editing that post and specify on the right side that has the box “S2Member ” and “Post Level Restriction?” then update the post. |
|
Posted: Friday Jul 6th, 2012 at 10:50 pm #18509 | |
|
|
Hi Dave, Having the same problem and can’t find any posts regarding the Parent pages having restrictions and wanting the Child pages to follow the same restriction of the Parent page, I did the following code clip when the child page is viewed as a single page: I added this to my functions.php
This will check the current page as well as the parent pages (if any) if they where restricted by S2member. The function will return true if the current user can access the child page. False if not. Then I added this simple check on the header.php to redirect the user to the S2Member Membership Options Page if they don’t have access to the page. This is added before the “<!DOC TYPE html….." of the header.php
In fact, this little code clip and function can work on even posts and custom post types. |