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™

how can I block people from seeing sidebar on 404 page

s2Member Plugin. A Membership plugin for WordPress®.

Re: how can I block people from seeing sidebar on 404 page

Postby Lesley » January 15th, 2012, 5:40 pm

Ok....this is getting pretty serious now, I think, as I just (not logged in) clicked a profile avatar that can be seen in the sidebar of the "not found" page and it took me to one of my member's profiles! Of all the things that shouldn't be able to be seen by a non-member! I clicked all the other links visible on that page and they correctly took me to the MOP.

This is also more urgent now as my site is live, lots of people are visiting it and that darned error page now shows up on the search results on the first page in Google if you search "*removed".

Can anyone help me figure out how to make my site (except the MOP, of course) completely hidden to non-members? This could compromise my members feelings of privacy and safety.
Last edited by Lesley on January 21st, 2012, 9:29 pm, edited 1 time in total.
User avatar
Lesley
Registered User
Registered User
 
Posts: 45
Joined: June 23, 2011

Re: how can I block people from seeing sidebar on 404 page

Postby Raam Dev » January 16th, 2012, 10:21 pm

The problem is that you've protected everything on the site and by default WordPress is configured to show your list of posts on the home page. When a non-logged in visitor loads your home page, WordPress is trying to show the protected list of blog posts, but because s2Member is quietly denying access to them in the background, your home page is showing the 404 message instead.

If you don't want your home page to show things like your sidebar and Who's Online sections, you'll need to make sure the home page that's loading does not include those items. Doing this involves creating a WordPress Page Template with those elements stripped out, assigning that page template to your Membership Options Page, and then configuring WordPress to use your Membership Options Page as the static front page in WP Admin -> Settings -> Reading.

If you at least do the last of those steps (set your MOP to be the static front page), that should solve the 404 error problem.
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Re: how can I block people from seeing sidebar on 404 page

Postby Lesley » January 16th, 2012, 10:31 pm

Gosh...well I am thankful for some clear ideas of what to do. But if I change my front page to the MOP, won't that ruin the usual flow of members arriving on the front page with the most recent post when they login?

And if the magazine template, which I have based the whole look of the blog upon calls for the front page being set to pages of posts, it sounds as tho' you are saying I would have to change the look of my front page.

Isn't protecting the whole site a common thing?

P.S. It is also, actually not a 404 page,which I mentioned earlier, if that makes any difference?
User avatar
Lesley
Registered User
Registered User
 
Posts: 45
Joined: June 23, 2011

Re: how can I block people from seeing sidebar on 404 page

Postby Raam Dev » January 16th, 2012, 11:09 pm

You should be able to easily recreate the current home page functionality (i.e., page with most recent posts) and then simply point your Login Welcome Page to that page.

Here's how:

1) Create a WordPress page called "Home"; leave it blank; the page just needs to exist.
2) Set your "Front page" to your Membership Options Page
3) Set your "Posts page" to that blank "Home" page you created
4) Set your s2Member Login Welcome Page to the "Home" page you created, or alternatively, fill in the full URL to that "Home" page (e.g., http://example.com/home/) in the box at the bottom of the Login Welcome Page

Now, when a non-logged in user visits your home page, they will see your Membership Options Page. When one of your existing users logs in, they will see a list of your latest posts.

Does that make sense?

You can always try a few of these changes and then just revert back to the hold setup if you discover it's not working.
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Re: how can I block people from seeing sidebar on 404 page

Postby Lesley » January 16th, 2012, 11:29 pm

Ok...I am so appreciating the real problem solving and was very excited to see that when I followed your directions a logged out user only gets the MOP, no sidebars.

This note did come up when I did it and I wonder if that is a problem:

NOTE: Your Membership Options Page for s2Member is currently configured as your Home Page ( i.e. static page ) for WordPress®. This causes internal conflicts with s2Member. Your Membership Options Page MUST stand alone. Please correct this.

And the real issue is that as a logged in user, when I click the header, which should take me to my home page and the magazine template, it takes me to the MOP....not good. As far as I know that page just doesn't exist at the moment.

Further ideas please? I feel like we are close.
User avatar
Lesley
Registered User
Registered User
 
Posts: 45
Joined: June 23, 2011

Re: how can I block people from seeing sidebar on 404 page

Postby Raam Dev » January 17th, 2012, 12:09 am

OK, try this:

Create another page, let's call it "Redirect Page".

Now copy and paste the following code into the page:

Code: Select all
[s2If is_user_logged_in()]
<script type="text/javascript">
<!--
window.location = "http://example.com/link-to-page-called-home/"
//-->
</script>
[/s2If]

[s2If !is_user_logged_in()]
<script type="text/javascript">
<!--
window.location = "http://example.com/link-to-membershio-options-page/"
//-->
</script>
[/s2If]


Update those two URLs to point to the correct pages, your Membership Options Page and that Home page we created earlier (the one you set as the Posts page).

Now set your Front Page to this Redirect Page that we just created.

What should now happen is this:

- If a non-logged in user visits your home page, they will be redirected to your Membership Options Page.

- If a logged in user visits your home page (or they click on your header), they will be redirected to the page with the latest posts.
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Re: how can I block people from seeing sidebar on 404 page

Postby Lesley » January 17th, 2012, 9:31 am

I got the same result with the non-logged in user now getting the MOP page but logged in users not getting the home page....with this setup, they get the redirect page with the code sitting there.

I think the problem with these fixes is that I have to unclick "Front Page displays: Page of Posts" to choose these static pages...and the front page only works when Page of Posts is chosen for front page display?
User avatar
Lesley
Registered User
Registered User
 
Posts: 45
Joined: June 23, 2011

Re: how can I block people from seeing sidebar on 404 page

Postby Raam Dev » January 17th, 2012, 1:49 pm

So when you visit the Redirect Page, you see that code instead of being redirected? That's not right, it should redirect.

Did you copy and paste that into the editing window using the Visual editor or the HTML editor? Please use the HTML editor and make sure the only thing on that page is the code above.

Again, the Redirect page is simply designed to send the person to the correct page, so it should be selected as the Front Page and the Posts Page should be the blank Home page you created earlier (WordPress turns that blank Home page into a page with the latest posts when you select it as the Posts page).
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Re: how can I block people from seeing sidebar on 404 page

Postby Lesley » January 17th, 2012, 3:21 pm

It seems to have worked! I just redid the whole process and must have done some little thing wrong the first time. Hooray! I am so glad and send you great thanks. There is the little new thing of seeing the "redirect page" for a few seconds, but that is not a big deal.

I've got one more questions to make the whole process smooth now, but will start a new topic.

Thanks again.
User avatar
Lesley
Registered User
Registered User
 
Posts: 45
Joined: June 23, 2011

Re: how can I block people from seeing sidebar on 404 page

Postby Lesley » January 18th, 2012, 12:05 am

Sorry to be here again. This isn't serious, but annoying and it seems rather unprofessional...because that dratted Not Found page still shows up when someone logs out. They log out, there is the page. I am wondering what happens on other people's sites when their members log out?

Also, I tried bookmarking my site, as my members are trying to do, so I bookmarked the home page. When I log out and click my bookmark, the Not Found page comes up again.

Why is this so convoluted?
User avatar
Lesley
Registered User
Registered User
 
Posts: 45
Joined: June 23, 2011

Re: how can I block people from seeing sidebar on 404 page

Postby Raam Dev » January 18th, 2012, 1:29 pm

Can you tell me what the URL appears in the address bar after logout?

Also, can you tell me what the full URL is of the page you're bookmarking?
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Re: how can I block people from seeing sidebar on 404 page

Postby Lesley » January 18th, 2012, 3:22 pm

*removed*

It is the same for both. It would seem that originally, before all these tweaks, I had a page called -home. When you gave me the instructions above, I deleted that and created a new one, just called "home", and at some point along the way, I trashed that page and created another. But the new ones were never called "home", they were the "home-a number" name. So when I followed your instructions, I did use that for the "link to a page called home-3". I would love to get back to just home, but don't know how to as I trashed those previous version and it still won't let me make it just "home".
Last edited by Lesley on January 21st, 2012, 9:25 pm, edited 1 time in total.
User avatar
Lesley
Registered User
Registered User
 
Posts: 45
Joined: June 23, 2011

Re: how can I block people from seeing sidebar on 404 page

Postby Raam Dev » January 18th, 2012, 10:56 pm

Did you update the code in the Redirect page to point to the correct Home page URL? (i.e., /home-3/). If not, that might explain why the redirect isn't functioning as expected.

To allow changing a post back to /home/, you need to permanently delete the two trashed posts from your Trash (i.e., empty the trash). Until you do that, WordPress will detect /home/ as being a slug already taken by another post.
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Re: how can I block people from seeing sidebar on 404 page

Postby Lesley » January 19th, 2012, 1:57 am

Thank you...I didn't know about emptying the trash. So, "home" is back to just plain home, but the Not Found page still comes up upon logging out.

What page appears for most people upon logging out? And where is that set?
User avatar
Lesley
Registered User
Registered User
 
Posts: 45
Joined: June 23, 2011

Re: how can I block people from seeing sidebar on 404 page

Postby Lesley » January 19th, 2012, 10:40 pm

Ok...I noticed today that if I logout from my dashboard, I go to the login page.

If I logout from the home page, I get the "not found" page with the sidebar that shows.

If I logout from another page, I get the MOP.


Any ideas? Should these all work the same?
User avatar
Lesley
Registered User
Registered User
 
Posts: 45
Joined: June 23, 2011

Re: how can I block people from seeing sidebar on 404 page

Postby Raam Dev » January 23rd, 2012, 1:48 pm

There are two places you could end up when logging out:

1) The home page
2) /wp-login.php?loggedout=true

If you end up at the home page, then according to the redirect you set up earlier, the person would then be sent to the MOP page (since they're trying to access the home page which only logged in members can access).

If you end up at /wp-login.php?loggedout=true, you shouldn't be redirected anywhere; you should simply see the login form.
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Previous

Return to s2Member Plugin

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron