Community Support Forums — WordPress® ( Users Helping Users ) — 2011-05-31T22:57:09-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=6638 2011-05-31T22:57:09-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6638&p=16460#p16460 <![CDATA[Re: Allow access to a download protected file for anyone]]>

Statistics: Posted by Cristián Lávaque — May 31st, 2011, 10:57 pm


]]>
2011-05-31T22:36:06-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6638&p=16458#p16458 <![CDATA[Re: Allow access to a download protected file for anyone]]>
Here's the code for anyone who needs this functionality.

NextGEN documentation will tell you how to edit the album-extend.php and where to put it and all that. So, in "album-extend.php" (or "album-compact.php"), just after the line
Code:
<?php foreach ($galleries as $gallery) :

I inserted
Code:
   /** Takes gallery thumbnail and edits the url so s2member will allow access by anyone **/
   $thumbfilename = "thumbs_".$gallery->previewname;
   $thumburl = $gallery->previewurl;
   //cut down to just the relative path
   $urlpieces = parse_url($thumburl);
   $thumbpath = $urlpieces['query'];
   //cut out the "s2member_file_download=" part
   $thumbpath = str_replace("s2member_file_download=", '', $thumbpath);
   //Make key
   $key = s2member_file_download_key("$thumbpath");
   //Add key
   $keystring = "&s2member_file_download_key=".$key;
   $keyedurl = $gallery->previewurl . $keystring;


Then just below that, in the "ngg-thumbnail" class, change
Code:
src="<?php echo $gallery->previewurl ?>

into
Code:
src="<?php /*Here's the part I changed*/ echo $keyedurl; ?>

Statistics: Posted by StenCade — May 31st, 2011, 10:36 pm


]]>
2011-05-31T18:33:52-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6638&p=16441#p16441 <![CDATA[Re: Allow access to a download protected file for anyone]]>
Let me mess with is a bit and see if I can't find my mistake. At least I know I'm on the right track!

Statistics: Posted by StenCade — May 31st, 2011, 6:33 pm


]]>
2011-05-31T13:29:44-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6638&p=16420#p16420 <![CDATA[Re: Allow access to a download protected file for anyone]]>
Why would the keys not work for that? They're not limited by number of downloads, they just have a 24 hour expiration, but the key gets generated each time the page is, thus starting a new 24 hrs before expiration.

Statistics: Posted by Cristián Lávaque — May 31st, 2011, 1:29 pm


]]>
2011-05-31T03:35:27-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6638&p=16387#p16387 <![CDATA[Allow access to a download protected file for anyone]]>
I am trying to use s2member in conjunction with the NextGEN gallery plugin. What I want is for anyone to be able to access the public album page, which shows a thumbnail, description, etc of each protected photo gallery. This is easy to do by making the album page public and the gallery pages protected.

However, I would also like the added security of download protection. I moved the gallery files into the s2member-files folder and set protected jpgs to display inline. The galleries work as expected. However, this obviously means that the thumbnail images, which are generated and stored by NextGEN all in the same subfolder, no longer display on my public page.

It would be a serious pain to have to code the thumbnails in manually, not to mention a bit too much for my client to handle. Is there a way that I can allow a handful of specific files in the same folder as my protected files to be seen by anyone? The Key thing doesn't work because I need anyone to be able to see the images as many times as they load the album page.

Thanks!
Sten

Statistics: Posted by StenCade — May 31st, 2011, 3:35 am


]]>