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.

Loop for attachments that are secured with S2

Home Forums Community Forum Loop for attachments that are secured with S2

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

Topic Author Topic
Posted: Monday Mar 4th, 2013 at 12:04 pm #43710
david
Username: solar

I have my solid PHP loop for dsiplaying attachments of a post:

$args = array(
	'post_type'   => 'attachment',
	'numberposts' => -1,
	'post_parent' => get_the_ID(),
	'post_mime_type' => array('application/pdf','application/msword','application/mspowerpoint','application/zip'),
);

$documenti = get_posts($args);
if($documenti) {
		echo '<div class="gallery-documenti">';
		echo '<ul class="post_attachments">';
		foreach ($documenti as $documento) {	
				$class = "post-attachment mime-" . sanitize_title( $documento-&gt;post_mime_type );
				$titolo_documento = wp_get_attachment_url( $documento-&gt;ID );
				$nome_documento = $documento-&gt;post_title;
				$nome_documento_corto = substr( $nome_documento, 0, 40) . '...';
				$content .= '<li class="' . $class . '"><a href="' . $titolo_documento . '" target="_blank" class="att_icon" title="' . $nome_documento . '">' . $nome_documento . '</a></li>';	
					
		}echo $content;
		echo '</ul>';
		echo "<p class='clearfloat'></p>";
		echo '</div>';
}

I just need to modify it to get the url of the files uploaded to “/wp-content/plugins/s2member-files”.. I’m just making some stupid mistake I think, any help?

List Of Topic Replies

Viewing 5 replies - 1 through 5 (of 5 total)
Author Replies
Author Replies
Posted: Wednesday Mar 6th, 2013 at 6:25 am #43855

Hi David.

s2Member protected files aren’t attachments, though. You could probably use PHP to get a list of the files in the directory /wp-content/plugins/s2member-files/ and work with that.

Posted: Thursday Mar 7th, 2013 at 11:43 am #43966
david
Username: solar

Is there any way to treat them as post attachments either if secured?

Posted: Friday Mar 8th, 2013 at 10:32 am #44084
david
Username: solar

Hi Cristian,
Yes they are! I am just changing the target directory for uploads, but they are post attachments because I upload to the post through WordPress media manager. There is a plugin to do this job that was suggested in this forum: http://wordpress.org/extend/plugins/s2member-secure-file-uploader/

Posted: Sunday Mar 10th, 2013 at 1:10 am #44189

Ah, I see, you have a customized installation. I’m not familiar with this, sorry. Have you tried asking the developer of that plugin about it?

Or you can just try using PHP to list the files in the directory… https://www.google.com/search?q=php+list+files+in+directory

Posted: Sunday Mar 10th, 2013 at 1:18 am #44190

You could also try changing the s2Member protected folder to the default WP uploads one. Not sure if that’ll work, but you can try. http://www.primothemes.com/forums/viewtopic.php?f=36&t=2729&p=8018#p8018

Create this directory and file: /wp-content/mu-plugins/s2hacks.php
Knowledge Base » Hacking s2Member® Via Hooks/Filters

[hilite pre_code]

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