rtMedia for WordPress, BuddyPress and bbPress - Version 2.5

Version Description

Download this release

Release Info

Developer saurabhshukla
Plugin Icon 128x128 rtMedia for WordPress, BuddyPress and bbPress
Version 2.5
Comparing to
See all releases

Code changes from version 2.4.3 to 2.5

app/admin/BPMediaAdmin.php CHANGED
@@ -30,7 +30,7 @@ if (!class_exists('BPMediaAdmin')) {
30
if (current_user_can('manage_options'))
31
add_action('bp_admin_tabs', array($this, 'tab'));
32
if (is_multisite())
33
- add_action('network_admin_edit_bp_media_options', array($this, 'save_multisite_options'));
34
}
35
$this->bp_media_upgrade = new BPMediaUpgrade();
36
$this->bp_media_settings = new BPMediaSettings();
@@ -54,10 +54,10 @@ if (!class_exists('BPMediaAdmin')) {
54
* @global string BP_MEDIA_TXT_DOMAIN
55
*/
56
public function menu() {
57
- add_menu_page(__('Buddypress Media Component', BP_MEDIA_TXT_DOMAIN), __('BuddyPress Media', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-settings', array($this, 'settings_page'));
58
- add_submenu_page('bp-media-settings', __('Buddypress Media Settings', BP_MEDIA_TXT_DOMAIN), __('Settings', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-settings', array($this, 'settings_page'));
59
- add_submenu_page('bp-media-settings', __('Buddypress Media Addons', BP_MEDIA_TXT_DOMAIN), __('Addons', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-addons', array($this, 'addons_page'));
60
- add_submenu_page('bp-media-settings', __('Buddypress Media Support', BP_MEDIA_TXT_DOMAIN), __('Support ', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-support', array($this, 'support_page'));
61
}
62
63
/**
@@ -105,13 +105,10 @@ if (!class_exists('BPMediaAdmin')) {
105
106
<div id="bp-media-settings-boxes">
107
<?php
108
- $settings_url = ( is_multisite() ) ? network_admin_url('edit.php?action=bp_media_options') : 'options.php';
109
?>
110
<form id="bp_media_settings_form" name="bp_media_settings_form" action="<?php echo $settings_url; ?>" method="post" enctype="multipart/form-data">
111
<div class="bp-media-metabox-holder"><?php
112
- // if (isset($_REQUEST['request_type'])) {
113
- // bp_media_bug_report_form($_REQUEST['request_type']);
114
- // } else {
115
if ($option_group) {
116
settings_fields($option_group);
117
do_settings_sections($page);
@@ -148,8 +145,8 @@ if (!class_exists('BPMediaAdmin')) {
148
/* BuddyPress Media */
149
$tabs[] = array(
150
'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-settings'), 'admin.php')),
151
- 'title' => __('Buddypress Media', BP_MEDIA_TXT_DOMAIN),
152
- 'name' => __('Buddypress Media', BP_MEDIA_TXT_DOMAIN),
153
'class' => ($tab == 'bp-media-settings' || $tab == 'bp-media-addons' || $tab == 'bp-media-support') ? $active_class : $idle_class
154
);
155
@@ -175,21 +172,21 @@ if (!class_exists('BPMediaAdmin')) {
175
/* BuddyPress Media */
176
$tabs[] = array(
177
'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-settings'), 'admin.php')),
178
- 'title' => __('Buddypress Media Settings', BP_MEDIA_TXT_DOMAIN),
179
'name' => __('Settings', BP_MEDIA_TXT_DOMAIN),
180
'class' => ($tab == 'bp-media-settings') ? $active_class : $idle_class . ' first_tab'
181
);
182
183
$tabs[] = array(
184
'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-addons'), 'admin.php')),
185
- 'title' => __('Buddypress Media Addons', BP_MEDIA_TXT_DOMAIN),
186
'name' => __('Addons', BP_MEDIA_TXT_DOMAIN),
187
'class' => ($tab == 'bp-media-addons') ? $active_class : $idle_class
188
);
189
190
$tabs[] = array(
191
'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-support'), 'admin.php')),
192
- 'title' => __('Buddypress Media Support', BP_MEDIA_TXT_DOMAIN),
193
'name' => __('Support', BP_MEDIA_TXT_DOMAIN),
194
'class' => ($tab == 'bp-media-support') ? $active_class : $idle_class . ' last_tab'
195
);
@@ -239,23 +236,25 @@ if (!class_exists('BPMediaAdmin')) {
239
}
240
241
/* Multisite Save Options - http://wordpress.stackexchange.com/questions/64968/settings-api-in-multisite-missing-update-message#answer-72503 */
242
public function save_multisite_options() {
243
-
244
global $bp_media_admin;
245
if (isset($_POST['refresh-count'])) {
246
$bp_media_admin->update_count();
247
}
248
do_action('bp_media_sanitize_settings', $_POST);
249
-
250
- bp_update_option('bp_media_options', $_POST['bp_media_options']);
251
-
252
- // redirect to settings page in network
253
- wp_redirect(
254
- add_query_arg(
255
- array('page' => 'bp-media-settings', 'updated' => 'true'), (is_multisite() ? network_admin_url('admin.php') : admin_url('admin.php'))
256
- )
257
- );
258
- exit;
259
}
260
261
/* Admin Sidebar */
@@ -274,7 +273,7 @@ if (!class_exists('BPMediaAdmin')) {
274
<li>' . sprintf('<a href="%s">' . __("Read FAQ", BP_MEDIA_TXT_DOMAIN) . '</a>', 'http://rtcamp.com/buddypress-media/faq/') . '</li>
275
<li>' . sprintf('<a href="%s">' . __("Free Support Forum", BP_MEDIA_TXT_DOMAIN) . '</a>', $bp_media->support_url) . '</li>
276
<li>' . sprintf('<a href="%s">' . __("Github Issue Tracker", BP_MEDIA_TXT_DOMAIN) . '</a>', 'https://github.com/rtCamp/buddypress-media/issues/') . '</li>
277
- <li>' . sprintf('<a href="%s">' . __("Hire us!", BP_MEDIA_TXT_DOMAIN) . '</a> ' . __("To get professional customisation/setup service.", BP_MEDIA_TXT_DOMAIN), 'http://rtcamp.com/buddypress-media/hire/') . '</li>
278
</ul></p>';
279
new BPMediaAdminWidget('support', __('Need Help?', BP_MEDIA_TXT_DOMAIN), $support);
280
30
if (current_user_can('manage_options'))
31
add_action('bp_admin_tabs', array($this, 'tab'));
32
if (is_multisite())
33
+ add_action('network_admin_edit_bp_media', array($this, 'save_multisite_options'));
34
}
35
$this->bp_media_upgrade = new BPMediaUpgrade();
36
$this->bp_media_settings = new BPMediaSettings();
54
* @global string BP_MEDIA_TXT_DOMAIN
55
*/
56
public function menu() {
57
+ add_menu_page(__('BuddyPress Media Component', BP_MEDIA_TXT_DOMAIN), __('BuddyPress Media', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-settings', array($this, 'settings_page'));
58
+ add_submenu_page('bp-media-settings', __('BuddyPress Media Settings', BP_MEDIA_TXT_DOMAIN), __('Settings', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-settings', array($this, 'settings_page'));
59
+ add_submenu_page('bp-media-settings', __('BuddyPress Media Addons', BP_MEDIA_TXT_DOMAIN), __('Addons', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-addons', array($this, 'addons_page'));
60
+ add_submenu_page('bp-media-settings', __('BuddyPress Media Support', BP_MEDIA_TXT_DOMAIN), __('Support ', BP_MEDIA_TXT_DOMAIN), 'manage_options', 'bp-media-support', array($this, 'support_page'));
61
}
62
63
/**
105
106
<div id="bp-media-settings-boxes">
107
<?php
108
+ $settings_url = ( is_multisite() ) ? network_admin_url('edit.php?action=' . $option_group) : 'options.php';
109
?>
110
<form id="bp_media_settings_form" name="bp_media_settings_form" action="<?php echo $settings_url; ?>" method="post" enctype="multipart/form-data">
111
<div class="bp-media-metabox-holder"><?php
112
if ($option_group) {
113
settings_fields($option_group);
114
do_settings_sections($page);
145
/* BuddyPress Media */
146
$tabs[] = array(
147
'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-settings'), 'admin.php')),
148
+ 'title' => __('BuddyPress Media', BP_MEDIA_TXT_DOMAIN),
149
+ 'name' => __('BuddyPress Media', BP_MEDIA_TXT_DOMAIN),
150
'class' => ($tab == 'bp-media-settings' || $tab == 'bp-media-addons' || $tab == 'bp-media-support') ? $active_class : $idle_class
151
);
152
172
/* BuddyPress Media */
173
$tabs[] = array(
174
'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-settings'), 'admin.php')),
175
+ 'title' => __('BuddyPress Media Settings', BP_MEDIA_TXT_DOMAIN),
176
'name' => __('Settings', BP_MEDIA_TXT_DOMAIN),
177
'class' => ($tab == 'bp-media-settings') ? $active_class : $idle_class . ' first_tab'
178
);
179
180
$tabs[] = array(
181
'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-addons'), 'admin.php')),
182
+ 'title' => __('BuddyPress Media Addons', BP_MEDIA_TXT_DOMAIN),
183
'name' => __('Addons', BP_MEDIA_TXT_DOMAIN),
184
'class' => ($tab == 'bp-media-addons') ? $active_class : $idle_class
185
);
186
187
$tabs[] = array(
188
'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-support'), 'admin.php')),
189
+ 'title' => __('BuddyPress Media Support', BP_MEDIA_TXT_DOMAIN),
190
'name' => __('Support', BP_MEDIA_TXT_DOMAIN),
191
'class' => ($tab == 'bp-media-support') ? $active_class : $idle_class . ' last_tab'
192
);
236
}
237
238
/* Multisite Save Options - http://wordpress.stackexchange.com/questions/64968/settings-api-in-multisite-missing-update-message#answer-72503 */
239
+
240
public function save_multisite_options() {
241
global $bp_media_admin;
242
if (isset($_POST['refresh-count'])) {
243
$bp_media_admin->update_count();
244
}
245
do_action('bp_media_sanitize_settings', $_POST);
246
+
247
+ if (isset($_POST['bp_media_options'])) {
248
+ bp_update_option('bp_media_options', $_POST['bp_media_options']);
249
+
250
+ // redirect to settings page in network
251
+ wp_redirect(
252
+ add_query_arg(
253
+ array('page' => 'bp-media-settings', 'updated' => 'true'), (is_multisite() ? network_admin_url('admin.php') : admin_url('admin.php'))
254
+ )
255
+ );
256
+ exit;
257
+ }
258
}
259
260
/* Admin Sidebar */
273
<li>' . sprintf('<a href="%s">' . __("Read FAQ", BP_MEDIA_TXT_DOMAIN) . '</a>', 'http://rtcamp.com/buddypress-media/faq/') . '</li>
274
<li>' . sprintf('<a href="%s">' . __("Free Support Forum", BP_MEDIA_TXT_DOMAIN) . '</a>', $bp_media->support_url) . '</li>
275
<li>' . sprintf('<a href="%s">' . __("Github Issue Tracker", BP_MEDIA_TXT_DOMAIN) . '</a>', 'https://github.com/rtCamp/buddypress-media/issues/') . '</li>
276
+ <li>' . sprintf('<a href="%s">' . __("Hire Us!", BP_MEDIA_TXT_DOMAIN) . '</a> ' . __("To get professional customisation/setup service.", BP_MEDIA_TXT_DOMAIN), 'http://rtcamp.com/buddypress-media/hire/') . '</li>
277
</ul></p>';
278
new BPMediaAdminWidget('support', __('Need Help?', BP_MEDIA_TXT_DOMAIN), $support);
279
app/assets/css/main.css CHANGED
@@ -6,8 +6,8 @@
6
.bp_media_title {display:block;font-size:20px;font-weight:bold;}
7
ul.bp-media-gallery{overflow: hidden}
8
.bp_media_description {display:block;margin-top:20px;}
9
- ul.bp-media-gallery.item-list{overflow:hidden;margin: 1% 0;}
10
- #item-body ul.bp-media-gallery li{float: left;margin: 1% 1% 0;width: 18%;border-bottom: none;padding: 0;}
11
ul.bp-media-gallery li img{max-width:150px;width:100%;height:auto;-moz-box-shadow: 1px 1px 10px #a0a0a0;-webkit-box-shadow: 1px 1px 10px #a0a0a0;box-shadow: 1px 1px 10px #a0a0a0;-moz-transition: box-shadow 0.2s linear;-webkit-transition: box-shadow 0.2s linear;transition: box-shadow 0.2s linear;}
12
ul.bp-media-gallery li img:hover{-moz-box-shadow: 1px 1px 10px #333;-webkit-box-shadow: 1px 1px 10px #333;box-shadow: 1px 1px 10px #333;}
13
ul.bp-media-gallery h3{max-width: 150px;overflow: hidden;text-align: center;font-size: 110%;white-space: nowrap;height: 20px;margin: 10px 0px;}
@@ -32,14 +32,32 @@ div.bp_media_title{margin-bottom:10px;}
32
.bp-media-twitter:hover{background-position: 80px 36px;}
33
.bp-media-rss{background-position: 35px 0px;}
34
.bp-media-rss:hover{background-position: 35px 36px;}
35
- #bp-media-upload-ui{position: relative;}
36
- #bp-media-upload-ui #drag-drop-area{border: 4px dashed #DDD;height: 200px;}
37
- #bp-media-upload-ui .drag-drop-inside{margin: 70px auto 0;width: 250px;}
38
- #bp-media-upload-ui .drag-drop-inside p{display: block;text-align: center;color: #AAA;margin: 5px 0;}
39
#bp-media-upload-ui .drag-drop-info{font-size: 20px;}
40
#bp-media-upload-ui .drag-drop-buttons input{border-color: #BBB;color: #464646;text-decoration: none;font-size: 12px!important;line-height: 13px;padding: 3px 8px;cursor: pointer;border-width: 1px;border-style: solid;-webkit-border-radius: 11px;border-radius: 11px;-moz-box-sizing: content-box;-webkit-box-sizing: content-box;box-sizing: content-box;}
41
.bp-media-progressbar{height: 28px;margin: 6px 10px 0 0;line-height: 2em;padding: 0;overflow: hidden;margin-bottom: 2px;border: 1px solid #D1D1D1;background: white;background-image: linear-gradient(bottom,white 0,#F7F7F7 100%);background-image: -o-linear-gradient(bottom,white 0,#F7F7F7 100%);background-image: -moz-linear-gradient(bottom,white 0,#F7F7F7 100%);background-image: -webkit-linear-gradient(bottom,white 0,#F7F7F7 100%);background-image: -ms-linear-gradient(bottom,white 0,#F7F7F7 100%);-webkit-border-radius: 3px;border-radius: 3px;-webkit-box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.1);box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.1)}
42
- .bp-media-progress-text{z-index: 10;position: relative;width: 100%;padding: 0 8px;text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);color: rgba(0, 0, 0, 0.6);font-size:16px;line-height: 28px;}
43
.bp-media-progress-completed{z-index: 9;width: 0;height: 35px;margin-top: -35px;background-color: #83B4D8;background-image: linear-gradient(bottom,#72A7CF 0,#90C5EE 100%);background-image: -o-linear-gradient(bottom,#72A7CF 0,#90C5EE 100%);background-image: -moz-linear-gradient(bottom,#72A7CF 0,#90C5EE 100%);background-image: -webkit-linear-gradient(bottom,#72A7CF 0,#90C5EE 100%);background-image: -ms-linear-gradient(bottom,#72A7CF 0,#90C5EE 100%);-webkit-border-radius: 3px;border-radius: 3px;-webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);}
44
.bpm-aligncenter{display: inline-block;text-align: center;width: 100%;}
45
#bp-media-premium-addons ul,#bp-media-premium-addons li{list-style:disc;margin-left:10px;}
@@ -130,7 +148,7 @@ background-image: -webkit-gradient(linear,left bottom,left top,color-stop(1, #F7
130
#wpadminbar .bp-media-settings-menu > .ab-item .ab-icon{background: url("../img/bpm-icon-16.png") no-repeat scroll -8px -7px transparent}
131
#wpadminbar .bp-media-settings-menu:hover .ab-icon{background-position: -8px -41px}
132
133
- /* Buddypress media admin support form styling */
134
.bp-media-updated, .bp-media-error{border-radius: 3px; padding: 0 7px; margin: 5px 0 15px; border: 1px solid}
135
.bp-media-updated p, .bp-media-error p{margin: 0.5em 0;padding: 2px;}
136
.bp-media-updated{background-color: #FFFFE0;border-color: #E6DB55;}
@@ -154,8 +172,8 @@ background-image: -webkit-gradient(linear,left bottom,left top,color-stop(1, #F7
154
.rt-update{background-color: #FFEAA6;border-color:#E1CA82;}
155
img.bp-media-donation-image{display:block;margin: 10px auto;}
156
157
- /* Buddypress Media Image Uploader album selection */
158
- #bp-media-album-prompt, #bp-media-album-new { background: none repeat scroll 0 0 #FFFFFF;border: 1px solid #AAAAAA;border-radius: 5px 5px 5px 5px;display: none;padding: 3px;z-index: 110000;left: 40%;position: fixed;top: 35%;width: 300px; }
159
#bp-media-album-new { z-index: 120000; }
160
.bp-media-album-title { background: url("../img/Popup-title-bg.png") repeat-x scroll 50% 50% #CCCCCC;border: 1px solid #AAAAAA;border-radius: 5px 5px 5px 5px;color: #222222;display: block;font-weight: bold;padding: 0;margin-bottom: 10px; }
161
.bp-media-album-title span { background: none repeat scroll 0 0 transparent;display: block;font-size: 16px;padding: 10px; }
@@ -169,4 +187,4 @@ img.bp-media-donation-image{display:block;margin: 10px auto;}
169
#bp-media-album-new > label { font-size: 14px; }
170
#bp-media-album-new input[type="text"] { width: 98%; }
171
#custom-overlay { background: none repeat scroll 0 0 #000000;bottom: 0;left: 0;min-height: 360px;opacity: 0.7;position: fixed;right: 0;top: 0;z-index: 105000; }
172
- div.error{margin: 5px 0 15px; background-color: #ffebe8; border-color: #c00;padding: 0 .6em;-webkit-border-radius: 3px;border-radius: 3px;border-width: 1px;border-style: solid;}
6
.bp_media_title {display:block;font-size:20px;font-weight:bold;}
7
ul.bp-media-gallery{overflow: hidden}
8
.bp_media_description {display:block;margin-top:20px;}
9
+ ul.bp-media-gallery.item-list{overflow:visible;margin: 1% 0;width: auto;}
10
+ #item-body ul.bp-media-gallery li{float: left;margin: 1% 1% 0;width: 18%;border-bottom: none;padding: 0;position: static;}
11
ul.bp-media-gallery li img{max-width:150px;width:100%;height:auto;-moz-box-shadow: 1px 1px 10px #a0a0a0;-webkit-box-shadow: 1px 1px 10px #a0a0a0;box-shadow: 1px 1px 10px #a0a0a0;-moz-transition: box-shadow 0.2s linear;-webkit-transition: box-shadow 0.2s linear;transition: box-shadow 0.2s linear;}
12
ul.bp-media-gallery li img:hover{-moz-box-shadow: 1px 1px 10px #333;-webkit-box-shadow: 1px 1px 10px #333;box-shadow: 1px 1px 10px #333;}
13
ul.bp-media-gallery h3{max-width: 150px;overflow: hidden;text-align: center;font-size: 110%;white-space: nowrap;height: 20px;margin: 10px 0px;}
32
.bp-media-twitter:hover{background-position: 80px 36px;}
33
.bp-media-rss{background-position: 35px 0px;}
34
.bp-media-rss:hover{background-position: 35px 36px;}
35
+ /*#bp-media-upload-ui{position: relative;}*/
36
+
37
+
38
+ #bp-media-upload-ui #drag-drop-area{border: 4px dashed #DDD;height: 150px;width: 150px;}
39
+ .upload #bp-media-upload-ui #drag-drop-area{height: auto; width: 100%;}
40
+ #bp-media-upload-ui .drag-drop-inside{margin:auto;width: 100%;}
41
+ #bp-media-album-prompt{margin: 0;position: absolute;right: 0;text-align: right;top: 2px;min-width: 200px;}
42
+ #bp-media-album-prompt span{float: left;line-height: 25px;margin-right: 15px;}
43
+ #bp-media-album-prompt .bp-media-album-content{float: left;}
44
+ #bp-media-album-prompt #create-new{background-color: #DF562C;color: #fff;}
45
+ #bp-media-album-prompt div.hide{display: none;position: absolute;right: 0;top: 0;z-index: 100;position: relative;}
46
+ #bp-media-album-prompt #bp_media_album_new {width: 160px;}
47
+ #bp-media-album-prompt input.button{height: 25px;margin-left: 5px;padding: 0 10px;position: relative;top: -1px;}
48
+ div.bp-media-area-allocate{display: block;height: 15px;}
49
+ div.bp_media_create_album{text-align: right}
50
+ #bp_media_album_name{margin-bottom: 6px;}
51
+ #item-body:after,ul.bp-media-gallery.item-list:after{content: " ";clear: both;display: block;text-indent: -9999em;}
52
+ #item-body{position: relative;}
53
+
54
+ #bp-media-upload-ui .drag-drop-inside p{display: block;text-align: center;color: #AAA;margin: 12px 0;}
55
#bp-media-upload-ui .drag-drop-info{font-size: 20px;}
56
#bp-media-upload-ui .drag-drop-buttons input{border-color: #BBB;color: #464646;text-decoration: none;font-size: 12px!important;line-height: 13px;padding: 3px 8px;cursor: pointer;border-width: 1px;border-style: solid;-webkit-border-radius: 11px;border-radius: 11px;-moz-box-sizing: content-box;-webkit-box-sizing: content-box;box-sizing: content-box;}
57
+ #bp-media-uploaded-files{background: none repeat scroll 0 0 #DDDDDD;left: 0;margin-top: 5px;position: absolute;top: 155px;width: 100%;}
58
+ #bp-media-uploaded-files .error{padding: 5px;text-align: center;}
59
.bp-media-progressbar{height: 28px;margin: 6px 10px 0 0;line-height: 2em;padding: 0;overflow: hidden;margin-bottom: 2px;border: 1px solid #D1D1D1;background: white;background-image: linear-gradient(bottom,white 0,#F7F7F7 100%);background-image: -o-linear-gradient(bottom,white 0,#F7F7F7 100%);background-image: -moz-linear-gradient(bottom,white 0,#F7F7F7 100%);background-image: -webkit-linear-gradient(bottom,white 0,#F7F7F7 100%);background-image: -ms-linear-gradient(bottom,white 0,#F7F7F7 100%);-webkit-border-radius: 3px;border-radius: 3px;-webkit-box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.1);box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.1)}
60
+ .bp-media-progress-text{z-index: 10;position: relative;width: 100%;padding: 0 8px;text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);color: rgba(0, 0, 0, 0.6);font-size:16px;line-height: 28px;height: 28px;}
61
.bp-media-progress-completed{z-index: 9;width: 0;height: 35px;margin-top: -35px;background-color: #83B4D8;background-image: linear-gradient(bottom,#72A7CF 0,#90C5EE 100%);background-image: -o-linear-gradient(bottom,#72A7CF 0,#90C5EE 100%);background-image: -moz-linear-gradient(bottom,#72A7CF 0,#90C5EE 100%);background-image: -webkit-linear-gradient(bottom,#72A7CF 0,#90C5EE 100%);background-image: -ms-linear-gradient(bottom,#72A7CF 0,#90C5EE 100%);-webkit-border-radius: 3px;border-radius: 3px;-webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);}
62
.bpm-aligncenter{display: inline-block;text-align: center;width: 100%;}
63
#bp-media-premium-addons ul,#bp-media-premium-addons li{list-style:disc;margin-left:10px;}
148
#wpadminbar .bp-media-settings-menu > .ab-item .ab-icon{background: url("../img/bpm-icon-16.png") no-repeat scroll -8px -7px transparent}
149
#wpadminbar .bp-media-settings-menu:hover .ab-icon{background-position: -8px -41px}
150
151
+ /* BuddyPress media admin support form styling */
152
.bp-media-updated, .bp-media-error{border-radius: 3px; padding: 0 7px; margin: 5px 0 15px; border: 1px solid}
153
.bp-media-updated p, .bp-media-error p{margin: 0.5em 0;padding: 2px;}
154
.bp-media-updated{background-color: #FFFFE0;border-color: #E6DB55;}
172
.rt-update{background-color: #FFEAA6;border-color:#E1CA82;}
173
img.bp-media-donation-image{display:block;margin: 10px auto;}
174
175
+ /* BuddyPress Media Image Uploader album selection */
176
+ /*#bp-media-album-prompt, #bp-media-album-new { background: none repeat scroll 0 0 #FFFFFF;border: 1px solid #AAAAAA;border-radius: 5px 5px 5px 5px;display: none;padding: 3px;z-index: 110000;left: 40%;position: fixed;top: 35%;width: 300px; }
177
#bp-media-album-new { z-index: 120000; }
178
.bp-media-album-title { background: url("../img/Popup-title-bg.png") repeat-x scroll 50% 50% #CCCCCC;border: 1px solid #AAAAAA;border-radius: 5px 5px 5px 5px;color: #222222;display: block;font-weight: bold;padding: 0;margin-bottom: 10px; }
179
.bp-media-album-title span { background: none repeat scroll 0 0 transparent;display: block;font-size: 16px;padding: 10px; }
187
#bp-media-album-new > label { font-size: 14px; }
188
#bp-media-album-new input[type="text"] { width: 98%; }
189
#custom-overlay { background: none repeat scroll 0 0 #000000;bottom: 0;left: 0;min-height: 360px;opacity: 0.7;position: fixed;right: 0;top: 0;z-index: 105000; }
190
+ div.error{margin: 5px 0 15px; background-color: #ffebe8; border-color: #c00;padding: 0 .6em;-webkit-border-radius: 3px;border-radius: 3px;border-width: 1px;border-style: solid;}*/
app/assets/js/bp-media-uploader.js CHANGED
@@ -4,98 +4,78 @@
4
*/
5
6
jQuery(document).ready(function(){
7
- jQuery('body').append('<div id="custom-overlay"></div>');
8
- jQuery('#custom-overlay').hide();
9
- jQuery('body').append('<div id="bp-media-album-prompt">'+jQuery('#bp-media-album-prompt').html()+'</div>');
10
- jQuery('body').append('<div id="bp-media-album-new">'+jQuery('#bp-media-album-new').html()+'</div>');
11
- jQuery('#content #bp-media-album-prompt').remove();
12
- jQuery('#content #bp-media-album-new').remove();
13
- jQuery('#bp-media-close').click(function(){
14
- jQuery('#bp-media-album-prompt').hide();
15
- jQuery('#custom-overlay').hide();
16
- jQuery('#bp-media-uploaded-files div').remove();
17
- });
18
- jQuery('#selected-btn').click(function() {
19
- bp_media_album_selected = jQuery('#bp-media-selected-album').val();
20
- jQuery('#bp-media-album-prompt').hide();
21
- jQuery('#custom-overlay').hide();
22
- bp_media_uploader.start();
23
- });
24
- jQuery('#create-btn').click(function() {
25
- jQuery('#custom-overlay').css('z-index', 115000);
26
- jQuery('#bp-media-album-new').show();
27
- jQuery('#bp-media-album-new').css({
28
- left: ((jQuery(window).width()-jQuery('#bp-media-album-new').width())/2),
29
- top: ((jQuery(window).height()-jQuery('#bp-media-album-new').height())/2)
30
- });
31
- });
32
- jQuery('#bp-media-create-album-close').click(function() {
33
- jQuery('#bp-media-album-new').hide();
34
- jQuery('#custom-overlay').css('z-index', 105000);
35
- });
36
- jQuery(window).resize(function(){
37
- jQuery('#bp-media-album-prompt').css({
38
- left: ((jQuery(window).width()-jQuery('#bp-media-album-prompt').width())/2),
39
- top: ((jQuery(window).height()-jQuery('#bp-media-album-prompt').height())/2)
40
- });
41
- jQuery('#bp-media-album-new').css({
42
- left: ((jQuery(window).width()-jQuery('#bp-media-album-new').width())/2),
43
- top: ((jQuery(window).height()-jQuery('#bp-media-album-new').height())/2)
44
- });
45
- });
46
- jQuery('#create-album').click(function() {
47
- var album_name = jQuery('#bp_media_album_name').val();
48
- if(album_name.length==0){
49
- alert('You have not filled the album name');
50
- return false;
51
- }
52
- var data = {
53
- action: 'bp_media_add_album',
54
- bp_media_album_name : album_name,
55
- bp_media_group_id : bp_media_uploader_params.multipart_params.bp_media_group_id
56
- };
57
- jQuery.post(bp_media_vars.ajaxurl,data,function(response){
58
- var album = parseInt(response);
59
- if(album == 0){
60
- alert('Sorry you cannot create albums in this group');
61
- }
62
- else{
63
- jQuery('#bp-media-selected-album').append('<option value='+album+' selected="selected">'+jQuery('#bp_media_album_name').val()+'</option>')
64
- jQuery('#bp-media-album-new').hide();
65
- bp_media_album_selected = jQuery('#bp-media-selected-album').val();
66
- jQuery('#bp-media-album-prompt').hide();
67
- jQuery('#custom-overlay').hide();
68
- bp_media_uploader.start();
69
- }
70
- });
71
- });
72
73
- var bp_media_is_multiple_upload = false;
74
- if(jQuery('#'+bp_media_uploader_params.container).length==0)
75
return false;
76
var bp_media_uploader=new plupload.Uploader(bp_media_uploader_params);
77
var bp_media_album_selected = false;
78
bp_media_uploader.init();
79
- bp_media_uploader.bind('FilesAdded', function(up, files) {
80
//bp_media_is_multiple_upload = files.length==1&&jQuery('.bp-media-progressbar').length==0?false:true;
81
bp_media_is_multiple_upload = files.length>1;
82
- jQuery.each(files, function(i, file) {
83
- jQuery('#bp-media-uploaded-files').append(
84
- '<div id="bp-media-progress-'+file.id+'" class="bp-media-progressbar"><div class="bp-media-progress-text">' +
85
- file.name + ' (' + plupload.formatSize(file.size) + ')(<b></b>)</div><div class="bp-media-progress-completed"></div></div>');
86
});
87
- if(bp_media_album_selected == false){
88
- jQuery('#bp-media-album-prompt').css({
89
- left: ((jQuery(window).width()-jQuery('#bp-media-album-prompt').width())/2),
90
- top: ((jQuery(window).height()-jQuery('#bp-media-album-prompt').height())/2)
91
- });
92
- jQuery('#custom-overlay').show();
93
- jQuery('#bp-media-album-prompt').show();
94
- } else {
95
- bp_media_album_selected = jQuery('#bp-media-selected-album').val();
96
- bp_media_uploader.start();
97
- }
98
- up.refresh(); // Reposition Flash/Silverlight
99
});
100
bp_media_uploader.bind('UploadProgress', function(up, file) {
101
jQuery('#bp-media-progress-'+file.id+' .bp-media-progress-completed').width(file.percent+'%');
@@ -120,13 +100,14 @@ jQuery(document).ready(function(){
120
});
121
bp_media_uploader.bind('UploadComplete',function(){
122
var new_location = window.location.href;
123
- if(new_location.search('/media/')>0){
124
- new_location = new_location.replace('/media/','/albums/');
125
if(bp_media_album_selected>0)
126
new_location = new_location.concat(bp_media_album_selected);
127
else
128
new_location = new_location.concat('0/');
129
window.location.replace(new_location);
130
- }
131
});
132
});
4
*/
5
6
jQuery(document).ready(function(){
7
8
+ var selected = jQuery('#bp-media-album-prompt select').val();
9
+ if(jQuery('#'+bp_media_uploader_params.container).length==0)
10
return false;
11
+ jQuery('#bp-media-album-prompt select').change(function() {
12
+
13
+ if ( jQuery(this).val() == 'create_new' ) {
14
+ jQuery('#bp_media_album_new').css({'width':jQuery('#bp-media-album-prompt select').width()+20});
15
+ jQuery('#bp-media-album-prompt select').hide();
16
+ jQuery('#bp-media-album-prompt span').hide();
17
+ jQuery('#bp-media-album-prompt div.hide').show();
18
+ } else
19
+ selected = jQuery(this).val();
20
+ });
21
+ var new_album_flag = 0;
22
+ jQuery('#btn-create-new').click(function(){
23
+ if ( new_album_flag == 1 ) {
24
+ return false;
25
+ }
26
+ var new_album_name = jQuery('#bp_media_album_new').val();
27
+ if(new_album_name.length==0){
28
+ alert('You have not filled the album name');
29
+ return false;
30
+ } else {
31
+ new_album_flag = 1;
32
+ jQuery(this).val('Wait');
33
+ var data = {
34
+ action: 'bp_media_add_album',
35
+ bp_media_album_name : new_album_name,
36
+ bp_media_group_id : bp_media_uploader_params.multipart_params.bp_media_group_id
37
+ };
38
+ jQuery.post(bp_media_vars.ajaxurl,data,function(response){
39
+ var album = parseInt(response);
40
+ if(album == 0){
41
+ alert('Sorry you cannot create albums in this group');
42
+ }
43
+ else {
44
+ jQuery('#bp-media-album-prompt select option').removeAttr('selected');
45
+ jQuery('#bp-media-selected-album').prepend('<option value='+album+' selected="selected">'+new_album_name+'</option>');
46
+ jQuery('#bp-media-album-prompt div.hide').hide();
47
+ jQuery('#bp-media-album-prompt select').show();
48
+ jQuery('#bp-media-album-prompt span').show();
49
+ }
50
+ });
51
+ }
52
+ });
53
+ jQuery('#btn-create-cancel').click(function(){
54
+ jQuery('#bp-media-album-prompt div.hide').hide();
55
+ jQuery('#bp-media-album-prompt select option').removeAttr('selected');
56
+ jQuery('#bp-media-album-prompt select option[value=' + selected + ']').attr('selected', 'selected');
57
+ jQuery('#bp-media-album-prompt select').show();
58
+ jQuery('#bp-media-album-prompt span').show();
59
+ });
60
+ var bp_media_is_multiple_upload = false;
61
var bp_media_uploader=new plupload.Uploader(bp_media_uploader_params);
62
var bp_media_album_selected = false;
63
bp_media_uploader.init();
64
+
65
+ bp_media_uploader.bind('FilesAdded', function(up, files) {
66
+ if ( jQuery('#bp-media-selected-album').val() == 'create_new' ) {
67
+ alert("Please Select an Album !!");
68
+ return false;
69
+ }
70
//bp_media_is_multiple_upload = files.length==1&&jQuery('.bp-media-progressbar').length==0?false:true;
71
bp_media_is_multiple_upload = files.length>1;
72
+ jQuery.each(files, function(i, file) {
73
+ var extension = file.name.substr( (file.name.lastIndexOf('.') +1) );
74
+ jQuery('#bp-media-uploaded-files').append('<div id="bp-media-progress-'+file.id+'" class="bp-media-progressbar"><div class="bp-media-progress-text">' + file.name + ' (' + plupload.formatSize(file.size) + ')(<b>0%</b>)</div><div class="bp-media-progress-completed"></div></div>');
75
});
76
+ bp_media_album_selected = jQuery('#bp-media-selected-album').val();
77
+ bp_media_uploader.start();
78
+ up.refresh(); // Reposition Flash/Silverlight
79
});
80
bp_media_uploader.bind('UploadProgress', function(up, file) {
81
jQuery('#bp-media-progress-'+file.id+' .bp-media-progress-completed').width(file.percent+'%');
100
});
101
bp_media_uploader.bind('UploadComplete',function(){
102
var new_location = window.location.href;
103
+ if(new_location.search('/upload/')>0){
104
+ new_location = new_location.replace('/upload/','/albums/');
105
if(bp_media_album_selected>0)
106
new_location = new_location.concat(bp_media_album_selected);
107
else
108
new_location = new_location.concat('0/');
109
window.location.replace(new_location);
110
+ } else
111
+ location.reload(true);
112
});
113
});
app/assets/js/main.js CHANGED
@@ -74,24 +74,25 @@ jQuery(document).ready(function(){
74
e.preventDefault();
75
var post_id = jQuery(this).attr('data-post-id');
76
var post_date = new Date();
77
var date = post_date.getFullYear()+'-'+(post_date.getMonth() + 1) +'-'+post_date.getDate()+' '+ post_date.getHours()+':'+(post_date.getMinutes() + 1)+':'+(post_date.getSeconds()+1);
78
- // var post_date = d.getTime();
79
- var curr_obj = jQuery(this);
80
var remove_featured = 0;
81
- if(jQuery(this).attr('data-remove-featured')){
82
remove_featured = jQuery(this).attr('data-remove-featured');
83
}
84
- jQuery.ajax({
85
url:bp_media_vars.ajax_url,
86
type:'POST',
87
data:'action=my_featured_action&post_id='+post_id+'&remove_featured='+remove_featured+'&post_date='+date,
88
success:function( results )
89
{
90
if(remove_featured == 1){
91
- curr_obj.text('Featured');
92
curr_obj.attr('data-remove-featured','0');
93
- } else {
94
- curr_obj.text('Remove Featured');
95
curr_obj.attr('data-remove-featured','1');
96
}
97
74
e.preventDefault();
75
var post_id = jQuery(this).attr('data-post-id');
76
var post_date = new Date();
77
+ var feature = bp_media_vars.feature;
78
+ var rfeature = bp_media_vars.removefeature;
79
var date = post_date.getFullYear()+'-'+(post_date.getMonth() + 1) +'-'+post_date.getDate()+' '+ post_date.getHours()+':'+(post_date.getMinutes() + 1)+':'+(post_date.getSeconds()+1);
80
+ var curr_obj = jQuery(this);
81
var remove_featured = 0;
82
+ if(jQuery(this).attr('data-remove-featured')){
83
remove_featured = jQuery(this).attr('data-remove-featured');
84
}
85
+ jQuery.ajax({
86
url:bp_media_vars.ajax_url,
87
type:'POST',
88
data:'action=my_featured_action&post_id='+post_id+'&remove_featured='+remove_featured+'&post_date='+date,
89
success:function( results )
90
{
91
if(remove_featured == 1){
92
+ curr_obj.text(feature);
93
curr_obj.attr('data-remove-featured','0');
94
+ } else {
95
+ curr_obj.text(rfeature);
96
curr_obj.attr('data-remove-featured','1');
97
}
98
app/helper/BPMediaLog.php CHANGED
@@ -21,7 +21,7 @@ if ( ! class_exists( 'BPMediaLog' ) ) {
21
if ($log_file == ''){
22
$log_file = BP_MEDIA_PATH.'log/bpmedia.log';
23
}
24
- return $this->log( $log_msg );
25
}
26
27
/**
21
if ($log_file == ''){
22
$log_file = BP_MEDIA_PATH.'log/bpmedia.log';
23
}
24
+ return $this->log( $log_msg, $log_file );
25
}
26
27
/**
app/helper/BPMediaSettings.php CHANGED
@@ -20,7 +20,7 @@ if (!class_exists('BPMediaSettings')) {
20
*/
21
public function settings() {
22
global $bp_media_addon;
23
- add_settings_section('bpm-settings', __('BuddyPress Media Settings', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-settings');
24
add_settings_field('bpm-video', __('Video', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-settings', array(
25
'setting' => 'bp_media_options',
26
'option' => 'videos_enabled',
@@ -53,32 +53,54 @@ if (!class_exists('BPMediaSettings')) {
53
add_settings_section('bpm-other', __('BuddyPress Media Other Options', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-settings');
54
add_settings_field('bpm-other-settings', __('Re-Count Media Entries', BP_MEDIA_TXT_DOMAIN), array($this, 'button'), 'bp-media-settings', 'bpm-other', array(
55
'option' => 'refresh-count',
56
- 'name' => 'Re-Count',
57
'desc' => __('It will re-count all media entries of all users and correct any discrepancies.', BP_MEDIA_TXT_DOMAIN)
58
));
59
$bp_media_addon = new BPMediaAddon();
60
add_settings_section('bpm-addons', __('BuddyPress Media Addons for Audio/Video Conversion', BP_MEDIA_TXT_DOMAIN), array($bp_media_addon, 'get_addons'), 'bp-media-addons');
61
add_settings_section('bpm-support', __('Submit a request form', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-support');
62
add_settings_field('bpm-request', __('Request Type', BP_MEDIA_TXT_DOMAIN), array($this, 'dropdown'), 'bp-media-support', 'bpm-support', array('option' => 'select-request', 'none' => false, 'values' => array(
63
- '' => '--Select One--',
64
- 'premium_support' => 'Premium Support',
65
- 'new_feature' => 'Suggest a New Feature',
66
- 'bug_report' => 'Submit a Bug Report')
67
));
68
register_setting('bp_media', 'bp_media_options', array($this, 'sanitize'));
69
}
70
71
/**
72
* Sanitizes the settings
73
*/
74
public function sanitize($input) {
75
global $bp_media_admin;
76
if (isset($_POST['refresh-count'])) {
77
- if ($bp_media_admin->update_count())
78
- add_settings_error(__('Recount Success', BP_MEDIA_TXT_DOMAIN), 'recount-success', __('Recounting of media files done successfully', BP_MEDIA_TXT_DOMAIN), 'updated');
79
- else
80
- add_settings_error(__('Recount Fail', BP_MEDIA_TXT_DOMAIN), 'recount-fail', __('Recounting Failed', BP_MEDIA_TXT_DOMAIN));
81
}
82
do_action('bp_media_sanitize_settings', $_POST, $input);
83
return $input;
84
}
20
*/
21
public function settings() {
22
global $bp_media_addon;
23
+ add_settings_section('bpm-settings', __('BuddyPress Media Settings', BP_MEDIA_TXT_DOMAIN), is_multisite() ? array($this, 'network_notices') : '', 'bp-media-settings');
24
add_settings_field('bpm-video', __('Video', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-settings', array(
25
'setting' => 'bp_media_options',
26
'option' => 'videos_enabled',
53
add_settings_section('bpm-other', __('BuddyPress Media Other Options', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-settings');
54
add_settings_field('bpm-other-settings', __('Re-Count Media Entries', BP_MEDIA_TXT_DOMAIN), array($this, 'button'), 'bp-media-settings', 'bpm-other', array(
55
'option' => 'refresh-count',
56
+ 'name' => __('Re-Count', BP_MEDIA_TXT_DOMAIN),
57
'desc' => __('It will re-count all media entries of all users and correct any discrepancies.', BP_MEDIA_TXT_DOMAIN)
58
));
59
$bp_media_addon = new BPMediaAddon();
60
add_settings_section('bpm-addons', __('BuddyPress Media Addons for Audio/Video Conversion', BP_MEDIA_TXT_DOMAIN), array($bp_media_addon, 'get_addons'), 'bp-media-addons');
61
add_settings_section('bpm-support', __('Submit a request form', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-support');
62
add_settings_field('bpm-request', __('Request Type', BP_MEDIA_TXT_DOMAIN), array($this, 'dropdown'), 'bp-media-support', 'bpm-support', array('option' => 'select-request', 'none' => false, 'values' => array(
63
+ '' => '-- ' . __('Select One', BP_MEDIA_TXT_DOMAIN) . ' --',
64
+ 'premium_support' => __('Premium Support', BP_MEDIA_TXT_DOMAIN),
65
+ 'new_feature' => __('Suggest a New Feature', BP_MEDIA_TXT_DOMAIN),
66
+ 'bug_report' => __('Submit a Bug Report', BP_MEDIA_TXT_DOMAIN))
67
));
68
register_setting('bp_media', 'bp_media_options', array($this, 'sanitize'));
69
}
70
71
+ public function network_notices() {
72
+ if (get_site_option('bpm-recount-success', false)) {
73
+ echo '<div id="setting-error-bpm-recount-success" class="updated"><p><strong>' . get_site_option('bpm-recount-success') . '</strong></p></div>';
74
+ delete_site_option('bpm-recount-success');
75
+ } elseif (get_site_option('bpm-recount-fail', false)) {
76
+ echo '<div id="setting-error-bpm-recount-fail" class="error"><p><strong>' . get_site_option('bpm-recount-fail') . '</strong></p></div>';
77
+ delete_site_option('bpm-recount-fail');
78
+ } elseif (get_site_option('bpm-settings-saved')) {
79
+ echo '<div id="setting-error-bpm-settings-saved" class="updated"><p><strong>' . get_site_option('bpm-settings-saved') . '</strong></p></div>';
80
+ }
81
+ delete_site_option('bpm-settings-saved');
82
+ }
83
+
84
/**
85
* Sanitizes the settings
86
*/
87
public function sanitize($input) {
88
global $bp_media_admin;
89
if (isset($_POST['refresh-count'])) {
90
+ if ($bp_media_admin->update_count()) {
91
+ if (is_multisite())
92
+ update_site_option('bpm-recount-success', __('Recounting of media files done successfully', BP_MEDIA_TXT_DOMAIN));
93
+ else
94
+ add_settings_error(__('Recount Success', BP_MEDIA_TXT_DOMAIN), 'bpm-recount-success', __('Recounting of media files done successfully', BP_MEDIA_TXT_DOMAIN), 'updated');
95
+ } else {
96
+ if (is_multisite())
97
+ update_site_option('bpm-recount-fail', __('Recounting Failed', BP_MEDIA_TXT_DOMAIN));
98
+ else
99
+ add_settings_error(__('Recount Fail', BP_MEDIA_TXT_DOMAIN), 'bpm-recount-fail', __('Recounting Failed', BP_MEDIA_TXT_DOMAIN));
100
+ }
101
}
102
+ if (is_multisite())
103
+ update_site_option('bpm-settings-saved', __('Settings saved.', BP_MEDIA_FFMPEG_TXT_DOMAIN));
104
do_action('bp_media_sanitize_settings', $_POST, $input);
105
return $input;
106
}
app/helper/BPMediaUpgrade.php CHANGED
@@ -55,7 +55,8 @@ if (!class_exists('BPMediaUpgrade')) {
55
*/
56
public function upgrade_1_0_to_2_1() {
57
global $wpdb, $bp_media;
58
- remove_filter('bp_activity_get_user_join_filter', 'activity_query_filter', 10);
59
/* @var $wpdb wpdb */
60
$wall_posts_album_ids = array();
61
do {
@@ -73,10 +74,10 @@ if (!class_exists('BPMediaUpgrade')) {
73
if (isset($wall_posts_album_ids[$media_file->post_author])) {
74
$wall_posts_id = $wall_posts_album_ids[$media_file->post_author];
75
} else {
76
- $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'");
77
if ($wall_posts_id == null) {
78
$album = new BPMediaAlbum();
79
- $album->add_album('Wall Posts', $media_file->post_author);
80
$wall_posts_id = $album->get_id();
81
}
82
if (!$wall_posts_id) {
55
*/
56
public function upgrade_1_0_to_2_1() {
57
global $wpdb, $bp_media;
58
+ $post_wall =__( 'Wall Posts', BP_MEDIA_TXT_DOMAIN );
59
+ remove_filter('bp_activity_get_user_join_filter', 'BPMediaFilters::activity_query_filter', 10);
60
/* @var $wpdb wpdb */
61
$wall_posts_album_ids = array();
62
do {
74
if (isset($wall_posts_album_ids[$media_file->post_author])) {
75
$wall_posts_id = $wall_posts_album_ids[$media_file->post_author];
76
} else {
77
+ $wall_posts_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = $post_wall AND post_author = '" . $media_file->post_author . "' AND post_type='bp_media_album'");
78
if ($wall_posts_id == null) {
79
$album = new BPMediaAlbum();
80
+ $album->add_album($post_wall, $media_file->post_author);
81
$wall_posts_id = $album->get_id();
82
}
83
if (!$wall_posts_id) {
app/main/BPMediaLoader.php CHANGED
@@ -68,12 +68,26 @@ class BPMediaLoader {
68
'parent_url' => trailingslashit( bp_displayed_user_domain() )
69
);
70
unset( $bp->bp_nav[ $key ] );
71
}
72
switch ( $bp->current_component ) {
73
case BP_MEDIA_IMAGES_SLUG:
74
case BP_MEDIA_VIDEOS_SLUG:
75
case BP_MEDIA_AUDIO_SLUG:
76
case BP_MEDIA_ALBUMS_SLUG:
77
$count = count( $bp->action_variables );
78
for ( $i = $count; $i > 0; $i -- ) {
79
$bp->action_variables[ $i ] = $bp->action_variables[ $i - 1 ];
68
'parent_url' => trailingslashit( bp_displayed_user_domain() )
69
);
70
unset( $bp->bp_nav[ $key ] );
71
+ break;
72
+ case BP_MEDIA_UPLOAD_SLUG:
73
+ $bp->bp_options_nav[ BP_MEDIA_SLUG ][ ] = array(
74
+ 'name' => $nav_item[ 'name' ],
75
+ 'link' => (isset( $bp->displayed_user->domain ) ? $bp->displayed_user->domain : (isset( $bp->loggedin_user->domain ) ? $bp->loggedin_user->domain : '')) . $nav_item[ 'slug' ] . '/',
76
+ 'slug' => $nav_item[ 'slug' ],
77
+ 'css_id' => $nav_item[ 'css_id' ],
78
+ 'position' => $nav_item[ 'position' ],
79
+ 'screen_function' => $nav_item[ 'screen_function' ],
80
+ 'user_has_access' => bp_is_my_profile(),
81
+ 'parent_url' => trailingslashit( bp_displayed_user_domain() )
82
+ );
83
+ unset( $bp->bp_nav[ $key ] );
84
}
85
switch ( $bp->current_component ) {
86
case BP_MEDIA_IMAGES_SLUG:
87
case BP_MEDIA_VIDEOS_SLUG:
88
case BP_MEDIA_AUDIO_SLUG:
89
case BP_MEDIA_ALBUMS_SLUG:
90
+ case BP_MEDIA_UPLOAD_SLUG:
91
$count = count( $bp->action_variables );
92
for ( $i = $count; $i > 0; $i -- ) {
93
$bp->action_variables[ $i ] = $bp->action_variables[ $i - 1 ];
app/main/BuddyPressMedia.php CHANGED
@@ -48,6 +48,7 @@ class BuddyPressMedia {
48
*/
49
add_action('bp_include', array($this, 'init'));
50
add_action('widgets_init', array($this, 'widgets_init'), 1);
51
global $bp_media_counter;
52
$bp_media_counter = 0;
53
}
@@ -202,14 +203,16 @@ class BuddyPressMedia {
202
new BPMediaFunction();
203
}
204
205
- if (file_exists(BP_MEDIA_PATH . '/languages/' . get_locale() . '.mo'))
206
- load_textdomain(BP_MEDIA_TXT_DOMAIN, BP_MEDIA_PATH . '/languages/' . get_locale() . '.mo');
207
208
add_action('admin_notices', array($this, 'admin_notice'));
209
global $bp_media_admin;
210
$bp_media_admin = new BPMediaAdmin();
211
}
212
213
function settings_link($links, $file) {
214
/* create link */
215
$plugin_name = plugin_basename(BP_MEDIA_PATH.'index.php');
48
*/
49
add_action('bp_include', array($this, 'init'));
50
add_action('widgets_init', array($this, 'widgets_init'), 1);
51
+ add_action('plugins_loaded',array($this,'load_translation'));
52
global $bp_media_counter;
53
$bp_media_counter = 0;
54
}
203
new BPMediaFunction();
204
}
205
206
207
add_action('admin_notices', array($this, 'admin_notice'));
208
global $bp_media_admin;
209
$bp_media_admin = new BPMediaAdmin();
210
}
211
212
+ static function load_translation(){
213
+ load_plugin_textdomain(BP_MEDIA_TXT_DOMAIN, false, basename(BP_MEDIA_PATH).'/languages/');
214
+ }
215
+
216
function settings_link($links, $file) {
217
/* create link */
218
$plugin_name = plugin_basename(BP_MEDIA_PATH.'index.php');
app/main/group/BPMediaGroup.php CHANGED
@@ -15,6 +15,7 @@ class BPMediaGroup {
15
new BPMediaGroupAlbum();
16
new BPMediaGroupMusic();
17
new BPMediaGroupVideo();
18
endif;
19
add_action('bp_actions', array($this, 'custom_nav'), 999);
20
add_filter('bp_media_multipart_params_filter', array($this, 'multipart_params_handler'));
@@ -37,7 +38,7 @@ class BPMediaGroup {
37
return;
38
39
/** This line might break a thing or two in custom themes and widgets */
40
- remove_filter('bp_activity_get_user_join_filter', 'activity_query_filter', 10);
41
42
foreach ($bp->bp_options_nav[$current_group] as $key => $nav_item) {
43
switch ($nav_item['slug']) {
@@ -45,6 +46,7 @@ class BPMediaGroup {
45
case BP_MEDIA_VIDEOS_SLUG:
46
case BP_MEDIA_AUDIO_SLUG:
47
case BP_MEDIA_ALBUMS_SLUG:
48
unset($bp->bp_options_nav[$current_group][$key]);
49
}
50
switch ($bp->current_action) {
@@ -52,6 +54,7 @@ class BPMediaGroup {
52
case BP_MEDIA_VIDEOS_SLUG:
53
case BP_MEDIA_AUDIO_SLUG:
54
case BP_MEDIA_ALBUMS_SLUG:
55
$count = count($bp->action_variables);
56
for ($i = $count; $i > 0; $i--) {
57
$bp->action_variables[$i] = $bp->action_variables[$i - 1];
@@ -73,8 +76,7 @@ class BPMediaGroup {
73
if (is_array($multipart_params)) {
74
global $bp;
75
if (isset($bp->current_action) && $bp->current_action == BP_MEDIA_SLUG
76
- && isset($bp->action_variables) && empty($bp->action_variables)
77
- && isset($bp->current_component) && $bp->current_component == 'groups'
78
&& isset($bp->groups->current_group->id)) {
79
$multipart_params['bp_media_group_id'] = $bp->groups->current_group->id;
80
}
@@ -94,25 +96,40 @@ class BPMediaGroup {
94
global $bp;
95
if (!isset($bp->current_action) || $bp->current_action != BP_MEDIA_SLUG)
96
return false;
97
- $current_tab = BPMediaGroup::can_upload() ? BP_MEDIA_UPLOAD_SLUG : BP_MEDIA_IMAGES_SLUG;
98
if (isset($bp->action_variables[0])) {
99
$current_tab = $bp->action_variables[0];
100
}
101
102
- if (BPMediaGroup::can_upload()) {
103
- $bp_media_nav[BP_MEDIA_UPLOAD_SLUG] = array(
104
'url' => trailingslashit(bp_get_group_permalink($bp->groups->current_group)) . BP_MEDIA_SLUG,
105
- 'label' => BP_MEDIA_UPLOAD_LABEL,
106
- );
107
- } else {
108
- $bp_media_nav = array();
109
- }
110
-
111
- foreach (array('IMAGES', 'VIDEOS', 'AUDIO', 'ALBUMS') as $type) {
112
- $bp_media_nav[constant('BP_MEDIA_' . $type . '_SLUG')] = array(
113
- 'url' => trailingslashit(bp_get_group_permalink($bp->groups->current_group)) . constant('BP_MEDIA_' . $type . '_SLUG'),
114
- 'label' => constant('BP_MEDIA_' . $type . '_LABEL'),
115
);
116
}
117
118
/** This variable will be used to display the tabs in group component */
15
new BPMediaGroupAlbum();
16
new BPMediaGroupMusic();
17
new BPMediaGroupVideo();
18
+ new BPMediaGroupUpload();
19
endif;
20
add_action('bp_actions', array($this, 'custom_nav'), 999);
21
add_filter('bp_media_multipart_params_filter', array($this, 'multipart_params_handler'));
38
return;
39
40
/** This line might break a thing or two in custom themes and widgets */
41
+ remove_filter('bp_activity_get_user_join_filter', 'BPMediaFilters::activity_query_filter', 10);
42
43
foreach ($bp->bp_options_nav[$current_group] as $key => $nav_item) {
44
switch ($nav_item['slug']) {
46
case BP_MEDIA_VIDEOS_SLUG:
47
case BP_MEDIA_AUDIO_SLUG:
48
case BP_MEDIA_ALBUMS_SLUG:
49
+ case BP_MEDIA_UPLOAD_SLUG:
50
unset($bp->bp_options_nav[$current_group][$key]);
51
}
52
switch ($bp->current_action) {
54
case BP_MEDIA_VIDEOS_SLUG:
55
case BP_MEDIA_AUDIO_SLUG:
56
case BP_MEDIA_ALBUMS_SLUG:
57
+ case BP_MEDIA_UPLOAD_SLUG:
58
$count = count($bp->action_variables);
59
for ($i = $count; $i > 0; $i--) {
60
$bp->action_variables[$i] = $bp->action_variables[$i - 1];
76
if (is_array($multipart_params)) {
77
global $bp;
78
if (isset($bp->current_action) && $bp->current_action == BP_MEDIA_SLUG
79
+ && isset($bp->action_variables) && isset($bp->current_component) && $bp->current_component == 'groups'
80
&& isset($bp->groups->current_group->id)) {
81
$multipart_params['bp_media_group_id'] = $bp->groups->current_group->id;
82
}
96
global $bp;
97
if (!isset($bp->current_action) || $bp->current_action != BP_MEDIA_SLUG)
98
return false;
99
+ $bp_media_upload = new BPMediaUploadScreen( 'upload', BP_MEDIA_UPLOAD_SLUG );
100
+ $bp_media_image = new BPMediaScreen( 'image', BP_MEDIA_IMAGES_SLUG );
101
+ $current_tab = BP_MEDIA_IMAGES_SLUG;
102
+
103
if (isset($bp->action_variables[0])) {
104
$current_tab = $bp->action_variables[0];
105
}
106
107
+ // if (BPMediaGroup::can_upload()) {
108
+ $bp_media_nav[BP_MEDIA_IMAGES_SLUG] = array(
109
'url' => trailingslashit(bp_get_group_permalink($bp->groups->current_group)) . BP_MEDIA_SLUG,
110
+ 'label' => BP_MEDIA_IMAGES_LABEL,
111
+ 'screen_function' => array( $bp_media_image, 'screen' )
112
);
113
+ // } else {
114
+ // $bp_media_nav = array();
115
+ // }
116
+
117
+ foreach (array('VIDEOS', 'AUDIO', 'ALBUMS', 'UPLOAD') as $type) {
118
+ if ( $type == 'UPLOAD' ) {
119
+ if ( BPMediaGroup::can_upload() ) {
120
+ $bp_media_nav[constant('BP_MEDIA_' . $type . '_SLUG')] = array(
121
+ 'url' => trailingslashit(bp_get_group_permalink($bp->groups->current_group)) . constant('BP_MEDIA_' . $type . '_SLUG'),
122
+ 'label' => constant('BP_MEDIA_' . $type . '_LABEL'),
123
+ // 'screen_function' => array( $bp_media_upload, 'upload_screen' ),
124
+ 'user_has_access' => BPMediaGroup::can_upload()
125
+ );
126
+ }
127
+ } else {
128
+ $bp_media_nav[constant('BP_MEDIA_' . $type . '_SLUG')] = array(
129
+ 'url' => trailingslashit(bp_get_group_permalink($bp->groups->current_group)) . constant('BP_MEDIA_' . $type . '_SLUG'),
130
+ 'label' => constant('BP_MEDIA_' . $type . '_LABEL'),
131
+ );
132
+ }
133
}
134
135
/** This variable will be used to display the tabs in group component */
app/main/group/BPMediaGroupAction.php CHANGED
@@ -17,8 +17,12 @@ class BPMediaGroupAction {
17
static function bp_media_groups_set_query() {
18
global $bp, $bp_media_query, $bp_media_posts_per_page;
19
if (isset($bp->current_action) && $bp->current_action == BP_MEDIA_SLUG) {
20
- if (bp_action_variable(0)) {
21
- switch (bp_action_variable(0)) {
22
case BP_MEDIA_IMAGES_SLUG:
23
$type = 'image';
24
break;
@@ -125,4 +129,4 @@ class BPMediaGroupAction {
125
return true;
126
}
127
128
- }
17
static function bp_media_groups_set_query() {
18
global $bp, $bp_media_query, $bp_media_posts_per_page;
19
if (isset($bp->current_action) && $bp->current_action == BP_MEDIA_SLUG) {
20
+ $current_tab = BP_MEDIA_IMAGES_SLUG;
21
+ if (isset($bp->action_variables[0])) {
22
+ $current_tab = $bp->action_variables[0];
23
+ }
24
+ if ($current_tab) {
25
+ switch ($current_tab) {
26
case BP_MEDIA_IMAGES_SLUG:
27
$type = 'image';
28
break;
129
return true;
130
}
131
132
+ }
app/main/group/BPMediaGroupElementExtension.php CHANGED
@@ -19,87 +19,87 @@ if (class_exists('BP_Group_Extension')) :
19
function display() {
20
global $bp;
21
BPMediaGroupAction::bp_media_groups_set_query();
22
- if (bp_action_variable(0)) {
23
- BPMediaGroup::navigation_menu();
24
- $media_type = "";
25
- $slug = "";
26
- switch (bp_action_variable(0)) {
27
- case BP_MEDIA_IMAGES_SLUG:
28
- $media_type = "image";
29
- $slug = BP_MEDIA_IMAGES_SLUG;
30
- //BPMediaGroup::bp_media_groups_images_screen();
31
- break;
32
- case BP_MEDIA_VIDEOS_SLUG:
33
- $media_type = "video";
34
- $slug = BP_MEDIA_VIDEOS_SLUG;
35
- break;
36
- case BP_MEDIA_AUDIO_SLUG:
37
- $media_type = "audio";
38
- $slug = BP_MEDIA_AUDIO_SLUG;
39
- break;
40
- case BP_MEDIA_ALBUMS_SLUG:
41
- $media_type = "album";
42
- $slug = BP_MEDIA_ALBUMS_SLUG;
43
- break;
44
- default:
45
- /** @todo Error is to be displayed for 404 */
46
- }
47
- if ($slug != "" && $media_type != "") {
48
- if (isset($bp->action_variables[1])) {
49
- switch ($bp->action_variables[1]) {
50
- case 'edit':
51
- //Edit screen for image
52
- break;
53
- case 'delete':
54
- //Delete function for media file
55
- break;
56
- default:
57
- if (intval(bp_action_variable(1)) > 0) {
58
- global $bp_media_current_entry;
59
- try {
60
- $bp_media_current_entry = new BPMediaHostWordpress(bp_action_variable(1));
61
- if ($bp_media_current_entry->get_group_id() != bp_get_current_group_id())
62
- throw new Exception(__('Sorry, the requested media does not belong to the group', BP_MEDIA_TXT_DOMAIN));
63
- } catch (Exception $e) {
64
- /** Error Handling when media not present or not belong to the group */
65
- bp_media_display_error($e->getMessage());
66
- return;
67
- }
68
- if ($media_type == "album") {
69
- $bp_media_content = new BPMediaAlbumScreen($media_type, BP_MEDIA_ALBUMS_ENTRY_SLUG);
70
- $bp->action_variables[ 0 ]= BP_MEDIA_ALBUMS_ENTRY_SLUG;
71
- $bp_media_content->entry_screen();
72
- } else {
73
- $bp_media_content = new BPMediaScreen($media_type, $slug);
74
- }
75
- $bp_media_content->entry_screen_content();
76
-
77
- break;
78
} else {
79
- /** @todo display 404 */
80
}
81
}
82
} else {
83
- if ($media_type == "album") {
84
- BPMediaGroupAction::bp_media_groups_albums_set_query();
85
- $bp_media_content = new BPMediaAlbumScreen($media_type, $slug);
86
- } else {
87
- $bp_media_content = new BPMediaScreen($media_type, $slug);
88
- }
89
$bp_media_content->screen_content();
90
}
91
}
92
- } else {
93
-
94
- if (BPMediaGroup::can_upload()) {
95
- BPMediaGroup::navigation_menu();
96
- $bp_media_upload = new BPMediaUploadScreen('upload', BP_MEDIA_UPLOAD_SLUG);
97
- $bp_media_upload->upload_screen_content();
98
- } else {
99
- $bp->action_variables[0] = BP_MEDIA_IMAGES_SLUG;
100
- BPMediaGroupAction::bp_media_groups_set_query();
101
- $this->display();
102
- }
103
}
104
}
105
19
function display() {
20
global $bp;
21
BPMediaGroupAction::bp_media_groups_set_query();
22
+ $current_tab = BP_MEDIA_IMAGES_SLUG;
23
+ if (isset($bp->action_variables[0])) {
24
+ $current_tab = $bp->action_variables[0];
25
+ }
26
+ BPMediaGroup::navigation_menu();
27
+ $media_type = "";
28
+ $slug = "";
29
+ switch ( $current_tab ) {
30
+ case BP_MEDIA_IMAGES_SLUG:
31
+ $media_type = "image";
32
+ $slug = BP_MEDIA_IMAGES_SLUG;
33
+ break;
34
+ case BP_MEDIA_VIDEOS_SLUG:
35
+ $media_type = "video";
36
+ $slug = BP_MEDIA_VIDEOS_SLUG;
37
+ break;
38
+ case BP_MEDIA_AUDIO_SLUG:
39
+ $media_type = "audio";
40
+ $slug = BP_MEDIA_AUDIO_SLUG;
41
+ break;
42
+ case BP_MEDIA_ALBUMS_SLUG:
43
+ $media_type = "album";
44
+ $slug = BP_MEDIA_ALBUMS_SLUG;
45
+ break;
46
+ case BP_MEDIA_UPLOAD_SLUG:
47
+ $media_type = "upload";
48
+ $slug = BP_MEDIA_ALBUMS_SLUG;
49
+ break;
50
+ default:
51
+ /** @todo Error is to be displayed for 404 */
52
+ }
53
+ if ($slug != "" && $media_type != "") {
54
+ if (isset($bp->action_variables[1])) {
55
+ switch ($bp->action_variables[1]) {
56
+ case 'edit':
57
+ //Edit screen for image
58
+ break;
59
+ case 'delete':
60
+ //Delete function for media file
61
+ break;
62
+ default:
63
+ if (intval(bp_action_variable(1)) > 0) {
64
+ global $bp_media_current_entry;
65
+ try {
66
+ $bp_media_current_entry = new BPMediaHostWordpress(bp_action_variable(1));
67
+ if ($bp_media_current_entry->get_group_id() != bp_get_current_group_id())
68
+ throw new Exception(__('Sorry, the requested media does not belong to the group', BP_MEDIA_TXT_DOMAIN));
69
+ } catch (Exception $e) {
70
+ /** Error Handling when media not present or not belong to the group */
71
+ bp_media_display_error($e->getMessage());
72
+ return;
73
+ }
74
+ if ($media_type == "album") {
75
+ $bp_media_content = new BPMediaAlbumScreen($media_type, BP_MEDIA_ALBUMS_ENTRY_SLUG);
76
+ $bp->action_variables[ 0 ]= BP_MEDIA_ALBUMS_ENTRY_SLUG;
77
+ $bp_media_content->entry_screen();
78
} else {
79
+ $bp_media_content = new BPMediaScreen($media_type, $slug);
80
}
81
+ $bp_media_content->entry_screen_content();
82
+
83
+ break;
84
+ } else {
85
+ /** @todo display 404 */
86
+ }
87
+ }
88
+ } else {
89
+ if ($media_type == "album") {
90
+ BPMediaGroupAction::bp_media_groups_albums_set_query();
91
+ $bp_media_content = new BPMediaAlbumScreen($media_type, $slug);
92
+ $bp_media_content->screen_content();
93
+ } else if ( $media_type == 'upload' ) {
94
+ if (BPMediaGroup::can_upload()) {
95
+ $bp_media_upload = new BPMediaUploadScreen('upload', BP_MEDIA_UPLOAD_SLUG);
96
+ $bp_media_upload->upload_screen_content();
97
}
98
} else {
99
+ $bp_media_content = new BPMediaScreen($media_type, $slug);
100
$bp_media_content->screen_content();
101
}
102
}
103
}
104
}
105
app/main/group/BPMediaGroupsExtension.php CHANGED
@@ -17,7 +17,7 @@ if (class_exists('BP_Group_Extension')) :// Recommended, to prevent problems dur
17
*/
18
function __construct() {
19
global $bp;
20
- $this->name = BP_MEDIA_LABEL;
21
$this->slug = BP_MEDIA_SLUG;
22
$this->create_step_position = 21;
23
$this->nav_item_position = 31;
@@ -128,9 +128,9 @@ if (class_exists('BP_Group_Extension')) :// Recommended, to prevent problems dur
128
<?php
129
}
130
131
-
132
133
}
134
135
-
136
endif; // class_exists( 'BP_Group_Extension' )
17
*/
18
function __construct() {
19
global $bp;
20
+ $this->name = __(BP_MEDIA_LABEL,BP_MEDIA_TXT_DOMAIN);
21
$this->slug = BP_MEDIA_SLUG;
22
$this->create_step_position = 21;
23
$this->nav_item_position = 31;
128
<?php
129
}
130
131
+
132
133
}
134
135
+
136
endif; // class_exists( 'BP_Group_Extension' )
app/main/group/dummy/BPMediaGroupUpload.php ADDED
@@ -0,0 +1,20 @@
1
+ <?php
2
+ /**
3
+ * Registers BPMediaGroupUpload class in groups in buddypress
4
+ *
5
+ * @package BuddyPressMedia
6
+ * @subpackage Group
7
+ *
8
+ * @author Hrishikesh Vaipurkar <hrishikesh.vaipurkar@rtcamp.com>
9
+ */
10
+ if ( class_exists( 'BP_Group_Extension' ) ) :
11
+ class BPMediaGroupUpload extends BPMediaGroupElementExtension {
12
+
13
+ function __construct() {
14
+ parent::__construct(BP_MEDIA_UPLOAD_LABEL, BP_MEDIA_UPLOAD_SLUG);
15
+ bp_register_group_extension("BPMediaGroupUpload");
16
+ }
17
+
18
+ }
19
+ endif;
20
+ ?>
app/main/includes/BPMediaActions.php CHANGED
@@ -127,6 +127,7 @@ class BPMediaActions {
127
wp_enqueue_script('jquery-ui-tabs');
128
wp_enqueue_script('bp-media-mejs', BP_MEDIA_URL . 'lib/media-element/mediaelement-and-player.min.js');
129
wp_enqueue_script('bp-media-default', BP_MEDIA_URL . 'app/assets/js/main.js');
130
global $bp;
131
$cur_group_id = NULL;
132
if (bp_is_active("groups"))
@@ -138,7 +139,9 @@ class BPMediaActions {
138
'action_variables' => isset($bp->action_variables) ? (empty($bp->action_variables) ? array(BP_MEDIA_IMAGES_SLUG) : $bp->action_variables) : array(BP_MEDIA_IMAGES_SLUG),
139
'displayed_user' => bp_displayed_user_id(),
140
'loggedin_user' => bp_loggedin_user_id(),
141
- 'current_group' => $cur_group_id
142
);
143
144
wp_localize_script('bp-media-default', 'bp_media_vars', $bp_media_vars);
@@ -582,4 +585,4 @@ class BPMediaActions {
582
}
583
584
}
585
- ?>
127
wp_enqueue_script('jquery-ui-tabs');
128
wp_enqueue_script('bp-media-mejs', BP_MEDIA_URL . 'lib/media-element/mediaelement-and-player.min.js');
129
wp_enqueue_script('bp-media-default', BP_MEDIA_URL . 'app/assets/js/main.js');
130
+
131
global $bp;
132
$cur_group_id = NULL;
133
if (bp_is_active("groups"))
139
'action_variables' => isset($bp->action_variables) ? (empty($bp->action_variables) ? array(BP_MEDIA_IMAGES_SLUG) : $bp->action_variables) : array(BP_MEDIA_IMAGES_SLUG),
140
'displayed_user' => bp_displayed_user_id(),
141
'loggedin_user' => bp_loggedin_user_id(),
142
+ 'current_group' => $cur_group_id,
143
+ 'feature' => __('Featured', BP_MEDIA_TXT_DOMAIN),
144
+ 'removefeature' => __('Remove Featured', BP_MEDIA_TXT_DOMAIN)
145
);
146
147
wp_localize_script('bp-media-default', 'bp_media_vars', $bp_media_vars);
585
}
586
587
}
588
+ ?>
app/main/includes/BPMediaComponent.php CHANGED
@@ -106,40 +106,35 @@ class BPMediaComponent extends BP_Component {
106
break;
107
}
108
109
- if ( bp_is_my_profile() ) {
110
- $main_nav = array(
111
- 'name' => BP_MEDIA_LABEL,
112
- 'slug' => BP_MEDIA_SLUG,
113
- 'position' => 80,
114
- 'screen_function' => array( $bp_media_upload, 'upload_screen' ),
115
- 'default_subnav_slug' => BP_MEDIA_UPLOAD_SLUG
116
- );
117
- } else {
118
$main_nav = array(
119
- 'name' => BP_MEDIA_LABEL,
120
'slug' => BP_MEDIA_SLUG,
121
'position' => 80,
122
'screen_function' => array( $bp_media_image, 'screen' ),
123
'default_subnav_slug' => BP_MEDIA_IMAGES_SLUG
124
);
125
- }
126
- $sub_nav[ ] = array(
127
- 'name' => BP_MEDIA_UPLOAD_LABEL,
128
- 'slug' => BP_MEDIA_UPLOAD_SLUG,
129
- 'parent_url' => trailingslashit( bp_loggedin_user_domain() . BP_MEDIA_SLUG ),
130
- 'parent_slug' => BP_MEDIA_SLUG,
131
- 'screen_function' => array( $bp_media_upload, 'upload_screen' ),
132
- 'position' => 10,
133
- 'user_has_access' => bp_is_my_profile()
134
- );
135
- parent::setup_nav( $main_nav, $sub_nav );
136
-
137
- bp_core_new_nav_item( array(
138
- 'name' => BP_MEDIA_IMAGES_LABEL,
139
'slug' => BP_MEDIA_IMAGES_SLUG,
140
'screen_function' => array( $bp_media_image, 'screen' ),
141
) );
142
143
bp_core_new_subnav_item( array(
144
'name' => 'View', /* Display name for the nav item(It won't be shown anywhere) */
145
'slug' => BP_MEDIA_IMAGES_ENTRY_SLUG, /* URL slug for the nav item */
@@ -178,7 +173,7 @@ class BPMediaComponent extends BP_Component {
178
179
180
bp_core_new_nav_item( array(
181
- 'name' => BP_MEDIA_VIDEOS_LABEL,
182
'slug' => BP_MEDIA_VIDEOS_SLUG,
183
'screen_function' => array( $bp_media_video, 'screen' )
184
) );
@@ -221,7 +216,7 @@ class BPMediaComponent extends BP_Component {
221
222
223
bp_core_new_nav_item( array(
224
- 'name' => BP_MEDIA_AUDIO_LABEL,
225
'slug' => BP_MEDIA_AUDIO_SLUG,
226
'screen_function' => array( $bp_media_audio, 'screen' )
227
) );
@@ -264,7 +259,7 @@ class BPMediaComponent extends BP_Component {
264
265
266
bp_core_new_nav_item( array(
267
- 'name' => BP_MEDIA_ALBUMS_LABEL,
268
'slug' => BP_MEDIA_ALBUMS_SLUG,
269
'screen_function' => array( $bp_media_album, 'screen' ),
270
) );
@@ -304,6 +299,12 @@ class BPMediaComponent extends BP_Component {
304
'position' => 90, /* Index of where this nav item should be positioned */
305
'screen_function' => array( $bp_media_album, 'screen' ), /* The name of the function to run when clicked */
306
) );
307
}
308
309
/**
106
break;
107
}
108
109
+
110
+
111
+ // -------------- Removed Upload as default tab ------------- //
112
+ // if ( bp_is_my_profile() ) {
113
+ // $main_nav = array(
114
+ // 'name' => BP_MEDIA_LABEL,
115
+ // 'slug' => BP_MEDIA_SLUG,
116
+ // 'position' => 80,
117
+ // 'screen_function' => array( $bp_media_upload, 'upload_screen' ),
118
+ // 'default_subnav_slug' => BP_MEDIA_UPLOAD_SLUG
119
+ // );
120
+ // } else {
121
$main_nav = array(
122
+ 'name' => __(BP_MEDIA_LABEL,BP_MEDIA_TXT_DOMAIN),
123
'slug' => BP_MEDIA_SLUG,
124
'position' => 80,
125
'screen_function' => array( $bp_media_image, 'screen' ),
126
'default_subnav_slug' => BP_MEDIA_IMAGES_SLUG
127
);
128
+ // }
129
+ $sub_nav[ ] = array();
130
+ parent::setup_nav( $main_nav, $sub_nav );
131
+ bp_core_new_nav_item( array(
132
+ 'name' => __(BP_MEDIA_IMAGES_LABEL,BP_MEDIA_TXT_DOMAIN),
133
'slug' => BP_MEDIA_IMAGES_SLUG,
134
'screen_function' => array( $bp_media_image, 'screen' ),
135
) );
136
137
+
138
bp_core_new_subnav_item( array(
139
'name' => 'View', /* Display name for the nav item(It won't be shown anywhere) */
140
'slug' => BP_MEDIA_IMAGES_ENTRY_SLUG, /* URL slug for the nav item */
173
174
175
bp_core_new_nav_item( array(
176
+ 'name' => __(BP_MEDIA_VIDEOS_LABEL,BP_MEDIA_TXT_DOMAIN),
177
'slug' => BP_MEDIA_VIDEOS_SLUG,
178
'screen_function' => array( $bp_media_video, 'screen' )
179
) );
216
217
218
bp_core_new_nav_item( array(
219
+ 'name' => __(BP_MEDIA_AUDIO_LABEL,BP_MEDIA_TXT_DOMAIN),
220
'slug' => BP_MEDIA_AUDIO_SLUG,
221
'screen_function' => array( $bp_media_audio, 'screen' )
222
) );
259
260
261
bp_core_new_nav_item( array(
262
+ 'name' => __(BP_MEDIA_ALBUMS_LABEL,BP_MEDIA_TXT_DOMAIN),
263
'slug' => BP_MEDIA_ALBUMS_SLUG,
264
'screen_function' => array( $bp_media_album, 'screen' ),
265
) );
299
'position' => 90, /* Index of where this nav item should be positioned */
300
'screen_function' => array( $bp_media_album, 'screen' ), /* The name of the function to run when clicked */
301
) );
302
+ bp_core_new_nav_item( array(
303
+ 'name' => __(BP_MEDIA_UPLOAD_LABEL,BP_MEDIA_TXT_DOMAIN),
304
+ 'slug' => BP_MEDIA_UPLOAD_SLUG,
305
+ 'screen_function' => array( $bp_media_upload, 'upload_screen' ),
306
+ 'user_has_access' => bp_is_my_profile()
307
+ ) );
308
}
309
310
/**
app/main/includes/BPMediaFilters.php CHANGED
@@ -10,11 +10,11 @@ class BPMediaFilters {
10
function __construct() {
11
add_filter('bp_activity_get_permalink', array($this, 'activity_permalink_filter'), 10, 2);
12
add_filter('bp_get_activity_delete_link', array($this, 'delete_button_handler'));
13
- add_filter('bp_activity_get_user_join_filter', array($this, 'activity_query_filter'), 10);
14
// and we hook our function via wp_before_admin_bar_render
15
add_action('admin_bar_menu', array($this, 'my_account_menu'), 1);
16
// and we hook our function via wp_before_admin_bar_render
17
- add_action('wp_before_admin_bar_render', array($this, 'adminbar_settings_menu'));
18
global $bp_media_activity_types;
19
$bp_media_activity_types = array('media_upload', 'album_updated', 'album_created');
20
}
@@ -32,7 +32,7 @@ class BPMediaFilters {
32
}
33
if ($activity_obj != null && 'activity_comment' == $activity_obj->type) {
34
global $activities_template;
35
- remove_filter('bp_activity_get_user_join_filter', 'activity_query_filter', 10);
36
$parent = $activity_obj->item_id;
37
if ($parent) {
38
try {
@@ -87,8 +87,30 @@ class BPMediaFilters {
87
//add_filter('bp_get_activity_parent_content', 'activity_parent_content_filter', 1);
88
89
function delete_button_handler($link) {
90
if (bp_current_component() == 'media')
91
$link = str_replace('delete-activity ', 'delete-activity-single ', $link);
92
return $link;
93
}
94
@@ -124,7 +146,7 @@ class BPMediaFilters {
124
/**
125
* To hide some activities of multiple uploads
126
*/
127
- function activity_query_filter($query) {
128
global $wpdb;
129
$query = preg_replace('/WHERE/i', 'WHERE a.secondary_item_id!=-999 AND ', $query);
130
return $query;
@@ -239,9 +261,9 @@ class BPMediaFilters {
239
'title' => __('Support', BP_MEDIA_TXT_DOMAIN),
240
'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-support'), 'admin.php'))
241
);
242
-
243
$bp_media_admin_nav = apply_filters('bp_media_add_admin_bar_item', $bp_media_admin_nav);
244
-
245
foreach ($bp_media_admin_nav as $admin_menu)
246
$wp_admin_bar->add_menu($admin_menu);
247
}
@@ -255,9 +277,9 @@ class BPMediaFilters {
255
256
function dashboard_widgets() {
257
global $wp_meta_boxes;
258
- // Buddypress Media
259
// if ( is_user_admin() )
260
- wp_add_dashboard_widget('dashboard_media_widget', __('BuddyPress Media'), array($this,'dashboard_media'));
261
262
global $wp_meta_boxes;
263
10
function __construct() {
11
add_filter('bp_activity_get_permalink', array($this, 'activity_permalink_filter'), 10, 2);
12
add_filter('bp_get_activity_delete_link', array($this, 'delete_button_handler'));
13
+ add_filter('bp_activity_get_user_join_filter', 'BPMediaFilters::activity_query_filter', 10);
14
// and we hook our function via wp_before_admin_bar_render
15
add_action('admin_bar_menu', array($this, 'my_account_menu'), 1);
16
// and we hook our function via wp_before_admin_bar_render
17
+ add_action('wp_before_admin_bar_render', 'BPMediaFilters::adminbar_settings_menu');
18
global $bp_media_activity_types;
19
$bp_media_activity_types = array('media_upload', 'album_updated', 'album_created');
20
}
32
}
33
if ($activity_obj != null && 'activity_comment' == $activity_obj->type) {
34
global $activities_template;
35
+ remove_filter('bp_activity_get_user_join_filter', array($this, 'activity_query_filter'), 10);
36
$parent = $activity_obj->item_id;
37
if ($parent) {
38
try {
87
//add_filter('bp_get_activity_parent_content', 'activity_parent_content_filter', 1);
88
89
function delete_button_handler($link) {
90
+ global $activities_template;
91
+ $media_label = NULL;
92
+
93
if (bp_current_component() == 'media')
94
$link = str_replace('delete-activity ', 'delete-activity-single ', $link);
95
+
96
+ if ('album_updated' == $activities_template->activity->type) {
97
+ $media_label = BP_MEDIA_ALBUMS_LABEL_SINGULAR;
98
+ } elseif ($activities_template->activity->item_id) {
99
+ $mime_type = get_post_field('post_mime_type', $activities_template->activity->item_id);
100
+ $media_type = explode('/', $mime_type);
101
+ switch ($media_type[0]) {
102
+ case 'image': $media_label = BP_MEDIA_IMAGES_LABEL_SINGULAR;
103
+ break;
104
+ case 'audio': $media_label = BP_MEDIA_AUDIO_LABEL_SINGULAR;
105
+ break;
106
+ case 'video': $media_label = BP_MEDIA_VIDEOS_LABEL_SINGULAR;
107
+ break;
108
+ }
109
+ }
110
+
111
+ if ($media_label)
112
+ $link = str_replace('Delete', sprintf(__('Delete %s', BP_MEDIA_TXT_DOMAIN), $media_label), $link);
113
+
114
return $link;
115
}
116
146
/**
147
* To hide some activities of multiple uploads
148
*/
149
+ static function activity_query_filter($query) {
150
global $wpdb;
151
$query = preg_replace('/WHERE/i', 'WHERE a.secondary_item_id!=-999 AND ', $query);
152
return $query;
261
'title' => __('Support', BP_MEDIA_TXT_DOMAIN),
262
'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-support'), 'admin.php'))
263
);
264
+
265
$bp_media_admin_nav = apply_filters('bp_media_add_admin_bar_item', $bp_media_admin_nav);
266
+
267
foreach ($bp_media_admin_nav as $admin_menu)
268
$wp_admin_bar->add_menu($admin_menu);
269
}
277
278
function dashboard_widgets() {
279
global $wp_meta_boxes;
280
+ // BuddyPress Media
281
// if ( is_user_admin() )
282
+ wp_add_dashboard_widget('dashboard_media_widget', __('BuddyPress Media'), array($this, 'dashboard_media'));
283
284
global $wp_meta_boxes;
285
app/main/includes/BPMediaHostWordpress.php CHANGED
@@ -59,8 +59,12 @@ class BPMediaHostWordpress {
59
* But for use in the class, we use group_id as positive integer even though
60
* we use it as negative value in the bp-media-key meta key
61
*/
62
$this->group_id = $meta_key < 0 ? -$meta_key : 0;
63
- preg_match_all('/audio|video|image/i', $media->post_mime_type, $result);
64
if (isset($result[0][0]))
65
$this->type = $result[0][0];
66
else
@@ -228,7 +232,7 @@ class BPMediaHostWordpress {
228
return false;
229
}
230
$activity_content .= '</div>';
231
- $activity_content .= '<div class="bp_media_description">' . __(wp_html_excerpt($this->description, $bp_media_default_excerpts['activity_entry_description']), BP_MEDIA_TXT_DOMAIN) . '</div>';
232
return $activity_content;
233
}
234
@@ -286,7 +290,7 @@ class BPMediaHostWordpress {
286
return false;
287
}
288
$content .= '</div>';
289
- $content .= '<div class="bp_media_description">' . __(wp_html_excerpt($this->description, $bp_media_default_excerpts['single_entry_description']), BP_MEDIA_TXT_DOMAIN) . '</div>';
290
return $content;
291
}
292
@@ -295,7 +299,7 @@ class BPMediaHostWordpress {
295
*/
296
function get_media_single_title() {
297
global $bp_media_default_excerpts, $bp_media;
298
- $content = '<div class="bp_media_title">' . __(wp_html_excerpt($this->name, $bp_media_default_excerpts['single_entry_title']), BP_MEDIA_TXT_DOMAIN) . '</div>';
299
return $content;
300
}
301
@@ -697,6 +701,12 @@ class BPMediaHostWordpress {
697
$image_array = image_downsize($this->id, 'bp_media_single_image');
698
$this->thumbnail_id = $this->id;
699
break;
700
default :
701
return false;
702
}
@@ -708,6 +718,7 @@ class BPMediaHostWordpress {
708
*/
709
function check_and_create_album($album_id, $group) {
710
global $wpdb;
711
$create_new_album_flag = false;
712
if ($album_id != 0) {
713
$album = get_post($album_id);
@@ -725,7 +736,7 @@ class BPMediaHostWordpress {
725
"SELECT ID
726
FROM $wpdb->posts
727
WHERE
728
- post_title = 'Wall Posts'
729
AND post_author = '" . get_current_user_id() . "'
730
AND post_type='bp_media_album'"
731
);
@@ -736,12 +747,12 @@ class BPMediaHostWordpress {
736
INNER JOIN $wpdb->postmeta ON $wpdb->posts.ID = $wpdb->postmeta.post_id
737
AND $wpdb->postmeta.meta_key = 'bp-media-key'
738
AND $wpdb->postmeta.meta_value = -$group
739
- AND $wpdb->posts.post_title = 'Wall Posts'");
740
}
741
if ($post_id == null) {
742
$album = new BPMediaAlbum();
743
if ($group == 0)
744
- $album->add_album('Wall Posts', get_current_user_id(), $group);
745
else {
746
$current_user = wp_get_current_user();
747
$album->add_album($current_user->display_name . '\'s Album', get_current_user_id(), $group);
@@ -753,4 +764,4 @@ class BPMediaHostWordpress {
753
}
754
755
}
756
- ?>
59
* But for use in the class, we use group_id as positive integer even though
60
* we use it as negative value in the bp-media-key meta key
61
*/
62
+
63
$this->group_id = $meta_key < 0 ? -$meta_key : 0;
64
+ if ( !'bp_media_album' == $media->post_type || !empty($media->post_mime_type) )
65
+ preg_match_all('/audio|video|image/i', $media->post_mime_type, $result);
66
+ else
67
+ $result[0][0] = 'album';
68
if (isset($result[0][0]))
69
$this->type = $result[0][0];
70
else
232
return false;
233
}
234
$activity_content .= '</div>';
235
+ $activity_content .= '<div class="bp_media_description">' . wp_html_excerpt($this->description, $bp_media_default_excerpts['activity_entry_description']). '</div>';
236
return $activity_content;
237
}
238
290
return false;
291
}
292
$content .= '</div>';
293
+ $content .= '<div class="bp_media_description">' .wp_html_excerpt($this->description, $bp_media_default_excerpts['single_entry_description']) . '</div>';
294
return $content;
295
}
296
299
*/
300
function get_media_single_title() {
301
global $bp_media_default_excerpts, $bp_media;
302
+ $content = '<div class="bp_media_title">' . wp_html_excerpt($this->name, $bp_media_default_excerpts['single_entry_title']) . '</div>';
303
return $content;
304
}
305
701
$image_array = image_downsize($this->id, 'bp_media_single_image');
702
$this->thumbnail_id = $this->id;
703
break;
704
+ case 'album' :
705
+ $this->url = trailingslashit($pre_url . BP_MEDIA_ALBUMS_SLUG . '/' . $this->id);
706
+ $this->edit_url = trailingslashit($pre_url . BP_MEDIA_ALBUMS_SLUG . '/' . BP_MEDIA_ALBUMS_EDIT_SLUG . '/' . $this->id);
707
+ $this->delete_url = trailingslashit($pre_url . BP_MEDIA_ALBUMS_SLUG . '/' . BP_MEDIA_DELETE_SLUG . '/' . $this->id);
708
+ // $this->thumbnail_id = get_post_meta($this->id, 'bp_media_thumbnail', true);
709
+ break;
710
default :
711
return false;
712
}
718
*/
719
function check_and_create_album($album_id, $group) {
720
global $wpdb;
721
+ $post_wall=__( 'Wall Posts', BP_MEDIA_TXT_DOMAIN );
722
$create_new_album_flag = false;
723
if ($album_id != 0) {
724
$album = get_post($album_id);
736
"SELECT ID
737
FROM $wpdb->posts
738
WHERE
739
+ post_title = $post_wall
740
AND post_author = '" . get_current_user_id() . "'
741
AND post_type='bp_media_album'"
742
);
747
INNER JOIN $wpdb->postmeta ON $wpdb->posts.ID = $wpdb->postmeta.post_id
748
AND $wpdb->postmeta.meta_key = 'bp-media-key'
749
AND $wpdb->postmeta.meta_value = -$group
750
+ AND $wpdb->posts.post_title = $post_wall");
751
}
752
if ($post_id == null) {
753
$album = new BPMediaAlbum();
754
if ($group == 0)
755
+ $album->add_album($post_wall, get_current_user_id(), $group);
756
else {
757
$current_user = wp_get_current_user();
758
$album->add_album($current_user->display_name . '\'s Album', get_current_user_id(), $group);
764
}
765
766
}
767
+ ?>
app/main/includes/BPMediaTemplateFunctions.php CHANGED
@@ -34,56 +34,7 @@ class BPMediaTemplateFunctions {
34
<?php
35
}
36
37
- function show_upload_form_multiple() {
38
- global $bp, $bp_media;
39
- ?>
40
- <div id="bp-media-album-prompt" title="Select Album"><select id="bp-media-selected-album"><?php
41
- if (bp_is_current_component('groups')) {
42
- $albums = new WP_Query(array(
43
- 'post_type' => 'bp_media_album',
44
- 'posts_per_page' => -1,
45
- 'meta_key' => 'bp-media-key',
46
- 'meta_value' => -bp_get_current_group_id(),
47
- 'meta_compare' => '='
48
- ));
49
- } else {
50
- $albums = new WP_Query(array(
51
- 'post_type' => 'bp_media_album',
52
- 'posts_per_page' => -1,
53
- 'author' => get_current_user_id()
54
- ));
55
- }
56
- if (isset($albums->posts) && is_array($albums->posts) && count($albums->posts) > 0) {
57
- foreach ($albums->posts as $album) {
58
- if ($album->post_title == 'Wall Posts')
59
- echo '<option value="' . $album->ID . '" selected="selected">' . $album->post_title . '</option>';
60
- else
61
- echo '<option value="' . $album->ID . '">' . $album->post_title . '</option>';
62
- };
63
- }else {
64
- $album = new BPMediaAlbum();
65
- if (bp_is_current_component('groups')) {
66
- $current_group = new BP_Groups_Group(bp_get_current_group_id());
67
- $album->add_album('Wall Posts', $current_group->creator_id, bp_get_current_group_id());
68
- } else {
69
- $album->add_album('Wall Posts', bp_loggedin_user_id());
70
- }
71
- echo '<option value="' . $album->get_id() . '" selected="selected">' . $album->get_title() . '</option>';
72
- }
73
- ?></select></div>
74
- <div id="bp-media-album-new" title="Create New Album"><label for="bp_media_album_name">Album Name</label><input id="bp_media_album_name" type="text" name="bp_media_album_name" /></div>
75
- <div id="bp-media-upload-ui" class="hide-if-no-js drag-drop">
76
- <div id="drag-drop-area">
77
- <div class="drag-drop-inside">
78
- <p class="drag-drop-info">Drop files here</p>
79
- <p>or</p>
80
- <p class="drag-drop-buttons"><input id="bp-media-upload-browse-button" type="button" value="Select Files" class="button" /></p>
81
- </div>
82
- </div>
83
- </div>
84
- <div id="bp-media-uploaded-files"></div>
85
- <?php
86
- }
87
88
function show_pagination($type = 'top', $inner = false) {
89
global $bp, $bp_media_paginated_links, $bp_media_query, $bp_media_albums_query;
@@ -247,37 +198,12 @@ class BPMediaTemplateFunctions {
247
break;
248
}
249
if ($showmore) {
250
- echo '<div class="bp-media-actions"><a href="#" class="button" id="bp-media-show-more">Show More</a></div>';
251
}
252
}
253
254
- static function show_upload_form_multiple_activity() {
255
- global $bp, $bp_media_default_excerpts;
256
- if ($bp->current_component != 'activity')
257
- return;
258
- ?>
259
- <div id="bp-media-album-prompt" title="Select Album"><select id="bp-media-selected-album"><?php
260
- $albums = new WP_Query(array(
261
- 'post_type' => 'bp_media_album',
262
- 'posts_per_page' => -1,
263
- 'author' => get_current_user_id()
264
- ));
265
- if (isset($albums->posts) && is_array($albums->posts) && count($albums->posts) > 0) {
266
- foreach ($albums->posts as $album) {
267
- if ($album->post_title == 'Wall Posts')
268
- echo '<option value="' . $album->ID . '" selected="selected">' . $album->post_title . '</option>';
269
- else
270
- echo '<option value="' . $album->ID . '">' . $album->post_title . '</option>';
271
- };
272
- }
273
- ?></select></div>
274
- <div id="bp-media-album-new" title="Create New Album"><label for="bp_media_album_name">Album Name</label><input id="bp_media_album_name" type="text" name="bp_media_album_name" /></div>
275
- <div id="bp-media-upload-ui" class="hide-if-no-js drag-drop activity-component">
276
- <p class="drag-drop-buttons"><input id="bp-media-upload-browse-button" type="button" value="Add Media" class="button" /></p>
277
- </div>
278
- <div id="bp-media-uploaded-files"></div>
279
- <?php
280
- }
281
282
}
283
?>
34
<?php
35
}
36
37
+ //------------- Function removed show_upload_form_multiple() ------------
38
39
function show_pagination($type = 'top', $inner = false) {
40
global $bp, $bp_media_paginated_links, $bp_media_query, $bp_media_albums_query;
198
break;
199
}
200
if ($showmore) {
201
+ echo '<div class="bp-media-actions"><a href="#" class="button" id="bp-media-show-more">'. __('Show More', BP_MEDIA_TXT_DOMAIN).'</a></div>';
202
}
203
}
204
205
+ //----------- Function removed show_upload_form_multiple_activity() -------------
206
+
207
208
}
209
?>
app/main/includes/BPMediaUpgradeScript.php CHANGED
@@ -3,7 +3,8 @@ class BPMediaUpgradeScript{
3
4
static function upgrade_from_1_0_to_2_1(){
5
global $wpdb;
6
- remove_filter('bp_activity_get_user_join_filter','activity_query_filter',10);
7
/* @var $wpdb wpdb */
8
$wall_posts_album_ids=array();
9
do{
@@ -22,10 +23,10 @@ class BPMediaUpgradeScript{
22
$wall_posts_id = $wall_posts_album_ids[$media_file->post_author];
23
}
24
else{
25
- $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'");
26
if($wall_posts_id==null){
27
$album = new BPMediaAlbum();
28
- $album->add_album('Wall Posts',$media_file->post_author);
29
$wall_posts_id = $album->get_id();
30
}
31
if(!$wall_posts_id){
3
4
static function upgrade_from_1_0_to_2_1(){
5
global $wpdb;
6
+ $post_wall =__( 'Wall Posts', BP_MEDIA_TXT_DOMAIN );
7
+ remove_filter('bp_activity_get_user_join_filter','BPMediaFilters::activity_query_filter',10);
8
/* @var $wpdb wpdb */
9
$wall_posts_album_ids=array();
10
do{
23
$wall_posts_id = $wall_posts_album_ids[$media_file->post_author];
24
}
25
else{
26
+ $wall_posts_id = $wpdb->get_var( "SELECT ID FROM $wpdb->posts WHERE post_title = $post_wall AND post_author = '". $media_file->post_author."' AND post_type='bp_media_album'");
27
if($wall_posts_id==null){
28
$album = new BPMediaAlbum();
29
+ $album->add_album($post_wall,$media_file->post_author);
30
$wall_posts_id = $album->get_id();
31
}
32
if(!$wall_posts_id){
app/main/profile/BPMediaAlbum.php CHANGED
@@ -129,10 +129,10 @@ class BPMediaAlbum{
129
$author_id = $author_id?$author_id:get_current_user_id();
130
$post_vars = array(
131
'post_title' => $title,
132
- 'post_name' => $title,
133
- 'post_status'=> 'publish',
134
'post_type' => 'bp_media_album',
135
- 'post_author'=> $author_id
136
);
137
BPMediaActions::init_count($author_id);
138
global $bp_media_count;
@@ -261,6 +261,20 @@ class BPMediaAlbum{
261
return $this->owner;
262
}
263
264
/**
265
* Returns the group id to which the media belongs, 0 if it does not belong to any group
266
*/
129
$author_id = $author_id?$author_id:get_current_user_id();
130
$post_vars = array(
131
'post_title' => $title,
132
+ 'post_name' => $title,
133
+ 'post_status' => 'publish',
134
'post_type' => 'bp_media_album',
135
+ 'post_author' => $author_id
136
);
137
BPMediaActions::init_count($author_id);
138
global $bp_media_count;
261
return $this->owner;
262
}
263
264
+ /**
265
+ * Returns the edit url of the album
266
+ */
267
+ function get_edit_url(){
268
+ return $this->edit_url;
269
+ }
270
+
271
+ /**
272
+ * Returns the delete url of the album
273
+ */
274
+ function get_delete_url(){
275
+ return $this->delete_url;
276
+ }
277
+
278
/**
279
* Returns the group id to which the media belongs, 0 if it does not belong to any group
280
*/
app/main/profile/BPMediaAlbumScreen.php CHANGED
@@ -47,6 +47,7 @@ class BPMediaAlbumScreen extends BPMediaScreen {
47
global $bp_media_albums_query;
48
49
$this->hook_before();
50
if ( $bp_media_albums_query && $bp_media_albums_query->have_posts() ):
51
echo '<ul id="bp-media-list" class="bp-media-gallery item-list">';
52
while ( $bp_media_albums_query->have_posts() ) : $bp_media_albums_query->the_post();
@@ -80,19 +81,35 @@ class BPMediaAlbumScreen extends BPMediaScreen {
80
if ( ! $bp->action_variables[ 0 ] == BP_MEDIA_ALBUMS_ENTRY_SLUG )
81
return false;
82
echo '<div class="bp_media_title">' . $bp_media_current_album->get_title() . '</div>';
83
$this->inner_query( $bp_media_current_album->get_id() );
84
$this->hook_before();
85
if ( $bp_media_current_album && $bp_media_query->have_posts() ):
86
echo '<ul id="bp-media-list" class="bp-media-gallery item-list">';
87
- while ( $bp_media_query->have_posts() ) : $bp_media_query->the_post();
88
$this->template->the_content();
89
- endwhile;
90
echo '</ul>';
91
$this->template->show_more();
92
else:
93
BPMediaFunction::show_formatted_error_message( __( 'Sorry, no media items were found in this album.', BP_MEDIA_TXT_DOMAIN ), 'info' );
94
endif;
95
- $this->hook_after();
96
}
97
98
function set_query() {
47
global $bp_media_albums_query;
48
49
$this->hook_before();
50
+
51
if ( $bp_media_albums_query && $bp_media_albums_query->have_posts() ):
52
echo '<ul id="bp-media-list" class="bp-media-gallery item-list">';
53
while ( $bp_media_albums_query->have_posts() ) : $bp_media_albums_query->the_post();
81
if ( ! $bp->action_variables[ 0 ] == BP_MEDIA_ALBUMS_ENTRY_SLUG )
82
return false;
83
echo '<div class="bp_media_title">' . $bp_media_current_album->get_title() . '</div>';
84
+ if ( bp_displayed_user_id() == bp_loggedin_user_id() ) {
85
+ echo '<div class="activity-meta">';
86
+ echo '<a href="' . $bp_media_current_album->get_edit_url() . '" class="button item-button bp-secondary-action bp-media-edit bp-media-edit-album" title="' . __('Rename Album', BP_MEDIA_TXT_DOMAIN) . '">' . __('Rename', BP_MEDIA_TXT_DOMAIN) . '</a>';
87
+ echo '<a href="' . $bp_media_current_album->get_delete_url() . '" class="button item-button bp-secondary-action delete-activity-single confirm" rel="nofollow">' . __("Delete", BP_MEDIA_TXT_DOMAIN) . '</a>';
88
+ echo '</div>';
89
+ }
90
+
91
$this->inner_query( $bp_media_current_album->get_id() );
92
$this->hook_before();
93
if ( $bp_media_current_album && $bp_media_query->have_posts() ):
94
echo '<ul id="bp-media-list" class="bp-media-gallery item-list">';
95
+ if ( bp_is_my_profile() || BPMediaGroup::can_upload() ) {
96
+ echo '<li>';
97
+ BPMediaUploadScreen::upload_screen_content();
98
+ echo '</li>';
99
+ }
100
+ while ( $bp_media_query->have_posts() ) : $bp_media_query->the_post();
101
$this->template->the_content();
102
+ endwhile;
103
echo '</ul>';
104
$this->template->show_more();
105
else:
106
BPMediaFunction::show_formatted_error_message( __( 'Sorry, no media items were found in this album.', BP_MEDIA_TXT_DOMAIN ), 'info' );
107
+ if ( bp_is_my_profile() || BPMediaGroup::can_upload() ) {
108
+ echo '<div class="bp-media-area-allocate"></div>';
109
+ BPMediaUploadScreen::upload_screen_content();
110
+ }
111
endif;
112
+ $this->hook_after();
113
}
114
115
function set_query() {
app/main/profile/BPMediaScreen.php CHANGED
@@ -123,7 +123,7 @@ class BPMediaScreen {
123
124
global $bp;
125
126
- remove_filter( 'bp_activity_get_user_join_filter', 'activity_query_filter', 10 );
127
if ( isset( $bp->action_variables[ 0 ] ) ) {
128
switch ( $bp->action_variables[ 0 ] ) {
129
case constant( $editslug ) :
@@ -160,15 +160,24 @@ class BPMediaScreen {
160
$this->set_query();
161
162
$this->hook_before();
163
- if ( $bp_media_query && $bp_media_query->have_posts() ):
164
- echo '<ul id="bp-media-list" class="bp-media-gallery item-list">';
165
- while ( $bp_media_query->have_posts() ) : $bp_media_query->the_post();
166
$this->template->the_content();
167
endwhile;
168
echo '</ul>';
169
$this->template->show_more();
170
else:
171
BPMediaFunction::show_formatted_error_message( sprintf( __( 'Sorry, no %s were found.', BP_MEDIA_TXT_DOMAIN ), $this->slug ), 'info' );
172
endif;
173
$this->hook_after();
174
}
@@ -286,13 +295,15 @@ class BPMediaScreen {
286
<input id="bp-media-upload-input-title" type="text" name="bp_media_title" class="settings-input"
287
maxlength="<?php echo max( array( $bp_media_default_excerpts[ 'single_entry_title' ], $bp_media_default_excerpts[ 'activity_entry_title' ] ) ) ?>"
288
value="<?php echo $bp_media_current_entry->get_title(); ?>" />
289
- <label for="bp-media-upload-input-description">
290
<?php printf( __( '%s Description', BP_MEDIA_TXT_DOMAIN ), ucfirst( $this->media_type ) ); ?>
291
- </label>
292
- <input id="bp-media-upload-input-description" type="text" name="bp_media_description" class="settings-input"
293
- maxlength="<?php echo max( array( $bp_media_default_excerpts[ 'single_entry_description' ], $bp_media_default_excerpts[ 'activity_entry_description' ] ) ) ?>"
294
- value="<?php echo $bp_media_current_entry->get_content(); ?>" />
295
- <?php do_action('bp_media_add_media_fields', $this->media_type); ?>
296
<div class="submit">
297
<input type="submit" class="auto" value="<?php _e( 'Update', BP_MEDIA_TXT_DOMAIN ); ?>" />
298
<a href="<?php echo $bp_media_current_entry->get_url(); ?>" class="button" title="<?php _e( 'Back to Media File', BP_MEDIA_TXT_DOMAIN ); ?>">
@@ -398,6 +409,5 @@ class BPMediaScreen {
398
$bp_media_query = new WP_Query( $args );
399
}
400
}
401
-
402
}
403
?>
123
124
global $bp;
125
126
+ remove_filter( 'bp_activity_get_user_join_filter', 'BPMediaFilters::activity_query_filter', 10 );
127
if ( isset( $bp->action_variables[ 0 ] ) ) {
128
switch ( $bp->action_variables[ 0 ] ) {
129
case constant( $editslug ) :
160
$this->set_query();
161
162
$this->hook_before();
163
+ if ( $bp_media_query && $bp_media_query->have_posts() ):
164
+ echo '<ul id="bp-media-list" class="bp-media-gallery item-list">';
165
+ if ( bp_is_my_profile() || BPMediaGroup::can_upload() ) {
166
+ echo '<li>';
167
+ BPMediaUploadScreen::upload_screen_content();
168
+ echo '</li>';
169
+ }
170
+ while ( $bp_media_query->have_posts() ) : $bp_media_query->the_post();
171
$this->template->the_content();
172
endwhile;
173
echo '</ul>';
174
$this->template->show_more();
175
else:
176
BPMediaFunction::show_formatted_error_message( sprintf( __( 'Sorry, no %s were found.', BP_MEDIA_TXT_DOMAIN ), $this->slug ), 'info' );
177
+ if ( bp_is_my_profile() || BPMediaGroup::can_upload() ) {
178
+ echo '<div class="bp-media-area-allocate"></div>';
179
+ BPMediaUploadScreen::upload_screen_content();
180
+ }
181
endif;
182
$this->hook_after();
183
}
295
<input id="bp-media-upload-input-title" type="text" name="bp_media_title" class="settings-input"
296
maxlength="<?php echo max( array( $bp_media_default_excerpts[ 'single_entry_title' ], $bp_media_default_excerpts[ 'activity_entry_title' ] ) ) ?>"
297
value="<?php echo $bp_media_current_entry->get_title(); ?>" />
298
+ <?php if ( $bp_media_current_entry->get_type() != 'album' ) { ?>
299
+ <label for="bp-media-upload-input-description">
300
<?php printf( __( '%s Description', BP_MEDIA_TXT_DOMAIN ), ucfirst( $this->media_type ) ); ?>
301
+ </label>
302
+ <input id="bp-media-upload-input-description" type="text" name="bp_media_description" class="settings-input"
303
+ maxlength="<?php echo max( array( $bp_media_default_excerpts[ 'single_entry_description' ], $bp_media_default_excerpts[ 'activity_entry_description' ] ) ) ?>"
304
+ value="<?php echo $bp_media_current_entry->get_content(); ?>" />
305
+ <?php }
306
+ do_action('bp_media_add_media_fields', $this->media_type); ?>
307
<div class="submit">
308
<input type="submit" class="auto" value="<?php _e( 'Update', BP_MEDIA_TXT_DOMAIN ); ?>" />
309
<a href="<?php echo $bp_media_current_entry->get_url(); ?>" class="button" title="<?php _e( 'Back to Media File', BP_MEDIA_TXT_DOMAIN ); ?>">
409
$bp_media_query = new WP_Query( $args );
410
}
411
}
412
}
413
?>
app/main/profile/BPMediaTemplate.php CHANGED
@@ -11,77 +11,68 @@
11
class BPMediaTemplate {
12
13
function upload_form_multiple() {
14
- ?>
15
- <div id="bp-media-album-prompt" title="Select Album">
16
- <div class="bp-media-album-title">
17
- <span><?php _e( 'Select Album', BP_MEDIA_TXT_DOMAIN ); ?></span>
18
- <span id="bp-media-close"><?php _e( 'x', BP_MEDIA_TXT_DOMAIN ); ?></span>
19
- </div>
20
- <div class="bp-media-album-content">
21
- <select id="bp-media-selected-album"><?php
22
- if ( bp_is_current_component( 'groups' ) ) {
23
- $albums = new WP_Query( array(
24
- 'post_type' => 'bp_media_album',
25
- 'posts_per_page' => -1,
26
- 'meta_key' => 'bp-media-key',
27
- 'meta_value' => -bp_get_current_group_id(),
28
- 'meta_compare' => '='
29
- ) );
30
- } else {
31
- $albums = new WP_Query( array(
32
- 'post_type' => 'bp_media_album',
33
- 'posts_per_page' => -1,
34
- 'author' => get_current_user_id()
35
- ) );
36
- }
37
- if ( isset( $albums->posts ) && is_array( $albums->posts ) && count( $albums->posts ) > 0 ) {
38
- foreach ( $albums->posts as $album ) {
39
- if ( $album->post_title == 'Wall Posts' )
40
- echo '<option value="' . $album->ID . '" selected="selected">' . $album->post_title . '</option>';
41
- else
42
- echo '<option value="' . $album->ID . '">' . $album->post_title . '</option>';
43
- };
44
- }else {
45
- $album = new BPMediaAlbum();
46
- if ( bp_is_current_component( 'groups' ) ) {
47
- $current_group = new BP_Groups_Group( bp_get_current_group_id() );
48
- $album->add_album( 'Wall Posts', $current_group->creator_id, bp_get_current_group_id() );
49
- } else {
50
- $album->add_album( 'Wall Posts', bp_loggedin_user_id() );
51
- }
52
- echo '<option value="' . $album->get_id() . '" selected="selected">' . $album->get_title() . '</option>';
53
- }
54
- ?></select>
55
- </div>
56
- <div class="select-btn-div">
57
- <input id="selected-btn" type="button" class="btn" value="Select" />
58
- <input id="create-btn" type="button" class="btn" value="Create Album" />
59
- <div style="clear: both;"></div>
60
- </div>
61
- </div>
62
- <div id="bp-media-album-new" title="Create New Album">
63
- <div class="bp-media-album-title">
64
- <span><?php _e( 'Create Album', BP_MEDIA_TXT_DOMAIN ); ?></span>
65
- <span id="bp-media-create-album-close"><?php _e( 'x', BP_MEDIA_TXT_DOMAIN ); ?></span>
66
- </div>
67
- <div class="bp-media-album-content">
68
- <label for="bp_media_album_name"><?php _e( 'Album Name', BP_MEDIA_TXT_DOMAIN ); ?></label>
69
- <input id="bp_media_album_name" type="text" name="bp_media_album_name" />
70
</div>
71
- <div class="select-btn-div">
72
- <input id="create-album" type="button" class="btn" value="Create" />
73
- </div>
74
- </div>
75
- <div id="bp-media-upload-ui" class="hide-if-no-js drag-drop">
76
- <div id="drag-drop-area">
77
- <div class="drag-drop-inside">
78
- <p class="drag-drop-info"><?php _e( 'Drop files here', BP_MEDIA_TXT_DOMAIN ); ?></p>
79
- <p><?php _e( ' or ', BP_MEDIA_TXT_DOMAIN ); ?></p>
80
- <p class="drag-drop-buttons"><input id="bp-media-upload-browse-button" type="button" value="<?php _e( 'Select Files', BP_MEDIA_TXT_DOMAIN ); ?>" class="button" /></p>
81
- </div>
82
- </div>
83
</div>
84
- <div id="bp-media-uploaded-files"></div>
85
<?php
86
}
87
@@ -163,7 +154,7 @@ class BPMediaTemplate {
163
break;
164
}
165
if ( $showmore ) {
166
- echo '<div class="bp-media-actions"><a href="#" class="button" id="bp-media-show-more">Show More</a></div>';
167
}
168
}
169
@@ -186,7 +177,13 @@ class BPMediaTemplate {
186
if ( $bp->current_component != 'activity' )
187
return;
188
?>
189
- <div id="bp-media-album-prompt" title="Select Album"><select id="bp-media-selected-album"><?php
190
$albums = new WP_Query( array(
191
'post_type' => 'bp_media_album',
192
'posts_per_page' => -1,
@@ -194,18 +191,37 @@ class BPMediaTemplate {
194
) );
195
if ( isset( $albums->posts ) && is_array( $albums->posts ) && count( $albums->posts ) > 0 ) {
196
foreach ( $albums->posts as $album ) {
197
- if ( $album->post_title == 'Wall Posts' )
198
- echo '<option value="' . $album->ID . '" selected="selected">' . $album->post_title . '</option>';
199
else
200
- echo '<option value="' . $album->ID . '">' . $album->post_title . '</option>';
201
};
202
}
203
- ?></select></div>
204
- <div id="bp-media-album-new" title="Create New Album"><label for="bp_media_album_name">Album Name</label><input id="bp_media_album_name" type="text" name="bp_media_album_name" /></div>
205
<div id="bp-media-upload-ui" class="hide-if-no-js drag-drop activity-component">
206
- <p class="drag-drop-buttons"><input id="bp-media-upload-browse-button" type="button" value="Add Media" class="button" /></p>
207
</div>
208
- <div id="bp-media-uploaded-files"></div>
209
<?php
210
}
211
11
class BPMediaTemplate {
12
13
function upload_form_multiple() {
14
+ global $bp_media_current_album;
15
+ $post_wall = __( 'Wall Posts', BP_MEDIA_TXT_DOMAIN );
16
+ if ( !isset ( $bp_media_current_album ) ) { ?>
17
+ <div id="bp-media-album-prompt" title="Select Album">
18
+ <span><?php _e( 'Select Album', BP_MEDIA_TXT_DOMAIN ); ?></span>
19
+ <div class="bp-media-album-content">
20
+ <select id="bp-media-selected-album"><?php
21
+ if ( bp_is_current_component( 'groups' ) ) {
22
+ $albums = new WP_Query( array(
23
+ 'post_type' => 'bp_media_album',
24
+ 'posts_per_page' => -1,
25
+ 'meta_key' => 'bp-media-key',
26
+ 'meta_value' => -bp_get_current_group_id(),
27
+ 'meta_compare' => '='
28
+ ) );
29
+ } else {
30
+ $albums = new WP_Query( array(
31
+ 'post_type' => 'bp_media_album',
32
+ 'posts_per_page' => -1,
33
+ 'author' => get_current_user_id()
34
+ ) );
35
+ }
36
+ if ( isset( $albums->posts ) && is_array( $albums->posts ) && count( $albums->posts ) > 0 ) {
37
+ foreach ( $albums->posts as $album ) {
38
+ if ( $album->post_title == $post_wall )
39
+ echo '<option value="' . $album->ID . '" selected="selected">' .$album->post_title. '</option>';
40
+ else
41
+ echo '<option value="' . $album->ID . '">' .$album->post_title. '</option>';
42
+ };
43
+ }else {
44
+ $album = new BPMediaAlbum();
45
+ if ( bp_is_current_component( 'groups' ) ) {
46
+ $current_group = new BP_Groups_Group( bp_get_current_group_id() );
47
+ $album->add_album( $post_wall, $current_group->creator_id, bp_get_current_group_id() );
48
+ } else {
49
+ $album->add_album( $post_wall, bp_loggedin_user_id() );
50
+ }
51
+ echo '<option value="' . $album->get_id() . '" selected="selected">' .$album->get_title() ->post_title. '</option>';
52
+ }
53
+ echo '<option id="create-new" value="create_new" >' . __('+ Create New Album', BP_MEDIA_TXT_DOMAIN ). '</option>';
54
+ ?>
55
+ </select>
56
+ </div>
57
+ <div class="hide">
58
+ <input type="text" id="bp_media_album_new" value="" />
59
+ <input type="button" class="button" id="btn-create-new" value="<?php _e( 'Create', BP_MEDIA_TXT_DOMAIN ); ?>"/>
60
+ <input type="button" class="button" id="btn-create-cancel" value="<?php _e( 'Cancel', BP_MEDIA_TXT_DOMAIN ); ?>"/>
61
+ </div>
62
+ </div><?php
63
+ } else { ?>
64
+ <input type="hidden" id="bp-media-selected-album" value="<?php echo $bp_media_current_album->get_id(); ?>"/>
65
+ <?php } ?>
66
+ <div id="bp-media-upload-ui" class="hide-if-no-js drag-drop">
67
+ <div id="drag-drop-area">
68
+ <div class="drag-drop-inside">
69
+ <p class="drag-drop-info"><?php _e( 'Drop files here', BP_MEDIA_TXT_DOMAIN ); ?></p>
70
+ <p><?php _e( ' or ', BP_MEDIA_TXT_DOMAIN ); ?></p>
71
+ <p class="drag-drop-buttons"><input id="bp-media-upload-browse-button" type="button" value="<?php _e( 'Select Files', BP_MEDIA_TXT_DOMAIN ); ?>" class="button" /></p>
72
+ </div>
73
</div>
74
+ <div id="bp-media-uploaded-files"></div>
75
</div>
76
<?php
77
}
78
154
break;
155
}
156
if ( $showmore ) {
157
+ echo '<div class="bp-media-actions"><a href="#" class="button" id="bp-media-show-more">'. __('Show More', BP_MEDIA_TXT_DOMAIN).'</a></div>';
158
}
159
}
160
177
if ( $bp->current_component != 'activity' )
178
return;
179
?>
180
+ <div id="bp-media-album-prompt" title="Select Album">
181
+ <div class="bp-media-album-title">
182
+ <span><?php _e( 'Select Album', BP_MEDIA_TXT_DOMAIN ); ?></span>
183
+ <span id="bp-media-close"><?php _e( 'x', BP_MEDIA_TXT_DOMAIN ); ?></span>
184
+ </div>
185
+ <div class="bp-media-album-content">
186
+ <select id="bp-media-selected-album"><?php
187
$albums = new WP_Query( array(
188
'post_type' => 'bp_media_album',
189
'posts_per_page' => -1,
191
) );
192
if ( isset( $albums->posts ) && is_array( $albums->posts ) && count( $albums->posts ) > 0 ) {
193
foreach ( $albums->posts as $album ) {
194
+ if ( $album->post_title == $post_wall )
195
+ echo '<option value="' . $album->ID . '" selected="selected">' . $album->post_title. '</option>';
196
else
197
+ echo '<option value="' . $album->ID . '">' . $album->post_title, BP_MEDIA_TXT_DOMAIN . '</option>';
198
};
199
}
200
+ ?></select>
201
+ </div>
202
+ <div class="select-btn-div">
203
+ <input id="selected-btn" type="button" class="btn" value="<?php _e( 'Select', BP_MEDIA_TXT_DOMAIN ); ?>" />
204
+ <input id="create-btn" type="button" class="btn" value="<?php _e( 'Create Album', BP_MEDIA_TXT_DOMAIN ); ?>" />
205
+ <div style="clear: both;"></div>
206
+ </div>
207
+ </div>
208
+ <div id="bp-media-album-new" title="Create New Album">
209
+ <div class="bp-media-album-title">
210
+ <span><?php _e( 'Create Album', BP_MEDIA_TXT_DOMAIN ); ?></span>
211
+ <span id="bp-media-create-album-close"><?php _e( 'x', BP_MEDIA_TXT_DOMAIN ); ?></span>
212
+ </div>
213
+ <div class="bp-media-album-content">
214
+ <label for="bp_media_album_name"><?php _e( 'Album Name', BP_MEDIA_TXT_DOMAIN ); ?></label>
215
+ <input id="bp_media_album_name" type="text" name="bp_media_album_name" />
216
+ </div>
217
+ <div class="select-btn-div">
218
+ <input id="create-album" type="button" class="btn" value="<?php _e( 'Create', BP_MEDIA_TXT_DOMAIN ); ?>" />
219
+ </div>
220
+ </div>
221
<div id="bp-media-upload-ui" class="hide-if-no-js drag-drop activity-component">
222
+ <p class="drag-drop-buttons"><input id="bp-media-upload-browse-button" type="button" value="<?php _e( 'Add Media', BP_MEDIA_TXT_DOMAIN ); ?>" class="button" /></p>
223
+ <div id="bp-media-uploaded-files"></div>
224
</div>
225
<?php
226
}
227
app/main/profile/BPMediaUploadScreen.php CHANGED
@@ -15,10 +15,13 @@ class BPMediaUploadScreen extends BPMediaScreen {
15
}
16
17
function upload_screen() {
18
- add_action( 'wp_enqueue_scripts', array( $this, 'upload_enqueue' ) );
19
- add_action( 'bp_template_title', array( $this, 'upload_screen_title' ) );
20
- add_action( 'bp_template_content', array( $this, 'upload_screen_content' ) );
21
- $this->template->loader();
22
}
23
24
function upload_screen_title() {
@@ -28,7 +31,7 @@ class BPMediaUploadScreen extends BPMediaScreen {
28
function upload_screen_content() {
29
$this->hook_before();
30
31
- $this->template->upload_form_multiple();
32
33
$this->hook_after();
34
}
15
}
16
17
function upload_screen() {
18
+ if ( bp_is_my_profile() || BPMediaGroup::can_upload() ) {
19
+ add_action( 'wp_enqueue_scripts', array( $this, 'upload_enqueue' ) );
20
+ add_action( 'bp_template_title', array( $this, 'upload_screen_title' ) );
21
+ add_action( 'bp_template_content', array( $this, 'upload_screen_content' ) );
22
+ $this->template->loader();
23
+ } else
24
+ bp_core_redirect( trailingslashit( bp_displayed_user_domain() . constant( 'BP_MEDIA_SLUG' ) ) );
25
}
26
27
function upload_screen_title() {
31
function upload_screen_content() {
32
$this->hook_before();
33
34
+ $this->template->upload_form_multiple();
35
36
$this->hook_after();
37
}
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, videos and audios uploading to BuddyPress which are essential if you are building social network, seriously!
6
- Version: 2.4.3
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, videos and audios uploading to BuddyPress which are essential if you are building social network, seriously!
6
+ Version: 2.5
7
Author: rtCamp
8
Text Domain: buddypress-media
9
Author URI: http://rtcamp.com
languages/buddypress-media-es.mo ADDED
Binary file
languages/buddypress-media-ja.mo ADDED
Binary file
languages/buddypress-media-pt_BR.mo ADDED
Binary file
languages/buddypress-media.mo ADDED
Binary file
languages/buddypress-media.po CHANGED
@@ -1,23 +1,21 @@
1
msgid ""
2
msgstr ""
3
- "Project-Id-Version: Buddypress Media\n"
4
"Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2013-01-14 17:03+0530\n"
6
- "PO-Revision-Date: 2013-01-14 17:03+0530\n"
7
"Last-Translator: Saurabh Shukla <saurabh.shukla@rtcamp.com>\n"
8
"Language-Team: rtCamp <info@rtcamp.com>\n"
9
"Language: \n"
10
"MIME-Version: 1.0\n"
11
"Content-Type: text/plain; charset=UTF-8\n"
12
"Content-Transfer-Encoding: 8bit\n"
13
- "X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
14
"X-Poedit-Basepath: ../.\n"
15
"X-Poedit-SearchPath-0: .\n"
16
17
- #: app/helper/BPMediaWidget.php:22
18
- msgid "Argument missing. id is required."
19
- msgstr ""
20
-
21
#: app/helper/BPMediaFeed.php:38
22
msgid "No items"
23
msgstr ""
@@ -34,98 +32,133 @@ msgstr ""
34
msgid "Video"
35
msgstr ""
36
37
- #: app/helper/BPMediaSettings.php:26
38
msgid "Check to enable video upload functionality"
39
msgstr ""
40
41
- #: app/helper/BPMediaSettings.php:28
42
msgid "Audio"
43
msgstr ""
44
45
- #: app/helper/BPMediaSettings.php:30
46
msgid "Check to enable audio upload functionality"
47
msgstr ""
48
49
- #: app/helper/BPMediaSettings.php:32
50
msgid "Images"
51
msgstr ""
52
53
- #: app/helper/BPMediaSettings.php:34
54
msgid "Check to enable images upload functionality"
55
msgstr ""
56
57
- #: app/helper/BPMediaSettings.php:36
58
msgid "Download"
59
msgstr ""
60
61
- #: app/helper/BPMediaSettings.php:38
62
msgid "Check to enable download functionality"
63
msgstr ""
64
65
- #: app/helper/BPMediaSettings.php:40
66
- #: app/helper/BPMediaSettings.php:41
67
msgid "Spread the Word"
68
msgstr ""
69
70
- #: app/helper/BPMediaSettings.php:44
71
msgid "Yes, I support BuddyPress Media"
72
msgstr ""
73
74
- #: app/helper/BPMediaSettings.php:45
75
msgid "No, I don't want to support BuddyPress Media"
76
msgstr ""
77
78
- #: app/helper/BPMediaSettings.php:48
79
msgid "BuddyPress Media Other Options"
80
msgstr ""
81
82
- #: app/helper/BPMediaSettings.php:49
83
msgid "Re-Count Media Entries"
84
msgstr ""
85
86
- #: app/helper/BPMediaSettings.php:52
87
msgid "It will re-count all media entries of all users and correct any discrepancies."
88
msgstr ""
89
90
- #: app/helper/BPMediaSettings.php:55
91
msgid "BuddyPress Media Addons for Audio/Video Conversion"
92
msgstr ""
93
94
- #: app/helper/BPMediaSettings.php:56
95
msgid "Submit a request form"
96
msgstr ""
97
98
- #: app/helper/BPMediaSettings.php:57
99
msgid "Request Type"
100
msgstr ""
101
102
- #: app/helper/BPMediaSettings.php:73
103
msgid "Recounting of media files done successfully"
104
msgstr ""
105
106
- #: app/helper/BPMediaSettings.php:75
107
msgid "Recounting Failed"
108
msgstr ""
109
110
- #: app/helper/BPMediaSettings.php:96
111
msgid "Please provide \"option\" value ( required ) in the argument. Pass argument to add_settings_field in the following format array( 'option' => 'option_name' ) "
112
msgstr ""
113
114
- #: app/helper/BPMediaSettings.php:126
115
- #: app/helper/BPMediaSettings.php:156
116
msgid "Please provide \"option\" value ( required ) in the argument. Pass argument to add_settings_field in the following format array( 'option' => 'option_name' )"
117
msgstr ""
118
119
- #: app/helper/BPMediaSettings.php:128
120
msgid "Need to specify atleast to radios else use a checkbox instead"
121
msgstr ""
122
123
- #: app/helper/BPMediaSettings.php:158
124
msgid "Please provide some values to populate the dropdown. Format : array( 'value' => 'option' )"
125
msgstr ""
126