Version Description
- Improved group compatibility
Download this release
Release Info
Developer | saurabhshukla |
Plugin | rtMedia for WordPress, BuddyPress and bbPress |
Version | 2.6.4 |
Comparing to | |
See all releases |
Code changes from version 2.6.3 to 2.6.4
- app/main/includes/BPMediaActions.php +1 -0
- app/main/privacy/BPMediaPrivacy.php +10 -2
- app/main/query/BPMediaQuery.php +37 -28
- index.php +1 -1
- readme.txt +4 -1
app/main/includes/BPMediaActions.php
CHANGED
@@ -354,6 +354,7 @@ class BPMediaActions {
|
|
354 |
if ( ! $count ) {
|
355 |
$bp_media_count = array( array( 'images' => 0, 'videos' => 0, 'audio' => 0, 'albums' => 0 ) );
|
356 |
bp_update_user_meta( $user, 'bp_media_count', $bp_media_count );
|
|
|
357 |
} else {
|
358 |
$total = array(
|
359 |
'images' => 0,
|
354 |
if ( ! $count ) {
|
355 |
$bp_media_count = array( array( 'images' => 0, 'videos' => 0, 'audio' => 0, 'albums' => 0 ) );
|
356 |
bp_update_user_meta( $user, 'bp_media_count', $bp_media_count );
|
357 |
+
$count = bp_get_user_meta( $user, 'bp_media_count', true );
|
358 |
} else {
|
359 |
$total = array(
|
360 |
'images' => 0,
|
app/main/privacy/BPMediaPrivacy.php
CHANGED
@@ -54,9 +54,17 @@ class BPMediaPrivacy {
|
|
54 |
static function is_installed() {
|
55 |
$settings = new BPMediaPrivacySettings();
|
56 |
$total = $settings->get_total_count();
|
57 |
-
$total
|
|
|
|
|
|
|
|
|
58 |
$finished = $settings->get_completed_count();
|
59 |
-
$finished
|
|
|
|
|
|
|
|
|
60 |
if ( $total === $finished )
|
61 |
$installed = true;
|
62 |
else
|
54 |
static function is_installed() {
|
55 |
$settings = new BPMediaPrivacySettings();
|
56 |
$total = $settings->get_total_count();
|
57 |
+
if(is_array($total) && !empty($total)){
|
58 |
+
$total = $total[ 0 ]->Total;
|
59 |
+
}else{
|
60 |
+
$total = 0;
|
61 |
+
}
|
62 |
$finished = $settings->get_completed_count();
|
63 |
+
if(is_array($finished) && !empty($finished)){
|
64 |
+
$finished = $finished[ 0 ]->Finished;
|
65 |
+
}else{
|
66 |
+
$finished = 0;
|
67 |
+
}
|
68 |
if ( $total === $finished )
|
69 |
$installed = true;
|
70 |
else
|
app/main/query/BPMediaQuery.php
CHANGED
@@ -13,18 +13,18 @@ if ( ! defined( 'ABSPATH' ) )
|
|
13 |
*/
|
14 |
class BPMediaQuery {
|
15 |
|
16 |
-
function init( $type = false, $album_id=false, $count=false, $page=false
|
17 |
-
$args = $this->prepare_args( $type
|
18 |
return $this->return_result( $args, $docount );
|
19 |
}
|
20 |
|
21 |
-
function privacy_query(
|
22 |
$privacy = BPMediaPrivacy::current_access();
|
23 |
return $meta_query = array(
|
24 |
'key' => 'bp_media_privacy',
|
25 |
'value' => $privacy,
|
26 |
-
'compare'=>'<=',
|
27 |
-
'type'
|
28 |
);
|
29 |
}
|
30 |
|
@@ -33,8 +33,8 @@ class BPMediaQuery {
|
|
33 |
$group_id = null;
|
34 |
|
35 |
if ( $group == false ) {
|
36 |
-
if(isset($bp->displayed_user->id)){
|
37 |
-
|
38 |
}
|
39 |
} else {
|
40 |
if ( ! class_exists( 'BPMediaGroupsExtension' ) )
|
@@ -49,14 +49,14 @@ class BPMediaQuery {
|
|
49 |
|
50 |
function prepare_meta_query() {
|
51 |
$group = bp_is_current_component( 'groups' );
|
52 |
-
if(!bp_is_groups_component()){
|
53 |
-
$meta_query[] = $this->privacy_query();
|
54 |
}
|
55 |
-
$meta_query[] = $this->group_query( $group );
|
56 |
return $meta_query;
|
57 |
}
|
58 |
|
59 |
-
function prepare_args( $type = false
|
60 |
|
61 |
global $bp, $bp_media;
|
62 |
|
@@ -80,41 +80,50 @@ class BPMediaQuery {
|
|
80 |
'meta_query' => $this->prepare_meta_query(),
|
81 |
'posts_per_page' => -1
|
82 |
);
|
83 |
-
if($album_id){
|
84 |
-
$args['post_parent'] = $album_id;
|
85 |
}
|
86 |
-
if(!bp_is_groups_component()){
|
87 |
-
if(isset($bp->displayed_user->id)){
|
88 |
-
$args['author'] = $bp->displayed_user->id;
|
89 |
}
|
90 |
}
|
91 |
|
92 |
if ( $docount == false ) {
|
93 |
-
if($count==false){
|
94 |
$count = $bp_media->default_count();
|
95 |
}
|
96 |
-
$limit_offset = $this->get_limit_offset( $count, $this->prepare_pagination($page) );
|
97 |
-
$args[ 'posts_per_page' ] = $limit_offset[0];
|
98 |
-
$args[ 'offset' ] = $limit_offset[1];
|
99 |
}
|
100 |
|
101 |
return $args;
|
102 |
}
|
103 |
|
104 |
-
|
105 |
function get_limit_offset( $limit, $page ) {
|
106 |
global $bp;
|
107 |
-
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
$offset = $limit * ($page - 1) - 1;
|
110 |
-
}else{
|
111 |
$offset = 0;
|
112 |
-
$limit = $limit -1;
|
113 |
}
|
114 |
} else {
|
115 |
$offset = $limit * ($page - 1);
|
116 |
}
|
117 |
-
return array($limit
|
118 |
}
|
119 |
|
120 |
function prepare_post_type( $type ) {
|
@@ -144,12 +153,12 @@ class BPMediaQuery {
|
|
144 |
return $mime_type;
|
145 |
}
|
146 |
|
147 |
-
function prepare_pagination($page) {
|
148 |
global $bp;
|
149 |
if ( isset( $bp->action_variables ) && is_array( $bp->action_variables ) && isset( $bp->action_variables[ 0 ] ) && $bp->action_variables[ 0 ] == 'page' && isset( $bp->action_variables[ 1 ] ) && is_numeric( $bp->action_variables[ 1 ] ) ) {
|
150 |
$paged = $bp->action_variables[ 1 ];
|
151 |
} else {
|
152 |
-
$paged = ($page)
|
153 |
}
|
154 |
return $paged;
|
155 |
}
|
13 |
*/
|
14 |
class BPMediaQuery {
|
15 |
|
16 |
+
function init( $type = false, $album_id = false, $count = false, $page = false, $docount = false ) {
|
17 |
+
$args = $this->prepare_args( $type, $album_id, $page, $docount, $count );
|
18 |
return $this->return_result( $args, $docount );
|
19 |
}
|
20 |
|
21 |
+
function privacy_query() {
|
22 |
$privacy = BPMediaPrivacy::current_access();
|
23 |
return $meta_query = array(
|
24 |
'key' => 'bp_media_privacy',
|
25 |
'value' => $privacy,
|
26 |
+
'compare' => '<=',
|
27 |
+
'type' => 'NUMERIC'
|
28 |
);
|
29 |
}
|
30 |
|
33 |
$group_id = null;
|
34 |
|
35 |
if ( $group == false ) {
|
36 |
+
if ( isset( $bp->displayed_user->id ) ) {
|
37 |
+
$group_id = $bp->displayed_user->id;
|
38 |
}
|
39 |
} else {
|
40 |
if ( ! class_exists( 'BPMediaGroupsExtension' ) )
|
49 |
|
50 |
function prepare_meta_query() {
|
51 |
$group = bp_is_current_component( 'groups' );
|
52 |
+
if ( ! bp_is_groups_component() ) {
|
53 |
+
$meta_query[ ] = $this->privacy_query();
|
54 |
}
|
55 |
+
$meta_query[ ] = $this->group_query( $group );
|
56 |
return $meta_query;
|
57 |
}
|
58 |
|
59 |
+
function prepare_args( $type = false, $album_id = false, $page = false, $docount = false, $count = false ) {
|
60 |
|
61 |
global $bp, $bp_media;
|
62 |
|
80 |
'meta_query' => $this->prepare_meta_query(),
|
81 |
'posts_per_page' => -1
|
82 |
);
|
83 |
+
if ( $album_id ) {
|
84 |
+
$args[ 'post_parent' ] = $album_id;
|
85 |
}
|
86 |
+
if ( ! bp_is_groups_component() ) {
|
87 |
+
if ( isset( $bp->displayed_user->id ) ) {
|
88 |
+
$args[ 'author' ] = $bp->displayed_user->id;
|
89 |
}
|
90 |
}
|
91 |
|
92 |
if ( $docount == false ) {
|
93 |
+
if ( $count == false ) {
|
94 |
$count = $bp_media->default_count();
|
95 |
}
|
96 |
+
$limit_offset = $this->get_limit_offset( $count, $this->prepare_pagination( $page ) );
|
97 |
+
$args[ 'posts_per_page' ] = $limit_offset[ 0 ];
|
98 |
+
$args[ 'offset' ] = $limit_offset[ 1 ];
|
99 |
}
|
100 |
|
101 |
return $args;
|
102 |
}
|
103 |
|
|
|
104 |
function get_limit_offset( $limit, $page ) {
|
105 |
global $bp;
|
106 |
+
$my_profile = false;
|
107 |
+
if ( bp_is_my_profile() ) {
|
108 |
+
if ( bp_get_current_group_id() == 0 ) {
|
109 |
+
$my_profile = true;
|
110 |
+
}
|
111 |
+
} else if ( class_exists('BP_Group_Extension') ) {
|
112 |
+
if ( groups_is_user_member( $bp->loggedin_user->id, bp_get_current_group_id() ) ) {
|
113 |
+
$my_profile = true;
|
114 |
+
}
|
115 |
+
}
|
116 |
+
if ( $my_profile === true ) {
|
117 |
+
if ( $page > 1 ) {
|
118 |
$offset = $limit * ($page - 1) - 1;
|
119 |
+
} else {
|
120 |
$offset = 0;
|
121 |
+
$limit = $limit - 1;
|
122 |
}
|
123 |
} else {
|
124 |
$offset = $limit * ($page - 1);
|
125 |
}
|
126 |
+
return array( $limit, $offset );
|
127 |
}
|
128 |
|
129 |
function prepare_post_type( $type ) {
|
153 |
return $mime_type;
|
154 |
}
|
155 |
|
156 |
+
function prepare_pagination( $page ) {
|
157 |
global $bp;
|
158 |
if ( isset( $bp->action_variables ) && is_array( $bp->action_variables ) && isset( $bp->action_variables[ 0 ] ) && $bp->action_variables[ 0 ] == 'page' && isset( $bp->action_variables[ 1 ] ) && is_numeric( $bp->action_variables[ 1 ] ) ) {
|
159 |
$paged = $bp->action_variables[ 1 ];
|
160 |
} else {
|
161 |
+
$paged = ($page) ? $page : 1;
|
162 |
}
|
163 |
return $paged;
|
164 |
}
|
index.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, videosand audios uploading to BuddyPress which are essential if you are building social network, seriously!
|
6 |
-
Version: 2.6.
|
7 |
Author: rtCamp
|
8 |
Text Domain: buddypress-media
|
9 |
Author URI: http://rtcamp.com
|
3 |
Plugin Name: BuddyPress Media
|
4 |
Plugin URI: http://rtcamp.com/buddypress-media/
|
5 |
Description: This plugin adds missing media rich features like photos, videosand audios uploading to BuddyPress which are essential if you are building social network, seriously!
|
6 |
+
Version: 2.6.4
|
7 |
Author: rtCamp
|
8 |
Text Domain: buddypress-media
|
9 |
Author URI: http://rtcamp.com
|
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.5
|
8 |
Tested up to: 3.5
|
9 |
-
Stable tag: 2.6.
|
10 |
|
11 |
Adds Photos, Music, Videos & Albums to BuddyPress. Supports mobile devices (iPhone/iPad, etc) and automatic audio/video conversion.
|
12 |
|
@@ -117,6 +117,9 @@ Please visit [BuddyPress Media's Features page](http://rtcamp.com/buddypress-med
|
|
117 |
|
118 |
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.
|
119 |
|
|
|
|
|
|
|
120 |
= 2.6.3 =
|
121 |
* Refactored database update checker to fix bugs
|
122 |
|
6 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
7 |
Requires at least: 3.5
|
8 |
Tested up to: 3.5
|
9 |
+
Stable tag: 2.6.4
|
10 |
|
11 |
Adds Photos, Music, Videos & Albums to BuddyPress. Supports mobile devices (iPhone/iPad, etc) and automatic audio/video conversion.
|
12 |
|
117 |
|
118 |
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.
|
119 |
|
120 |
+
= 2.6.4 =
|
121 |
+
* Improved group compatibility
|
122 |
+
|
123 |
= 2.6.3 =
|
124 |
* Refactored database update checker to fix bugs
|
125 |
|