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.

URI Restrictions Stopped Working

Home Forums Community Forum URI Restrictions Stopped Working

Tagged: ,

This topic contains 7 replies, has 2 voices. Last updated by  Cristián Lávaque 3 years, 6 months ago.

Topic Author Topic
Posted: Tuesday Jun 25th, 2013 at 1:03 am #52533

So I was trying to implement the URI feature and I got it to work with several images. I entered the url of the images and was redirected to the join page as setup.

Then a bit later I installed NextGEN Gallery plugin and I could not get any images loaded with the gallery to be protected, but then also went back to the first few images I successfully got to work, to find that they weren’t restricted anymore! I’ve tried a ton of different things and have read many posts in the forums, as well as uninstalled NextGEN gallery, but I can’t get the URI to work no matter what I try.

I was using a pretty straight forward URI like /wp-content/uploads/members2/ (for membership level2) and have tried extensive variations of that like /members2/, /members2, members2/, etc etc. including the full URI of the exact files. I also know you can only restrict files created through WordPress, so I have made sure that’s not the problem either by using the standard wordpress uploads like uploads/2013/06/ and wasn’t successful.

So my questions are…

Has there been any known conflicts with NextGEN Gallery? Or anyone think there may be something that I could check on that may have broken it?

Are there any other settings that I may have accidentally turned off somewhere in WordPress or s2member that may have made it stop working?

Is there a way to change the location of the protected s2member protected directory to be someplace else (not plugins/s2member location)? And a way to restrict access to files by member level instead of a single catch-all directory?

Or, is there a way to restrict access using an htaccess file or php code that will restrict a specific directory? I read about how to do that for content with php files, but I need to restrict image and video files.

Thanks

List Of Topic Replies

Viewing 7 replies - 1 through 7 (of 7 total)
Author Replies
Author Replies
Posted: Wednesday Jun 26th, 2013 at 5:45 am #52591

The URI restriction will work with URLs served by WordPress. If you link directly to a file, even if it’s in a WP directory, the URI restriction won’t apply.

If the image in NextGEN Gallery is not served through WP, then the URI restriction won’t work on it. What you could do, though, if the NextGEN Gallery pages are served by WP, is to restrict access to the gallery itself.

Is there a way to change the location of the protected s2member protected directory to be someplace else (not plugins/s2member location)? And a way to restrict access to files by member level instead of a single catch-all directory?

See these:
http://www.primothemes.com/forums/viewtopic.php?f=36&t=2729&p=8018#p8018
[hilite path]Dashboard -› s2Member® -› API / Scripting -› Custom Capability and Member Level Files[/hilite]

Posted: Thursday Jun 27th, 2013 at 7:48 pm #52709

See these:
Dashboard -› s2Member® -› API / Scripting -› Custom Capability and Member Level Files

Great, I did miss the section for scripting sub-directories, so that solves that problem if we decide to use that.

The URI restriction will work with URLs served by WordPress. If you link directly to a file, even if it’s in a WP directory, the URI restriction won’t apply.

If the image in NextGEN Gallery is not served through WP, then the URI restriction won’t work on it. What you could do, though, if the NextGEN Gallery pages are served by WP, is to restrict access to the gallery itself.

Yes, I know that and stated that in the first post. I mentioned that I even tried using the standard wordpress media uploading to make sure it wasn’t due to NextGEN Gallery only, but the files were still not being protected. And it WAS working using the standard wordpress media uploading before installing NextGEN, which makes me wonder if it was NextGEN that screwed it up. I uninstalled NextGEN but the problem still remains.

See these:
http://www.primothemes.com/forums/viewtopic.php?f=36&t=2729&p=8018#p8018

Is that all I was supposed to do from the link above or am I supposed to be doing something with an htaccess file or something else as well? Like build an htaccess file in that directory perhaps? That code doesn’t do anything at all, it doesn’t protect anything (and I know I entered it correctly for the directory because when I enter an incorrect directory I get errors).

Posted: Friday Jun 28th, 2013 at 6:16 am #52727

And it WAS working using the standard wordpress media uploading before installing NextGEN

What is the file link that you’re expecting to work with the URI restriction? Could you show me the URL?

That code doesn’t do anything at all, it doesn’t protect anything

That’s all that needs to be done, as far as I know. What directory did you choose? And what URL are you using for the protected file?

Posted: Friday Jun 28th, 2013 at 2:33 pm #52751

I tried different directories and files and wasn’t successful, but here’s one that should definitely work because it’s the standard media directory created by wordpress, and was the one that I did have working at one time:
(obviously I made the address anonymous with ####’s)

uri:
/wp-content/uploads/2013/06/

Code using the url, from the forum link in the last post:

<?php
   add_filter("ws_plugin__s2member_files_dir", "my_files_dir");
   function my_files_dir(){ return "/home/#######/public_html/#######/wp-content/uploads/2013/06/"; }
   ?>

The files I did get to be restricted at one time, were .jpg files.

Posted: Friday Jun 28th, 2013 at 9:17 pm #52766

Well, that hack won’t automatically protect that directory from any access, the .htaccess rules would be needed to take care of that. So this won’t be protected: [hilite mono]/wp-content/uploads/2013/06/photo.jpg[/hilite].

What you’re doing with the hack is tell s2Member to pick the file from that directory when you go through s2Member, like [hilite mono]/?s2member_file_download=photo.jpg[/hilite].

If you want to protect the custom directory with .htaccess, you could try the original .htaccess from s2member-files, which will probably need customization too.

Posted: Monday Jul 1st, 2013 at 8:19 pm #52849

If you want to protect the custom directory with .htaccess, you could try the original .htaccess from s2member-files, which will probably need customization too.

Yep, I already tried that and it didn’t work. I’m going to try to look at the htaccess again with a fresh look to see if I can figure out customizations to get it to work correctly, but I’m about ready to give up on this and just use the s2member file directory.

Posted: Tuesday Jul 2nd, 2013 at 6:01 am #52884

Okay. Let us know how it goes.

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.