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.

Disable redirection for restricted post

Home Forums Community Forum Disable redirection for restricted post

This topic contains 19 replies, has 3 voices. Last updated by  Cristián Lávaque 4 years, 8 months ago.

Topic Author Topic
Posted: Friday May 4th, 2012 at 8:39 am #12581

Hi,
Is there a way to use s2 member box to protect specific post within the admin panel BUT prevent s2member to redirect unallowed users when accessing protect post (leaving them on the protected page with hidden content).
Hope everything is clear.

List Of Topic Replies

Viewing 19 replies - 1 through 19 (of 19 total)
Author Replies
Author Replies
Posted: Saturday May 5th, 2012 at 4:45 am #12638

Yes, you can protect the content instead of the page. Don’t add the page’s ID to the Page Restriction, just wrap the content with a conditional as explained here: [hilite path]Dashboard -› s2Member® -› API / Scripting -› Simple/Shortcode Conditionals[/hilite]

I hope that helps. :)

Posted: Sunday May 6th, 2012 at 1:42 pm #12771

The problem is that i use custom post type and the content i’m protecting is not within the article but is photos that are linked to the article. With the solution you suggest i cannot use the page restriction box when editing an article to protect an custom post on the fly.
To be noticed : i’m aware of php coding so if you have a solution that need to code a few lines, it’s OK
Regards

Posted: Monday May 7th, 2012 at 3:38 pm #12818

I’m not sure I understood how you’re trying to do it.

You have a photo linked to a page, and the content in the page is what you want to protect? Or do you want to protect the photo?

Could you explain a bit more? Thanks!

Posted: Tuesday May 8th, 2012 at 10:01 am #12907

In fact, i’m just looking for a way to disable the automatic redirection in order to use my custom scripting to protect what i want in the page

Posted: Tuesday May 8th, 2012 at 12:32 pm #12917
webierweb
Username: joec

I have setup s2member to have secured pages for users…..the security of the page works great…..the problem is that if someone guesses a slug for a protected page, they get redirected to a page that says that they do not have access, rather than a general 404 error that you would get if you typed in a slug that doesnt exist.

I am using usernames to create slugs of secured pages for each user…..The problem with this is that if a slug is jsmith, then another person can tell that jsmith has a page…I don’t want this.

How would I set the site up so that if someone typed in a slug that matched an existing user, they get a 404 error if they do not have proper access? Is this possible?

I do realize that some pages should kick the visitor to a You Do Not Have Access page……the trouble is how do we do the denied access page for some pages and 404 when the page slug matches a user?

Posted: Tuesday May 8th, 2012 at 12:34 pm #12918

In fact, i’m just looking for a way to disable the automatic redirection in order to use my custom scripting to protect what i want in the page

I still am not sure about the previous question, but I can say that the redirection from a protected page to the Membership Options page happens if the page/post is protected. If you leave it unprotected and instead protect the content using a conditional in the body, then the person won’t be redirected from the page, instead he’ll be shown what you determined in the conditionals. [hilite path]Dashboard -› s2Member® -› API / Scripting -› Simple/Shortcode Conditionals[/hilite]

Not sure if that helps.

Posted: Tuesday May 8th, 2012 at 12:39 pm #12919
webierweb
Username: joec

Can we tell the system to redirect to 404 if the user does not have access to a page? That way, it totally hides the page, the content, and nobody ever knew it existed. With the pages that I am thinking about the 404 redirect being for clients (slug is client name), this would be great…

Maybe I just start using numbers for slugs instead of client name?

Is there s2 shortcode for identifying the user number in WP? That would help.

Posted: Tuesday May 8th, 2012 at 12:48 pm #12923

There’s [hilite path]Dashboard -› s2Member® -› API / Scripting -› PHP/API Constants -> S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID[/hilite]

[hilite pre_code]
[[s2Get constant="S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID" /]]
[/hilite]
Posted: Tuesday May 8th, 2012 at 1:18 pm #12924
webierweb
Username: joec

I modified the welcome page redirect url to the following:

<a href="http://www.omnimedfinancial.com/u<?php echo S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID; ?>">

You can see the u in front of the php code….now I change the slug of the user’s page to match the user’s ID, but with a “u” in front of it….I added the u because I was running into problems with there already being pages with some of the numbers that I needed to use.

Now even if someone knows the slug of one of my users, they cannot derive any personal information from the slug or the redirect that says you do not have access to this page….mission accomplished.

Now, I just need to figure out why my file links inside of s2member-files dont work when the file is placed inside of the access-s2member-ccap-username folder….It is only when the files are in s2member-files that the file is picked up by the following file link:

http://www.mysite.com/access-s2member-ccap-pvenram/?s2member_file_download=samplefile.pdf

you will see that the link calls out the access-s2member-ccap-pvenram folder….how is it finding the file when it is not even in that folder….something is wrong with a setting. If I remove the access-s2member-ccap-pvenram ink from the file link, the file is not found….when I move the actual file out of the s2member-file folder and into s2member-files/access-s2member-ccap-venram folder, it is also not found…

  • This reply was modified 4 years, 8 months ago by  webierweb.
Posted: Tuesday May 8th, 2012 at 5:36 pm #12952

I still am not sure about the previous question, but I can say that the redirection from a protected page to the Membership Options page happens if the page/post is protected. If you leave it unprotected and instead protect the content using a conditional in the body, then the person won’t be redirected from the page, instead he’ll be shown what you determined in the conditionals. Dashboard -› s2Member® -› API / Scripting -› Simple/Shortcode Conditionals

Thank you for your patience ;-)
I understand that if i leave unprotected, there is no redirection. But I want to use page/post protection box in admin to identify which page i want to have content protection and which one i don’t.
But i want to script my own protection method rather than generating a redirection

Posted: Tuesday May 8th, 2012 at 9:51 pm #13017

http://www.mysite.com/access-s2member-ccap-pvenram/?s2member_file_download=samplefile.pdf

I suggest that you read again the documentation for this here: [hilite path]Dashboard -› s2Member® -› API / Scripting -› Custom Capability and Member Level Files[/hilite]

It explains where you put the file and how you format the URL.

Posted: Tuesday May 8th, 2012 at 9:57 pm #13018

But i want to script my own protection method rather than generating a redirection

That’s fine, Caroline. s2Member’s source is not encrypted, which makes it possible for you to customize. :)

Posted: Tuesday May 8th, 2012 at 10:15 pm #13020
webierweb
Username: joec

Can anyone explain why my secure downloads have a link to s2member-files/access-s2member-ccap-variable
while it is looking for files in the folder s2member-files (without searching in the access-s2member-ccap folder)…

If I only place in the access folder, the system doesnt find them so I have to move to the parent directory (s2member-files)….This breaks my security as users can guess other users files names and can open them

Posted: Tuesday May 8th, 2012 at 10:28 pm #13022

According to the documentation the file would be here [hilite mono]/wp-content/plugins/s2member-files/access-s2member-ccap-pvenram/samplefile.pdf[/hilite] and the URL could be http://www.mysite.com/?s2member_file_download=access-s2member-ccap-pvenram/samplefile.pdf

Did you try that?

Posted: Tuesday May 8th, 2012 at 10:32 pm #13023
webierweb
Username: joec

ok…..

I was adding the access-s2member-ccap-pvenram to the link before the ?, rather than in the string after the ?

Posted: Tuesday May 8th, 2012 at 11:04 pm #13025
webierweb
Username: joec

Now that I have that figured out, I am happy….

I want to turn Amazon S3 and CloudFront back on….was on before, but I turned off until I fixed the problem with file downloads.

I reentered the codes (worked before) and now I get a 403 error….

What do I need to do in order to set this up again….I clicked off the auto setup box as I set this up before….saved without error…then, when I went to download files, page loaded without file loading (screen was white).

Do I need to change the html file link when using S3 or does s2member take care of the S3/cloudfront urls for me?

Posted: Tuesday May 8th, 2012 at 11:35 pm #13027

You were able to do it before, it should be fine again. You could try removing the previous distributions in CloudFront and have s2Member create them again.

Posted: Wednesday May 9th, 2012 at 10:51 am #13055
webierweb
Username: joec

1. I downloaded and installed the secure file upload plugin. Where do I go to upload through the WP dashboard?

2. Is it possible to receive a notification when someone downloads a secure file?

Posted: Wednesday May 9th, 2012 at 4:08 pm #13080

That plugin wasn’t developed by us, but I believe it adds buttons to the editor.

File download notifications aren’t in s2Member yet. A developer should be able to customize that, though.

Viewing 19 replies - 1 through 19 (of 19 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.