Version Description
- Added more verification to check whether the object being used is available or not.
- Added custom message on delete activity action.
- Modified the upgrade loop to handle the sites with large number of media files.
Download this release
Release Info
Developer | rtcamp |
Plugin | rtMedia for WordPress, BuddyPress and bbPress |
Version | 2.2.3 |
Comparing to | |
See all releases |
Code changes from version 2.2.2 to 2.2.3
- includes/bp-media-actions.php +6 -2
- includes/bp-media-class-album.php +3 -0
- includes/bp-media-filters.php +6 -0
- includes/bp-media-functions.php +8 -4
- includes/bp-media-upgrade-script.php +48 -43
- includes/bp-media-widgets.php +2 -2
- includes/js/bp-media.js +12 -0
- loader.php +2 -2
- readme.txt +9 -4
includes/bp-media-actions.php
CHANGED
@@ -126,6 +126,8 @@ function bp_media_delete_activity_handler($args){
|
|
126 |
$post_id=$result[0]->post_id;
|
127 |
try{
|
128 |
$post = get_post($post_id);
|
|
|
|
|
129 |
switch($post->post_type){
|
130 |
case 'attachment':
|
131 |
$media = new BP_Media_Host_Wordpress($post_id);
|
@@ -149,6 +151,8 @@ function bp_media_delete_media_handler($media_id){
|
|
149 |
/* @var $media BP_Media_Host_Wordpress */
|
150 |
remove_action('bp_before_activity_delete', 'bp_media_delete_activity_handler');
|
151 |
$activity_id = get_post_meta($media_id,'bp_media_child_activity',true);
|
|
|
|
|
152 |
bp_activity_delete_by_activity_id($activity_id);
|
153 |
}
|
154 |
add_action('bp_media_before_delete_media','bp_media_delete_media_handler');
|
@@ -234,7 +238,7 @@ function bp_media_init_count($user = null) {
|
|
234 |
}
|
235 |
$count = bp_get_user_meta($user, 'bp_media_count', true);
|
236 |
if (!$count) {
|
237 |
-
$bp_media_count = array('images' => 0, 'videos' => 0, 'audio' => 0);
|
238 |
bp_update_user_meta($user, 'bp_media_count', $bp_media_count);
|
239 |
} else {
|
240 |
$bp_media_count = $count;
|
@@ -272,7 +276,7 @@ function bp_media_upload_enqueue(){
|
|
272 |
'browse_button' => 'bp-media-upload-browse-button',
|
273 |
'container' => 'bp-media-upload-ui',
|
274 |
'drop_element' => 'drag-drop-area',
|
275 |
-
'filters' => array(array('title' => "Media Files",'extensions'=> "mp4,jpg,png,jpeg,gif,mp3")),
|
276 |
'max_file_size' => min(array(ini_get('upload_max_filesize'),ini_get('post_max_size'))),
|
277 |
'multipart' => true,
|
278 |
'urlstream_upload' => true,
|
126 |
$post_id=$result[0]->post_id;
|
127 |
try{
|
128 |
$post = get_post($post_id);
|
129 |
+
if(!isset($post->post_type))
|
130 |
+
return false;
|
131 |
switch($post->post_type){
|
132 |
case 'attachment':
|
133 |
$media = new BP_Media_Host_Wordpress($post_id);
|
151 |
/* @var $media BP_Media_Host_Wordpress */
|
152 |
remove_action('bp_before_activity_delete', 'bp_media_delete_activity_handler');
|
153 |
$activity_id = get_post_meta($media_id,'bp_media_child_activity',true);
|
154 |
+
if($activity_id==NULL)
|
155 |
+
return false;
|
156 |
bp_activity_delete_by_activity_id($activity_id);
|
157 |
}
|
158 |
add_action('bp_media_before_delete_media','bp_media_delete_media_handler');
|
238 |
}
|
239 |
$count = bp_get_user_meta($user, 'bp_media_count', true);
|
240 |
if (!$count) {
|
241 |
+
$bp_media_count = array('images' => 0, 'videos' => 0, 'audio' => 0, 'albums' => 0);
|
242 |
bp_update_user_meta($user, 'bp_media_count', $bp_media_count);
|
243 |
} else {
|
244 |
$bp_media_count = $count;
|
276 |
'browse_button' => 'bp-media-upload-browse-button',
|
277 |
'container' => 'bp-media-upload-ui',
|
278 |
'drop_element' => 'drag-drop-area',
|
279 |
+
'filters' => apply_filters('bp_media_plupload_files_filter',array(array('title' => "Media Files",'extensions'=> "mp4,jpg,png,jpeg,gif,mp3"))),
|
280 |
'max_file_size' => min(array(ini_get('upload_max_filesize'),ini_get('post_max_size'))),
|
281 |
'multipart' => true,
|
282 |
'urlstream_upload' => true,
|
includes/bp-media-class-album.php
CHANGED
@@ -101,7 +101,10 @@ class BP_Media_Album{
|
|
101 |
function delete_album(){
|
102 |
do_action('bp_media_before_delete_album', $this);
|
103 |
foreach($this->media_entries as $entry){
|
|
|
|
|
104 |
wp_delete_attachment($entry->ID,true);
|
|
|
105 |
}
|
106 |
$author_id = $this->owner;
|
107 |
bp_media_init_count($author_id);
|
101 |
function delete_album(){
|
102 |
do_action('bp_media_before_delete_album', $this);
|
103 |
foreach($this->media_entries as $entry){
|
104 |
+
bp_media_delete_media_handler($entry->ID);
|
105 |
+
//do_action('bp_media_before_delete_media',$entry->ID); //Not working for some reason so called the required function directly
|
106 |
wp_delete_attachment($entry->ID,true);
|
107 |
+
do_action('bp_media_after_delete_media',$entry->ID);
|
108 |
}
|
109 |
$author_id = $this->owner;
|
110 |
bp_media_init_count($author_id);
|
includes/bp-media-filters.php
CHANGED
@@ -88,6 +88,12 @@ add_filter('bp_get_activity_delete_link','bp_media_delete_button_handler');
|
|
88 |
|
89 |
function bp_media_items_count_filter ($title,$nav_item) {
|
90 |
global $bp_media_count;
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
switch($nav_item['slug']){
|
92 |
case BP_MEDIA_SLUG :
|
93 |
$count= intval($bp_media_count['images'])+intval($bp_media_count['videos'])+intval($bp_media_count['audio']);
|
88 |
|
89 |
function bp_media_items_count_filter ($title,$nav_item) {
|
90 |
global $bp_media_count;
|
91 |
+
$bp_media_count = wp_parse_args($bp_media_count,array(
|
92 |
+
'images' => 0,
|
93 |
+
'videos' => 0,
|
94 |
+
'audio' => 0,
|
95 |
+
'albums' => 0
|
96 |
+
));
|
97 |
switch($nav_item['slug']){
|
98 |
case BP_MEDIA_SLUG :
|
99 |
$count= intval($bp_media_count['images'])+intval($bp_media_count['videos'])+intval($bp_media_count['audio']);
|
includes/bp-media-functions.php
CHANGED
@@ -96,12 +96,16 @@ function bp_media_update_count() {
|
|
96 |
( post_mime_type LIKE 'image%' OR post_mime_type LIKE 'audio%' OR post_mime_type LIKE 'video%' OR post_type LIKE 'bp_media_album')
|
97 |
GROUP BY post_author";
|
98 |
$result = $wpdb->get_results($query);
|
|
|
|
|
|
|
99 |
foreach ($result as $obj) {
|
|
|
100 |
$count = array(
|
101 |
-
'images' => $obj->Images,
|
102 |
-
'videos' => $obj->Videos,
|
103 |
-
'audio' => $obj->Audio,
|
104 |
-
'albums'=> $obj->Albums
|
105 |
);
|
106 |
bp_update_user_meta($obj->post_author, 'bp_media_count', $count);
|
107 |
}
|
96 |
( post_mime_type LIKE 'image%' OR post_mime_type LIKE 'audio%' OR post_mime_type LIKE 'video%' OR post_type LIKE 'bp_media_album')
|
97 |
GROUP BY post_author";
|
98 |
$result = $wpdb->get_results($query);
|
99 |
+
if(!is_array($result))
|
100 |
+
return false;
|
101 |
+
|
102 |
foreach ($result as $obj) {
|
103 |
+
|
104 |
$count = array(
|
105 |
+
'images' => isset($obj->Images)?$obj->Images:0,
|
106 |
+
'videos' => isset($obj->Videos)?$obj->Videos:0,
|
107 |
+
'audio' => isset($obj->Audio)?$obj->Audio:0,
|
108 |
+
'albums'=> isset($obj->Albums)?$obj->Albums:0
|
109 |
);
|
110 |
bp_update_user_meta($obj->post_author, 'bp_media_count', $count);
|
111 |
}
|
includes/bp-media-upgrade-script.php
CHANGED
@@ -4,54 +4,59 @@ function bp_media_upgrade_to_2_2(){
|
|
4 |
global $wpdb;
|
5 |
remove_filter('bp_activity_get_user_join_filter','bp_media_activity_query_filter',10);
|
6 |
/* @var $wpdb wpdb */
|
7 |
-
$media_files = new WP_Query(array(
|
8 |
-
'post_type' => 'bp_media',
|
9 |
-
'posts_per_page' => -1
|
10 |
-
));
|
11 |
-
$media_files = $media_files->posts;
|
12 |
$wall_posts_album_ids=array();
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
$
|
27 |
-
$wall_posts_id = $album->get_id();
|
28 |
}
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
}
|
32 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
}
|
34 |
-
$attachment['post_parent'] = $wall_posts_id;
|
35 |
-
wp_update_post($attachment);
|
36 |
-
update_post_meta($attachment_id,'bp-media-key',$media_file->post_author);
|
37 |
-
$activity = bp_activity_get(array('in'=>intval($child_activity)));
|
38 |
-
if(isset($activity['activities'][0]->id))
|
39 |
-
$activity = $activity['activities'][0];
|
40 |
-
$bp_media = new BP_Media_Host_Wordpress($attachment_id);
|
41 |
-
$args = array(
|
42 |
-
'content' => $bp_media->get_media_activity_content(),
|
43 |
-
'id' => $child_activity,
|
44 |
-
'type' => 'media_upload',
|
45 |
-
'action' => apply_filters( 'bp_media_added_media', sprintf( __( '%1$s added a %2$s', 'bp-media'), bp_core_get_userlink( $media_file->post_author ), '<a href="' . $bp_media->get_url() . '">' . $bp_media->get_media_activity_type() . '</a>' ) ),
|
46 |
-
'primary_link' => $bp_media->get_url(),
|
47 |
-
'item_id' => $attachment_id,
|
48 |
-
'recorded_time' => $activity->date_recorded,
|
49 |
-
);
|
50 |
-
$act_id = bp_media_record_activity($args);
|
51 |
-
bp_activity_delete_meta($child_activity, 'bp_media_parent_post');
|
52 |
-
wp_delete_post($media_file->ID);
|
53 |
}
|
54 |
-
|
|
|
|
|
|
|
55 |
update_option('bp_media_db_version',BP_MEDIA_DB_VERSION);
|
56 |
add_action('admin_notices','bp_media_database_updated_notice');
|
57 |
wp_cache_flush();
|
4 |
global $wpdb;
|
5 |
remove_filter('bp_activity_get_user_join_filter','bp_media_activity_query_filter',10);
|
6 |
/* @var $wpdb wpdb */
|
|
|
|
|
|
|
|
|
|
|
7 |
$wall_posts_album_ids=array();
|
8 |
+
do{
|
9 |
+
$media_files = new WP_Query(array(
|
10 |
+
'post_type' => 'bp_media',
|
11 |
+
'posts_per_page' => 10
|
12 |
+
));
|
13 |
+
$media_files = isset($media_files->posts)?$media_files->posts:null;
|
14 |
+
if(is_array($media_files)&&count($media_files)){
|
15 |
+
foreach($media_files as $media_file){
|
16 |
+
$attachment_id = get_post_meta($media_file->ID,'bp_media_child_attachment',true);
|
17 |
+
$child_activity = get_post_meta($media_file->ID,'bp_media_child_activity',true);
|
18 |
+
update_post_meta($attachment_id, 'bp_media_child_activity', $child_activity);
|
19 |
+
$attachment = get_post($attachment_id , ARRAY_A);
|
20 |
+
if(isset($wall_posts_album_ids[$media_file->post_author])){
|
21 |
+
$wall_posts_id = $wall_posts_album_ids[$media_file->post_author];
|
|
|
22 |
}
|
23 |
+
else{
|
24 |
+
$wall_posts_id = $wpdb->get_var( "SELECT ID FROM $wpdb->posts WHERE post_title = 'Wall Posts' AND post_author = '". $media_file->post_author."' AND post_type='bp_media_album'");
|
25 |
+
if($wall_posts_id==null){
|
26 |
+
$album = new BP_Media_Album();
|
27 |
+
$album->add_album('Wall Posts',$media_file->post_author);
|
28 |
+
$wall_posts_id = $album->get_id();
|
29 |
+
}
|
30 |
+
if(!$wall_posts_id){
|
31 |
+
continue; //This condition should never be encountered
|
32 |
+
}
|
33 |
+
$wall_posts_album_ids[$media_file->post_author] = $wall_posts_id;
|
34 |
}
|
35 |
+
$attachment['post_parent'] = $wall_posts_id;
|
36 |
+
wp_update_post($attachment);
|
37 |
+
update_post_meta($attachment_id,'bp-media-key',$media_file->post_author);
|
38 |
+
$activity = bp_activity_get(array('in'=>intval($child_activity)));
|
39 |
+
if(isset($activity['activities'][0]->id))
|
40 |
+
$activity = $activity['activities'][0];
|
41 |
+
$bp_media = new BP_Media_Host_Wordpress($attachment_id);
|
42 |
+
$args = array(
|
43 |
+
'content' => $bp_media->get_media_activity_content(),
|
44 |
+
'id' => $child_activity,
|
45 |
+
'type' => 'media_upload',
|
46 |
+
'action' => apply_filters( 'bp_media_added_media', sprintf( __( '%1$s added a %2$s', 'bp-media'), bp_core_get_userlink( $media_file->post_author ), '<a href="' . $bp_media->get_url() . '">' . $bp_media->get_media_activity_type() . '</a>' ) ),
|
47 |
+
'primary_link' => $bp_media->get_url(),
|
48 |
+
'item_id' => $attachment_id,
|
49 |
+
'recorded_time' => $activity->date_recorded,
|
50 |
+
);
|
51 |
+
$act_id = bp_media_record_activity($args);
|
52 |
+
bp_activity_delete_meta($child_activity, 'bp_media_parent_post');
|
53 |
+
wp_delete_post($media_file->ID);
|
54 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
}
|
56 |
+
else{
|
57 |
+
break;
|
58 |
+
}
|
59 |
+
}while(1);
|
60 |
update_option('bp_media_db_version',BP_MEDIA_DB_VERSION);
|
61 |
add_action('admin_notices','bp_media_database_updated_notice');
|
62 |
wp_cache_flush();
|
includes/bp-media-widgets.php
CHANGED
@@ -210,7 +210,7 @@ class BP_Media_Popular_Media extends WP_Widget {
|
|
210 |
function widget($args, $instance) {
|
211 |
extract( $args );
|
212 |
|
213 |
-
$title = apply_filters('widget_title', empty($instance['title']) ? __('
|
214 |
|
215 |
if ( empty( $instance['number'] ) || ! $number = absint( $instance['number'] ) )
|
216 |
$number = 10;
|
@@ -288,4 +288,4 @@ function bp_media_widgets_init(){
|
|
288 |
}
|
289 |
|
290 |
/* Initialize widgets */
|
291 |
-
add_action('widgets_init', 'bp_media_widgets_init', 1);
|
210 |
function widget($args, $instance) {
|
211 |
extract( $args );
|
212 |
|
213 |
+
$title = apply_filters('widget_title', empty($instance['title']) ? __('Popular Media', 'bp-media') : $instance['title'], $instance, $this->id_base);
|
214 |
|
215 |
if ( empty( $instance['number'] ) || ! $number = absint( $instance['number'] ) )
|
216 |
$number = 10;
|
288 |
}
|
289 |
|
290 |
/* Initialize widgets */
|
291 |
+
add_action('widgets_init', 'bp_media_widgets_init', 1);
|
includes/js/bp-media.js
CHANGED
@@ -61,4 +61,16 @@ jQuery(document).ready(function(){
|
|
61 |
jQuery('#bp-media-list').append(response);
|
62 |
});
|
63 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
});
|
61 |
jQuery('#bp-media-list').append(response);
|
62 |
});
|
63 |
});
|
64 |
+
setTimeout(function(){
|
65 |
+
jQuery('.media album_updated .delete-activity,.media_upload .delete-activity').unbind('click').click(function(e){
|
66 |
+
if(confirm('Are you sure you want to delete this activity and associated media?')){
|
67 |
+
return true;
|
68 |
+
}
|
69 |
+
else{
|
70 |
+
return false;
|
71 |
+
}
|
72 |
+
});
|
73 |
+
|
74 |
+
},1000);
|
75 |
+
|
76 |
});
|
loader.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: BuddyPress Media
|
4 |
Plugin URI: http://rtcamp.com/buddypress-media/
|
5 |
Description: This plugin adds missing media rich features like photos, videos and audios uploading to BuddyPress which are essential if you are building social network, seriously!
|
6 |
-
Version: 2.2.
|
7 |
Author: rtCamp
|
8 |
Author URI: http://rtcamp.com
|
9 |
*/
|
@@ -12,7 +12,7 @@ Author URI: http://rtcamp.com
|
|
12 |
define('BP_MEDIA_IS_INSTALLED', 1);
|
13 |
|
14 |
/* Constant to store the current version of the BP Media Plugin. */
|
15 |
-
define('BP_MEDIA_VERSION', '2.2.
|
16 |
|
17 |
/* A constant to be used as base for other URLs throughout the plugin */
|
18 |
define('BP_MEDIA_PLUGIN_DIR', dirname(__FILE__));
|
3 |
Plugin Name: BuddyPress Media
|
4 |
Plugin URI: http://rtcamp.com/buddypress-media/
|
5 |
Description: This plugin adds missing media rich features like photos, videos and audios uploading to BuddyPress which are essential if you are building social network, seriously!
|
6 |
+
Version: 2.2.3
|
7 |
Author: rtCamp
|
8 |
Author URI: http://rtcamp.com
|
9 |
*/
|
12 |
define('BP_MEDIA_IS_INSTALLED', 1);
|
13 |
|
14 |
/* Constant to store the current version of the BP Media Plugin. */
|
15 |
+
define('BP_MEDIA_VERSION', '2.2.3');
|
16 |
|
17 |
/* A constant to be used as base for other URLs throughout the plugin */
|
18 |
define('BP_MEDIA_PLUGIN_DIR', dirname(__FILE__));
|
readme.txt
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
=== BuddyPress Media ===
|
2 |
Contributors: rtcamp, rahul286, gagan0123, umeshnevase
|
3 |
-
Donate link:
|
4 |
Tags: BuddyPress, media, multimedia, album, audio, songs, music, video, photo, image, upload, share, MediaElement.js, ffmpeg, kaltura, media-node
|
5 |
License: GPLv2 or later
|
6 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
7 |
Requires at least: 3.3.2
|
8 |
Tested up to: 3.4.2
|
9 |
-
Stable tag: 2.2.
|
10 |
|
11 |
Adds Photos, Music, Videos & Albums to your BuddyPress. Supports mobile devices (iPhone/iPad, etc) and automatic audio/video conversion.
|
12 |
|
@@ -18,7 +18,7 @@ BuddyPress Media adds Photos, Music, Videos & Albums to your BuddyPress. Support
|
|
18 |
|
19 |
* Images, Music, Videos Upload
|
20 |
* User-Albums Support
|
21 |
-
* Multiple files upload with
|
22 |
* Uploading Photos/Videos via mobile (Tested on iPhone running iOS6)
|
23 |
* HTML5 player (with fall back to flash/silverlight player support)
|
24 |
* Automatic conversion of common audio & video formats to mp3/mp4. via [Kaltura Add-On](http://rtcamp.com/store/buddypress-media-kaltura/ "BuddyPress Media Kaltura Addon for Kaltura.com/Kaltura-CE/Kaltura On-Prem version") and [FFMPEG Add-On](http://rtcamp.com/store/buddypress-media-ffmpeg-converter/ "BuddyPress Media FFMPEG Addon")
|
@@ -73,8 +73,13 @@ Please visit [BuddyPress Media's Features page](http://rtcamp.com/buddypress-med
|
|
73 |
|
74 |
Please visit [BuddyPress Media's Roadmap page](http://rtcamp.com/buddypress-media/roadmap/ "Visit BuddyPress Media's Features page") to get some details about fuure releases.
|
75 |
|
|
|
|
|
|
|
|
|
|
|
76 |
= 2.2.2 =
|
77 |
-
Fixed the Notice that was generated on the albums page
|
78 |
|
79 |
= 2.2.1 =
|
80 |
* Removed anonymous function since its not supported in PHP versions < 5.3
|
1 |
=== BuddyPress Media ===
|
2 |
Contributors: rtcamp, rahul286, gagan0123, umeshnevase
|
3 |
+
Donate link: http://rtcamp.com/donate
|
4 |
Tags: BuddyPress, media, multimedia, album, audio, songs, music, video, photo, image, upload, share, MediaElement.js, ffmpeg, kaltura, media-node
|
5 |
License: GPLv2 or later
|
6 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
7 |
Requires at least: 3.3.2
|
8 |
Tested up to: 3.4.2
|
9 |
+
Stable tag: 2.2.3
|
10 |
|
11 |
Adds Photos, Music, Videos & Albums to your BuddyPress. Supports mobile devices (iPhone/iPad, etc) and automatic audio/video conversion.
|
12 |
|
18 |
|
19 |
* Images, Music, Videos Upload
|
20 |
* User-Albums Support
|
21 |
+
* Multiple files upload with Drag-n-Drop
|
22 |
* Uploading Photos/Videos via mobile (Tested on iPhone running iOS6)
|
23 |
* HTML5 player (with fall back to flash/silverlight player support)
|
24 |
* Automatic conversion of common audio & video formats to mp3/mp4. via [Kaltura Add-On](http://rtcamp.com/store/buddypress-media-kaltura/ "BuddyPress Media Kaltura Addon for Kaltura.com/Kaltura-CE/Kaltura On-Prem version") and [FFMPEG Add-On](http://rtcamp.com/store/buddypress-media-ffmpeg-converter/ "BuddyPress Media FFMPEG Addon")
|
73 |
|
74 |
Please visit [BuddyPress Media's Roadmap page](http://rtcamp.com/buddypress-media/roadmap/ "Visit BuddyPress Media's Features page") to get some details about fuure releases.
|
75 |
|
76 |
+
= 2.2.3 =
|
77 |
+
* Added more verification to check whether the object being used is available or not.
|
78 |
+
* Added custom message on delete activity action.
|
79 |
+
* Modified the upgrade loop to handle the sites with large number of media files.
|
80 |
+
|
81 |
= 2.2.2 =
|
82 |
+
* Fixed the Notice that was generated on the albums page.
|
83 |
|
84 |
= 2.2.1 =
|
85 |
* Removed anonymous function since its not supported in PHP versions < 5.3
|