Version Description
- Added the option to limit available Attachments to the current user (defaults to false)
Download this release
Release Info
| Developer | jchristopher |
| Plugin | |
| Version | 1.0.5 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.4.2 to 1.0.5
- attachments.php +47 -2
- media.php +13 -1
- readme.txt +5 -2
attachments.php
CHANGED
|
@@ -3,9 +3,9 @@
|
|
| 3 |
Plugin Name: Attachments
|
| 4 |
Plugin URI: http://mondaybynoon.com/wordpress-attachments/
|
| 5 |
Description: Attachments gives the ability to append any number of Media Library items to Pages and Posts
|
| 6 |
-
Version: 1.0.
|
| 7 |
Author: Jonathan Christopher
|
| 8 |
-
Author URI: http://jchristopher.me
|
| 9 |
*/
|
| 10 |
|
| 11 |
/* Copyright 2009 Jonathan Christopher (email : jonathandchr@gmail.com)
|
|
@@ -41,6 +41,7 @@ global $wpdb;
|
|
| 41 |
add_action('admin_menu', 'attachments_init');
|
| 42 |
add_action('admin_head', 'attachments_init_js');
|
| 43 |
add_action('save_post', 'attachments_save');
|
|
|
|
| 44 |
|
| 45 |
|
| 46 |
|
|
@@ -63,6 +64,50 @@ function cmp($a, $b)
|
|
| 63 |
|
| 64 |
|
| 65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
/**
|
| 67 |
* Inserts HTML for meta box, including all existing attachments
|
| 68 |
*
|
| 3 |
Plugin Name: Attachments
|
| 4 |
Plugin URI: http://mondaybynoon.com/wordpress-attachments/
|
| 5 |
Description: Attachments gives the ability to append any number of Media Library items to Pages and Posts
|
| 6 |
+
Version: 1.0.5
|
| 7 |
Author: Jonathan Christopher
|
| 8 |
+
Author URI: http://jchristopher.me/
|
| 9 |
*/
|
| 10 |
|
| 11 |
/* Copyright 2009 Jonathan Christopher (email : jonathandchr@gmail.com)
|
| 41 |
add_action('admin_menu', 'attachments_init');
|
| 42 |
add_action('admin_head', 'attachments_init_js');
|
| 43 |
add_action('save_post', 'attachments_save');
|
| 44 |
+
add_action('admin_menu', 'attachments_menu');
|
| 45 |
|
| 46 |
|
| 47 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
+
|
| 68 |
+
/**
|
| 69 |
+
* Creates the markup for the WordPress admin options page
|
| 70 |
+
*
|
| 71 |
+
* @return void
|
| 72 |
+
* @author Jonathan Christopher
|
| 73 |
+
*/
|
| 74 |
+
function attachments_options()
|
| 75 |
+
{ ?>
|
| 76 |
+
<div class="wrap">
|
| 77 |
+
<div id="icon-options-general" class="icon32"><br /></div>
|
| 78 |
+
<h2>Attachments Options</h2>
|
| 79 |
+
<form action="options.php" method="post">
|
| 80 |
+
<?php wp_nonce_field('update-options'); ?>
|
| 81 |
+
<div style="padding:20px 0 0 0; overflow:hidden; zoom:1;">
|
| 82 |
+
<input type="checkbox" name="attachments_limit_to_user" style="display:block; float:left; margin-top:2px;" value="true"<?php if (get_option('attachments_limit_to_user')=='true') : ?> checked="checked"<?php endif ?> />
|
| 83 |
+
<span style="display:block; float:left; padding:0 0 0 7px;">Users can only see their own attachments</span>
|
| 84 |
+
</div>
|
| 85 |
+
<input type="hidden" name="action" value="update" />
|
| 86 |
+
<input type="hidden" name="page_options" value="attachments_limit_to_user" />
|
| 87 |
+
<p class="submit">
|
| 88 |
+
<input type="submit" class="button-primary" value="Save" />
|
| 89 |
+
</p>
|
| 90 |
+
</form>
|
| 91 |
+
</div>
|
| 92 |
+
<?php }
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
/**
|
| 98 |
+
* Creates the entry for Attachments Options under Settings in the WordPress Admin
|
| 99 |
+
*
|
| 100 |
+
* @return void
|
| 101 |
+
* @author Jonathan Christopher
|
| 102 |
+
*/
|
| 103 |
+
function attachments_menu()
|
| 104 |
+
{
|
| 105 |
+
add_options_page('Settings', 'Attachments', 8, __FILE__, 'attachments_options');
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
|
| 111 |
/**
|
| 112 |
* Inserts HTML for meta box, including all existing attachments
|
| 113 |
*
|
media.php
CHANGED
|
@@ -3,9 +3,21 @@ error_reporting(0);
|
|
| 3 |
require( dirname(__FILE__) . '/../../../wp-config.php' );
|
| 4 |
|
| 5 |
global $wpdb;
|
|
|
|
| 6 |
|
| 7 |
-
|
|
|
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
// ================
|
| 11 |
// = IMAGES FIRST =
|
| 3 |
require( dirname(__FILE__) . '/../../../wp-config.php' );
|
| 4 |
|
| 5 |
global $wpdb;
|
| 6 |
+
global $userdata;
|
| 7 |
|
| 8 |
+
// set the user info in case we need to limit to the current author
|
| 9 |
+
get_currentuserinfo();
|
| 10 |
|
| 11 |
+
if( get_option('attachments_limit_to_user') == 'true' )
|
| 12 |
+
{
|
| 13 |
+
$attachments_sql = "SELECT * FROM $wpdb->posts WHERE post_type = 'attachment' AND post_author = " . $userdata->ID . " ORDER BY post_modified DESC";
|
| 14 |
+
}
|
| 15 |
+
else
|
| 16 |
+
{
|
| 17 |
+
$attachments_sql = "SELECT * FROM $wpdb->posts WHERE post_type = 'attachment' ORDER BY post_modified DESC";
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
$attachment_files = $wpdb->get_results( $attachments_sql );
|
| 21 |
|
| 22 |
// ================
|
| 23 |
// = IMAGES FIRST =
|
readme.txt
CHANGED
|
@@ -3,8 +3,8 @@ Contributors: jchristopher
|
|
| 3 |
Donate link: http://mondaybynoon.com/donate/
|
| 4 |
Tags: post, page, posts, pages, images, PDF, doc, Word, image, jpg, jpeg, picture, pictures, photos, attachment
|
| 5 |
Requires at least: 2.8
|
| 6 |
-
Tested up to: 2.9
|
| 7 |
-
Stable tag: 1.0.
|
| 8 |
|
| 9 |
Attachments allows you to append any number of items from your WordPress Media Library to Posts and Pages
|
| 10 |
|
|
@@ -33,6 +33,9 @@ Attachments uses WordPress' built in Media library for uploads and storage.
|
|
| 33 |
|
| 34 |
== Changelog ==
|
| 35 |
|
|
|
|
|
|
|
|
|
|
| 36 |
= 1.0.4.1 =
|
| 37 |
* Removed all shortcodes in an effort to boost compatibility
|
| 38 |
|
| 3 |
Donate link: http://mondaybynoon.com/donate/
|
| 4 |
Tags: post, page, posts, pages, images, PDF, doc, Word, image, jpg, jpeg, picture, pictures, photos, attachment
|
| 5 |
Requires at least: 2.8
|
| 6 |
+
Tested up to: 2.9.1
|
| 7 |
+
Stable tag: 1.0.5
|
| 8 |
|
| 9 |
Attachments allows you to append any number of items from your WordPress Media Library to Posts and Pages
|
| 10 |
|
| 33 |
|
| 34 |
== Changelog ==
|
| 35 |
|
| 36 |
+
= 1.0.5 =
|
| 37 |
+
* Added the option to limit available Attachments to the current user (defaults to *false*)
|
| 38 |
+
|
| 39 |
= 1.0.4.1 =
|
| 40 |
* Removed all shortcodes in an effort to boost compatibility
|
| 41 |
|
