Community Support Forums — WordPress® ( Users Helping Users ) — 2012-01-24T14:10:55-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=16978 2012-01-24T14:10:55-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16978&p=61422#p61422 <![CDATA[Re: Protecting images]]>
You don't need to use the <img src="" />, the inline="yes" in the shortcode should make the image appear there.

Hope this helps. :)

Statistics: Posted by Eduan — January 24th, 2012, 2:10 pm


]]>
2012-01-24T13:57:01-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16978&p=61416#p61416 <![CDATA[Re: Protecting images]]>
<img src="[s2File download="access-s2member-level1/images/image-1-cat.png" inline="yes" /]">

Statistics: Posted by philipt18 — January 24th, 2012, 1:57 pm


]]>
2012-01-24T12:57:29-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16978&p=61399#p61399 <![CDATA[Re: Protecting images]]>
philipt18 wrote:
Just to be clear, I don't need to copy the .htaccess file to sub-folders, right?

You are correct. :)

philipt18 wrote:
Also, I'm not clear on the folder access-s2member-level1 you created. There is nothing special to that name is there? I didn't see a way to restrict different folders with different levels. Is that just a name you made up, or is there actually a sub-folder you can use for specific levels?

This is a special folder, this folder specifies that only level 1 will be able to access the files in this sub-folder, so it is essential if you have different levels. Check under WP Admin -> s2Member -> API / Scripting -> Custom Capability & Member Level Files for more information on the subject.

philipt18 wrote:
If I left out that just used images/ it would be the same, no?

The same to what? If you mean the restrictions will be the same, then yes.

philipt18 wrote:
Also, the shortcodes you've used would actually prevent someone with a level higher than 1 from accessing the files, right? Instead, if I wanted all users from level 1 and up to access, I would use [s2If current_user_can(access_s2member_level1)] I would guess.

You are correct. :)

Statistics: Posted by Eduan — January 24th, 2012, 12:57 pm


]]>
2012-01-24T11:29:51-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16978&p=61391#p61391 <![CDATA[Re: Protecting images]]>
Also, I'm not clear on the folder access-s2member-level1 you created. There is nothing special to that name is there? I didn't see a way to restrict different folders with different levels. Is that just a name you made up, or is there actually a sub-folder you can use for specific levels?

If I left out that just used images/ it would be the same, no?

Also, the shortcodes you've used would actually prevent someone with a level higher than 1 from accessing the files, right? Instead, if I wanted all users from level 1 and up to access, I would use [s2If current_user_can(access_s2member_level1)] I would guess.

Eduan wrote:
EDIT: This is an edit to the post above: The s2member-files folder should come with an .htaccess file, you must preserve that file.

You would insert the sub-folder in the s2member-files folder.

So let's say I have the sub-folder named "images", in which I'm going to insert images, so the URL for that would be:
/s2member-files/images

Now, in that folder I want a file named "image-1-cat.png", so the URL for that file would be:
/s2member-files/images/image-1-cat.png

Is that clear?

Now, if I want to protect that file with level 1, I would add
/s2member-files/access-s2member-level1/images/image-1-cat.png

The shortcode for all of this would be:
[s2If current_user_is(s2member_level1)]
This is an image, only for members level 1:
[s2File download="access-s2member-level1/images/image-1-cat.png" inline="yes" /]
[/s2If]
[s2If !current_user_is(s2member_level1)]
You must be a member level 1 in order to see this image
[/s2If]

Hope this clears some things up. :)

Statistics: Posted by philipt18 — January 24th, 2012, 11:29 am


]]>
2012-01-24T10:57:50-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16978&p=61388#p61388 <![CDATA[Re: Protecting images]]> EDIT: This is an edit to the post above: The s2member-files folder should come with an .htaccess file, you must preserve that file.

You would insert the sub-folder in the s2member-files folder.

So let's say I have the sub-folder named "images", in which I'm going to insert images, so the URL for that would be:
/s2member-files/images

Now, in that folder I want a file named "image-1-cat.png", so the URL for that file would be:
/s2member-files/images/image-1-cat.png

Is that clear?

Now, if I want to protect that file with level 1, I would add
/s2member-files/access-s2member-level1/images/image-1-cat.png

The shortcode for all of this would be:
[s2If current_user_is(s2member_level1)]
This is an image, only for members level 1:
[s2File download="access-s2member-level1/images/image-1-cat.png" inline="yes" /]
[/s2If]
[s2If !current_user_is(s2member_level1)]
You must be a member level 1 in order to see this image
[/s2If]

Hope this clears some things up. :)

Statistics: Posted by Eduan — January 24th, 2012, 10:57 am


]]>
2012-01-24T09:55:04-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16978&p=61383#p61383 <![CDATA[Re: Protecting images]]>
wp-content/plugins/s2member-files/file-in-the-s2member-files-folder


in my original example. For sub-directory SUBFOLDER would it be?:

<img src="[s2If current_user_can(access_s2member_level1)]http://genealogy.org.il/wordpress/?s2member_file_download=SUBFOLDER/1923_nurses.png&s2member_file_download_key=<?php echo s2member_file_download_key("1923_nurses.png"); ?>
[/s2If]


I'm not sure that makes sense. Do I need the subfolder for the key also?

Thanks.

Eduan wrote:
I believe that would work yes.

You can have sub-folders, you can have as many sub-folders as you want, s2Member won't limit you on this manner, just make sure you don't confuse yourself. ;)

In order to put a sub-folder in the url simply put another forward slash ( / ), so if I want to access a normal file the url would be:
wp-content/plugins/s2member-files/file-in-the-s2member-files-folder

That would give me access to any file in the s2Member files folder, just make sure to put the name correctly, because it's case sensitive.

And so, if you want to access a sub-folder, simply put:
wp-content/plugins/s2member-files/sub-folder/file-in-the-sub-folder

Does this make sense?

Statistics: Posted by philipt18 — January 24th, 2012, 9:55 am


]]>
2012-01-24T09:45:10-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16978&p=61381#p61381 <![CDATA[Re: Protecting images]]> Statistics: Posted by Eduan — January 24th, 2012, 9:45 am


]]>
2012-01-24T09:27:39-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16978&p=61380#p61380 <![CDATA[Re: Protecting images]]>
Thanks.

Eduan wrote:
I believe that would work yes.

You can have sub-folders, you can have as many sub-folders as you want, s2Member won't limit you on this manner, just make sure you don't confuse yourself. ;)

In order to put a sub-folder in the url simply put another forward slash ( / ), so if I want to access a normal file the url would be:
wp-content/plugins/s2member-files/file-in-the-s2member-files-folder

That would give me access to any file in the s2Member files folder, just make sure to put the name correctly, because it's case sensitive.

And so, if you want to access a sub-folder, simply put:
wp-content/plugins/s2member-files/sub-folder/file-in-the-sub-folder

Does this make sense?

Statistics: Posted by philipt18 — January 24th, 2012, 9:27 am


]]>
2012-01-24T08:42:40-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16978&p=61378#p61378 <![CDATA[Re: Protecting images]]>
Code:
<?php
header ('HTTP/1.1 301 Moved Permanently');
header ('Location: '.get_permalink($post->post_parent));
?>


so the visitor cannot visit the image attachment page.
Well, it's only if you want to use the image functions in WP :-)

Statistics: Posted by camillemm — January 24th, 2012, 8:42 am


]]>
2012-01-24T08:10:08-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16978&p=61375#p61375 <![CDATA[Re: Protecting images]]>
You can have sub-folders, you can have as many sub-folders as you want, s2Member won't limit you on this manner, just make sure you don't confuse yourself. ;)

In order to put a sub-folder in the url simply put another forward slash ( / ), so if I want to access a normal file the url would be:
wp-content/plugins/s2member-files/file-in-the-s2member-files-folder

That would give me access to any file in the s2Member files folder, just make sure to put the name correctly, because it's case sensitive.

And so, if you want to access a sub-folder, simply put:
wp-content/plugins/s2member-files/sub-folder/file-in-the-sub-folder

Does this make sense?

Statistics: Posted by Eduan — January 24th, 2012, 8:10 am


]]>
2012-01-24T06:04:09-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16978&p=61372#p61372 <![CDATA[Re: Protecting images]]>
<img src="http://SITENAME/RESTRICTED.PNG">

I would instead put:

<img src="[s2If current_user_can(access_s2member_level1)]
http://SITENAME/wordpress/?s2member_fil ... nload_key=<?php echo s2member_file_download_key("RESTRICTED.PNG"); ?>
[/s2If]
[s2If !current_user_can(access_s2member_level1)]
http://SITENAME/images/PLACEHOLDER.PNG
[/s2If]">

Where the RESTRICTED.PNG is now in the s2member-files folder, and PLACEHOLDER.PNG is what is shown to users who don't have access to the image?

Can I have sub-folders in the /wordpress/wp-content/plugins/s2member-files folder? If so, how would I create the URL to link to files in sub-folders? Thanks.

Statistics: Posted by philipt18 — January 24th, 2012, 6:04 am


]]>
2012-01-23T19:50:28-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16978&p=61353#p61353 <![CDATA[Re: Protecting images]]> 1. Create a page, with no page/post protections from s2Member.

2. Use s2Member conditionals to show the message if the user is not registered, and to show the image link/inline if they are registered, you can find the shortcode versions under WP Admin -> s2Member -> API / Scripting -> Simple/Shortcode Conditionals.

You can find the PHP versions under WP Admin -> s2Member -> API / Scripting -> Advanced/PHP Conditionals. For these you will need the Exec-PHP plugin or any other WordPress plugin that allows you to insert PHP into posts/pages.

3. Protect the image with the s2Member file protections, you can choose to show it inline, or to make the users download the image. Check this video on how to set them up. You can also check under WP Admin -> s2Member -> Download Options for all the info on how to accomplish the file restrictions, and on how to show it inline.

Hope this helps. :)

Statistics: Posted by Eduan — January 23rd, 2012, 7:50 pm


]]>
2012-01-23T04:47:45-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16978&p=61260#p61260 <![CDATA[Protecting images]]>
I thought about putting the images in a sub-directory of my public_html directory, and then using URI Restrictions to restrict access to that sub-directory. This kind of works, but doesn't solve the issue of displaying a message when someone who is not a member tries to view the image. I was wondering what other solutions people have come up with for this problem.

Is there a way of displaying a different image for non-members (i.e. a kind of placeholder image that says members-only)? Is there a way to prevent images from being downloaded by users, even if they are members? Is there a way to hide the URL to the image?

Any suggestions on how best to handle protecting images using s2member would be greatly appreciated. Thanks.

Statistics: Posted by philipt18 — January 23rd, 2012, 4:47 am


]]>