Version Description
- Fixed a bug in upgrade script
Download this release
Release Info
Developer | rtcamp |
Plugin | rtMedia for WordPress, BuddyPress and bbPress |
Version | 2.2.5 |
Comparing to | |
See all releases |
Code changes from version 2.2.4 to 2.2.5
- includes/bp-media-admin.php +6 -2
- includes/bp-media-upgrade-script.php +49 -1
- loader.php +11 -8
- readme.txt +4 -1
includes/bp-media-admin.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
if(version_compare(
|
3 |
add_action('admin_notices', 'bp_media_upgrade_db_notice');
|
4 |
}
|
5 |
|
@@ -8,7 +8,11 @@ function bp_media_upgrade_script(){
|
|
8 |
if(isset($_GET['bp_media_upgrade_db']) && empty($_REQUEST['settings-updated'])){
|
9 |
check_admin_referer('bp_media_upgrade_db','wp_nonce');
|
10 |
require_once('bp-media-upgrade-script.php');
|
11 |
-
|
|
|
|
|
|
|
|
|
12 |
remove_action('admin_notices', 'bp_media_upgrade_db_notice');
|
13 |
}
|
14 |
}
|
1 |
<?php
|
2 |
+
if(version_compare(BP_MEDIA_DB_VERSION,get_option('bp_media_db_version','1.0'),'>')){
|
3 |
add_action('admin_notices', 'bp_media_upgrade_db_notice');
|
4 |
}
|
5 |
|
8 |
if(isset($_GET['bp_media_upgrade_db']) && empty($_REQUEST['settings-updated'])){
|
9 |
check_admin_referer('bp_media_upgrade_db','wp_nonce');
|
10 |
require_once('bp-media-upgrade-script.php');
|
11 |
+
$current_version = get_option('bp_media_db_version','1.0');
|
12 |
+
if($current_version == '2.0')
|
13 |
+
bp_media_upgrade_from_2_0_to_2_1();
|
14 |
+
else
|
15 |
+
bp_media_upgrade_from_1_0_to_2_1();
|
16 |
remove_action('admin_notices', 'bp_media_upgrade_db_notice');
|
17 |
}
|
18 |
}
|
includes/bp-media-upgrade-script.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
function
|
4 |
global $wpdb;
|
5 |
remove_filter('bp_activity_get_user_join_filter','bp_media_activity_query_filter',10);
|
6 |
/* @var $wpdb wpdb */
|
@@ -47,6 +47,7 @@ function bp_media_upgrade_to_2_2(){
|
|
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');
|
@@ -64,4 +65,51 @@ function bp_media_upgrade_to_2_2(){
|
|
64 |
function bp_media_database_updated_notice(){echo '<div class="updated rt-success"><p>
|
65 |
<b>BuddyPress Media</b> Database upgraded successfully.
|
66 |
</p></div>';}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
?>
|
1 |
<?php
|
2 |
|
3 |
+
function bp_media_upgrade_from_1_0_to_2_1(){
|
4 |
global $wpdb;
|
5 |
remove_filter('bp_activity_get_user_join_filter','bp_media_activity_query_filter',10);
|
6 |
/* @var $wpdb wpdb */
|
47 |
'primary_link' => $bp_media->get_url(),
|
48 |
'item_id' => $attachment_id,
|
49 |
'recorded_time' => $activity->date_recorded,
|
50 |
+
'user_id' => $bp_media->get_author()
|
51 |
);
|
52 |
$act_id = bp_media_record_activity($args);
|
53 |
bp_activity_delete_meta($child_activity, 'bp_media_parent_post');
|
65 |
function bp_media_database_updated_notice(){echo '<div class="updated rt-success"><p>
|
66 |
<b>BuddyPress Media</b> Database upgraded successfully.
|
67 |
</p></div>';}
|
68 |
+
function bp_media_upgrade_from_2_0_to_2_1(){
|
69 |
+
$page = 0;
|
70 |
+
while($media_entries = bp_media_return_query_posts(array(
|
71 |
+
'post_type' => 'attachment',
|
72 |
+
'post_status' => 'any',
|
73 |
+
'meta_key' => 'bp-media-key',
|
74 |
+
'meta_value' => 0,
|
75 |
+
'meta_compare' => '>',
|
76 |
+
'paged' => ++$page,
|
77 |
+
'postsperpage' => 10
|
78 |
+
))){
|
79 |
+
foreach($media_entries as $media){
|
80 |
+
try{
|
81 |
+
$bp_media = new BP_Media_Host_Wordpress($media->ID);
|
82 |
+
} catch (exception $e){
|
83 |
+
continue;
|
84 |
+
}
|
85 |
+
$child_activity = get_post_meta($media->ID,'bp_media_child_activity',true);
|
86 |
+
if($child_activity){
|
87 |
+
$activity = bp_activity_get(array('in'=>intval($child_activity)));
|
88 |
+
if(isset($activity['activities'][0]->id))
|
89 |
+
$activity = $activity['activities'][0];
|
90 |
+
else
|
91 |
+
continue;
|
92 |
+
$args = array(
|
93 |
+
'content' => $bp_media->get_media_activity_content(),
|
94 |
+
'id' => $child_activity,
|
95 |
+
'type' => 'media_upload',
|
96 |
+
'action' => apply_filters( 'bp_media_added_media', sprintf( __( '%1$s added a %2$s', 'bp-media'), bp_core_get_userlink( $bp_media->get_author() ), '<a href="' . $bp_media->get_url() . '">' . $bp_media->get_media_activity_type() . '</a>' ) ),
|
97 |
+
'primary_link' => $bp_media->get_url(),
|
98 |
+
'item_id' => $activity->item_id,
|
99 |
+
'recorded_time' => $activity->date_recorded,
|
100 |
+
'user_id' => $bp_media->get_author()
|
101 |
+
);
|
102 |
+
bp_media_record_activity($args);
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
update_option('bp_media_db_version',BP_MEDIA_DB_VERSION);
|
107 |
+
add_action('admin_notices','bp_media_database_updated_notice');
|
108 |
+
wp_cache_flush();
|
109 |
+
}
|
110 |
+
|
111 |
+
function bp_media_return_query_posts($args){
|
112 |
+
$bp_media_query = new WP_Query($args);
|
113 |
+
return $bp_media_query->posts;
|
114 |
+
}
|
115 |
?>
|
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__));
|
@@ -21,7 +21,7 @@ define('BP_MEDIA_PLUGIN_DIR', dirname(__FILE__));
|
|
21 |
define('BP_MEDIA_REQUIRED_BP','1.6');
|
22 |
|
23 |
/* A constatnt to store database version */
|
24 |
-
define('BP_MEDIA_DB_VERSION','2.
|
25 |
|
26 |
/* A constant to Active Collab API Assignee ID */
|
27 |
define('BP_MEDIA_AC_API_ASSIGNEE_ID','5');
|
@@ -72,14 +72,17 @@ function bp_media_activate() {
|
|
72 |
update_option('bp_media_options',$bp_media_options);
|
73 |
|
74 |
|
75 |
-
|
76 |
-
|
77 |
update_option('bp_media_db_version', '1.0');
|
78 |
}else{
|
79 |
-
|
|
|
|
|
|
|
|
|
|
|
80 |
}
|
81 |
-
|
82 |
-
|
83 |
}
|
84 |
|
85 |
register_activation_hook(__FILE__, 'bp_media_activate');
|
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.5
|
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.5');
|
16 |
|
17 |
/* A constant to be used as base for other URLs throughout the plugin */
|
18 |
define('BP_MEDIA_PLUGIN_DIR', dirname(__FILE__));
|
21 |
define('BP_MEDIA_REQUIRED_BP','1.6');
|
22 |
|
23 |
/* A constatnt to store database version */
|
24 |
+
define('BP_MEDIA_DB_VERSION','2.1');
|
25 |
|
26 |
/* A constant to Active Collab API Assignee ID */
|
27 |
define('BP_MEDIA_AC_API_ASSIGNEE_ID','5');
|
72 |
update_option('bp_media_options',$bp_media_options);
|
73 |
|
74 |
|
75 |
+
$bpmquery = new WP_Query(array('post_type'=>'bp_media','posts_per_page'=>1));
|
76 |
+
if($bpmquery->found_posts > 0){
|
77 |
update_option('bp_media_db_version', '1.0');
|
78 |
}else{
|
79 |
+
switch(get_option('bp_media_db_version')){
|
80 |
+
case '2.0':
|
81 |
+
break;
|
82 |
+
default:
|
83 |
+
update_option('bp_media_db_version',BP_MEDIA_DB_VERSION);
|
84 |
+
}
|
85 |
}
|
|
|
|
|
86 |
}
|
87 |
|
88 |
register_activation_hook(__FILE__, 'bp_media_activate');
|
readme.txt
CHANGED
@@ -6,7 +6,7 @@ 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 |
|
@@ -73,6 +73,9 @@ 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 future releases.
|
75 |
|
|
|
|
|
|
|
76 |
= 2.2.4 =
|
77 |
* Added support for media-count on albums
|
78 |
* fixes bbPress conflict in_array() expects parameter 2
|
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.5
|
10 |
|
11 |
Adds Photos, Music, Videos & Albums to your BuddyPress. Supports mobile devices (iPhone/iPad, etc) and automatic audio/video conversion.
|
12 |
|
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 future releases.
|
75 |
|
76 |
+
= 2.2.5 =
|
77 |
+
* Fixed a bug in upgrade script
|
78 |
+
|
79 |
= 2.2.4 =
|
80 |
* Added support for media-count on albums
|
81 |
* fixes bbPress conflict in_array() expects parameter 2
|