rtMedia for WordPress, BuddyPress and bbPress - Version 2.11

Version Description

  • Added media editing, deleting and other actions when activity stream is disabled
  • Fixes comment posting on lightbox
Download this release

Release Info

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

Code changes from version 2.10.3 to 2.11

app/assets/css/main.css CHANGED
@@ -285,7 +285,7 @@ li #bp-media-uploaded-files{left: 0;position: absolute;top: 155px;}
285
#bp-media-premium-addons ul,#bp-media-premium-addons li{list-style:disc;margin-left:10px;}
286
.bp-media-single div.bp_media_content{text-align:center;width: auto;
287
margin: 0 auto;
288
- position: relative;}
289
.bp-media-single .bp_media_content .mejs-container{margin-left:auto;margin-right:auto;}
290
291
.bp-media-actions{margin:20px 0;}
285
#bp-media-premium-addons ul,#bp-media-premium-addons li{list-style:disc;margin-left:10px;}
286
.bp-media-single div.bp_media_content{text-align:center;width: auto;
287
margin: 0 auto;
288
+ position: relative; clear: both; }
289
.bp-media-single .bp_media_content .mejs-container{margin-left:auto;margin-right:auto;}
290
291
.bp-media-actions{margin:20px 0;}
app/assets/js/main.js CHANGED
@@ -313,7 +313,7 @@ jQuery(document).ready(function(){
313
},1000);
314
315
/* Add Featured Image */
316
- jQuery('.activity-meta').on('click','.bp-media-featured',function(e){
317
e.preventDefault();
318
var post_id = jQuery(this).attr('data-post-id');
319
var album_id = jQuery(this).attr('data-album-id');
@@ -593,11 +593,12 @@ jQuery(document).ready(function(){
593
if ( jQuery(this).hasClass( 'error' ) )
594
jQuery(this).hide();
595
});
596
597
if ( ids[1] != 'comment' ) {
598
- jQuery('#acomment-' + c_id).append( form );
599
} else {
600
- jQuery('#activity-' + a_id + ' .activity-comments').append( form );
601
}
602
603
if ( form.parent().hasClass( 'activity-comments' ) )
@@ -608,14 +609,14 @@ jQuery(document).ready(function(){
608
offset:-100,
609
easing:'easeOutQuad'
610
} );
611
- jQuery('#ac-form-' + ids[2] + ' textarea').focus();
612
613
return false;
614
}
615
616
/* Activity comment posting */
617
if ( target.attr('name') == 'ac_form_submit' ) {
618
- var form = target.parents( 'form' );
619
var form_parent = form.parent();
620
var form_id = form.attr('id').split('-');
621
@@ -626,10 +627,11 @@ jQuery(document).ready(function(){
626
var comment_id = form_id[2];
627
}
628
629
- var content = jQuery( '#' + form.attr('id') + ' textarea' );
630
631
/* Hide any error messages */
632
- jQuery( '#' + form.attr('id') + ' div.error').hide();
633
target.addClass('loading').prop('disabled', true);
634
content.addClass('loading').prop('disabled', true);
635
@@ -657,25 +659,29 @@ jQuery(document).ready(function(){
657
form.append( jQuery( response.substr( 2, response.length ) ).hide().fadeIn( 200 ) );
658
} else {
659
form.fadeOut( 200, function() {
660
if ( 0 == form.parent().children('ul').length ) {
661
if ( form.parent().hasClass('activity-comments') ) {
662
- form.parent().prepend('<ul></ul>');
663
} else {
664
- form.parent().append('<ul></ul>');
665
}
666
}
667
668
/* Preceeding whitespace breaks output with jQuery 1.9.0 */
669
var the_comment = jQuery.trim( response );
670
671
- form.parent().children('ul').append( jQuery( the_comment ).hide().fadeIn( 200 ) );
672
form.children('textarea').val('');
673
form.parent().parent().addClass('has-comments');
674
} );
675
- jQuery( '#' + form.attr('id') + ' textarea').val('');
676
677
/* Increase the "Reply (X)" button count */
678
- jQuery('#activity-' + form_id[2] + ' a.acomment-reply span').html( Number( jQuery('#activity-' + form_id[2] + ' a.acomment-reply span').html() ) + 1 );
679
}
680
681
jQuery(target).prop("disabled", false);
313
},1000);
314
315
/* Add Featured Image */
316
+ jQuery('.bp-media-image').on('click','.bp-media-featured',function(e){
317
e.preventDefault();
318
var post_id = jQuery(this).attr('data-post-id');
319
var album_id = jQuery(this).attr('data-album-id');
593
if ( jQuery(this).hasClass( 'error' ) )
594
jQuery(this).hide();
595
});
596
+
597
598
if ( ids[1] != 'comment' ) {
599
+ jQuery('.bp-media-ajax-single #acomment-' + c_id).append( form );
600
} else {
601
+ jQuery('.bp-media-ajax-single #activity-' + a_id + ' .activity-comments').append( form );
602
}
603
604
if ( form.parent().hasClass( 'activity-comments' ) )
609
offset:-100,
610
easing:'easeOutQuad'
611
} );
612
+ jQuery('.bp-media-ajax-single #ac-form-' + ids[2] + ' textarea').focus();
613
614
return false;
615
}
616
617
/* Activity comment posting */
618
if ( target.attr('name') == 'ac_form_submit' ) {
619
+ var form = target.closest( 'form' );
620
var form_parent = form.parent();
621
var form_id = form.attr('id').split('-');
622
627
var comment_id = form_id[2];
628
}
629
630
+ var content = jQuery( target.closest('.ac-reply-content').find('textarea') );
631
+ // var content = jQuery( target.closest())'#' + form.attr('id') + ' textarea' );
632
633
/* Hide any error messages */
634
+ jQuery( '.bp-media-ajax-single #' + form.attr('id') + ' div.error').hide();
635
target.addClass('loading').prop('disabled', true);
636
content.addClass('loading').prop('disabled', true);
637
659
form.append( jQuery( response.substr( 2, response.length ) ).hide().fadeIn( 200 ) );
660
} else {
661
form.fadeOut( 200, function() {
662
+ form_parent_id = jQuery('#' + form.parent().attr('id'));
663
if ( 0 == form.parent().children('ul').length ) {
664
if ( form.parent().hasClass('activity-comments') ) {
665
+ form_parent_id.prepend('<ul></ul>');
666
} else {
667
+ form_parent_id.parent().append('<ul></ul>');
668
}
669
}
670
671
/* Preceeding whitespace breaks output with jQuery 1.9.0 */
672
var the_comment = jQuery.trim( response );
673
+ //var addnl_comment = jQuery.trim( response );
674
675
+ //form.parent().children('ul').append( jQuery( the_comment ).hide().fadeIn( 200 ) );
676
+ form_parent_id.children('ul').append( jQuery( the_comment ).hide().fadeIn( 200 ) );
677
+
678
form.children('textarea').val('');
679
form.parent().parent().addClass('has-comments');
680
} );
681
+ jQuery( '.bp-media-ajax-single #' + form.attr('id') + ' textarea').val('');
682
683
/* Increase the "Reply (X)" button count */
684
+ jQuery('.bp-media-ajax-single #activity-' + form_id[2] + ' a.acomment-reply span').html( Number( jQuery('#activity-' + form_id[2] + ' a.acomment-reply span').html() ) + 1 );
685
}
686
687
jQuery(target).prop("disabled", false);
app/main/includes/BPMediaActions.php CHANGED
@@ -20,6 +20,7 @@ class BPMediaActions {
20
add_action('init', array($this, 'default_user_album'));
21
add_action('bp_init', array($this, 'default_group_album'));
22
add_action('bp_activity_entry_meta', array($this, 'action_buttons'));
23
add_action('bp_media_before_delete_media', 'BPMediaActions::delete_media_handler');
24
add_action('bp_media_after_add_album', array($this, 'album_create_activity'));
25
add_action('bp_media_after_add_album', array($this, 'update_count'), 999);
@@ -204,6 +205,8 @@ class BPMediaActions {
204
* @return boolean
205
*/
206
static function delete_activity_handler($args) {
207
remove_action('bp_media_before_delete_media', 'BPMediaActions::delete_media_handler');
208
global $bp_media_count, $wpdb;
209
if (!array_key_exists('id', $args))
@@ -245,11 +248,13 @@ class BPMediaActions {
245
*/
246
static function delete_media_handler($media_id) {
247
/* @var $media BPMediaHostWordpress */
248
- remove_action('bp_before_activity_delete', 'BPMediaActions::delete_activity_handler');
249
- $activity_id = get_post_meta($media_id, 'bp_media_child_activity', true);
250
- if ($activity_id == NULL)
251
- return false;
252
- bp_activity_delete_by_activity_id($activity_id);
253
}
254
255
/**
@@ -346,9 +351,16 @@ class BPMediaActions {
346
$action_buttons[] = '<a href="' . $bp_media_current_entry->get_edit_url()
347
. '" class="button item-button bp-secondary-action bp-media-edit" title="'
348
. __('Edit Media', 'buddypress-media') . '">' . __('Edit', 'buddypress-media') . '</a>';
349
}
350
351
$action_buttons = apply_filters('bp_media_action_buttons', $action_buttons);
352
foreach ($action_buttons as $action_button) {
353
echo $action_button;
354
}
@@ -895,6 +907,8 @@ class BPMediaActions {
895
* @param type $media_id
896
*/
897
function album_activity_sync($media_id) {
898
$album_id = wp_get_post_parent_id($media_id);
899
BPMediaFunction::update_album_activity($album_id, false, $media_id);
900
}
20
add_action('init', array($this, 'default_user_album'));
21
add_action('bp_init', array($this, 'default_group_album'));
22
add_action('bp_activity_entry_meta', array($this, 'action_buttons'));
23
+ add_action('bp_media_no_activity_entry_meta', array($this, 'action_buttons'));
24
add_action('bp_media_before_delete_media', 'BPMediaActions::delete_media_handler');
25
add_action('bp_media_after_add_album', array($this, 'album_create_activity'));
26
add_action('bp_media_after_add_album', array($this, 'update_count'), 999);
205
* @return boolean
206
*/
207
static function delete_activity_handler($args) {
208
+ if (!bp_is_active('activity'))
209
+ return;
210
remove_action('bp_media_before_delete_media', 'BPMediaActions::delete_media_handler');
211
global $bp_media_count, $wpdb;
212
if (!array_key_exists('id', $args))
248
*/
249
static function delete_media_handler($media_id) {
250
/* @var $media BPMediaHostWordpress */
251
+ if (bp_is_active('activity')) {
252
+ remove_action('bp_before_activity_delete', 'BPMediaActions::delete_activity_handler');
253
+ $activity_id = get_post_meta($media_id, 'bp_media_child_activity', true);
254
+ if ($activity_id == NULL)
255
+ return false;
256
+ bp_activity_delete_by_activity_id($activity_id);
257
+ }
258
}
259
260
/**
351
$action_buttons[] = '<a href="' . $bp_media_current_entry->get_edit_url()
352
. '" class="button item-button bp-secondary-action bp-media-edit" title="'
353
. __('Edit Media', 'buddypress-media') . '">' . __('Edit', 'buddypress-media') . '</a>';
354
+
355
+ if (!bp_is_active('activity') || !get_post_meta($bp_media_current_entry->get_id(), 'bp_media_child_activity')) {
356
+ $action_buttons[] = '<a href="' . $bp_media_current_entry->get_delete_url()
357
+ . '" class="button item-button bp-secondary-action delete-activity-single confirm" title="'
358
+ . __('Delete Media', 'buddypress-media') . '">' . __('Delete', 'buddypress-media') . '</a>';
359
+ }
360
}
361
362
$action_buttons = apply_filters('bp_media_action_buttons', $action_buttons);
363
+
364
foreach ($action_buttons as $action_button) {
365
echo $action_button;
366
}
907
* @param type $media_id
908
*/
909
function album_activity_sync($media_id) {
910
+ if (!bp_is_active('activity'))
911
+ return;
912
$album_id = wp_get_post_parent_id($media_id);
913
BPMediaFunction::update_album_activity($album_id, false, $media_id);
914
}
app/main/includes/BPMediaHostWordpress.php CHANGED
@@ -568,7 +568,7 @@ class BPMediaHostWordpress {
568
function show_comment_form() {
569
global $bp_media;
570
$activity_id = get_post_meta($this->id, 'bp_media_child_activity', true);
571
- if (!$activity_id || !function_exists('bp_has_activities'))
572
return false;
573
if (bp_has_activities(array(
574
'display_comments' => 'stream',
@@ -973,25 +973,25 @@ class BPMediaHostWordpress {
973
case 'video' :
974
$this->url = trailingslashit($pre_url . BP_MEDIA_VIDEOS_SLUG . '/' . $this->id);
975
$this->edit_url = trailingslashit($pre_url . BP_MEDIA_VIDEOS_SLUG . '/' . BP_MEDIA_VIDEOS_EDIT_SLUG . '/' . $this->id);
976
- $this->delete_url = trailingslashit($pre_url . BP_MEDIA_VIDEOS_SLUG . '/' . BP_MEDIA_DELETE_SLUG . '/' . $this->id);
977
$this->thumbnail_id = get_post_meta($this->id, 'bp_media_thumbnail', true);
978
break;
979
case 'audio' :
980
$this->url = trailingslashit($pre_url . BP_MEDIA_AUDIO_SLUG . '/' . $this->id);
981
$this->edit_url = trailingslashit($pre_url . BP_MEDIA_AUDIO_SLUG . '/' . BP_MEDIA_AUDIO_EDIT_SLUG . '/' . $this->id);
982
- $this->delete_url = trailingslashit($pre_url . BP_MEDIA_AUDIO_SLUG . '/' . BP_MEDIA_DELETE_SLUG . '/' . $this->id);
983
$this->thumbnail_id = get_post_meta($this->id, 'bp_media_thumbnail', true);
984
break;
985
case 'image' :
986
$this->url = trailingslashit($pre_url . BP_MEDIA_IMAGES_SLUG . '/' . $this->id);
987
$this->edit_url = trailingslashit($pre_url . BP_MEDIA_IMAGES_SLUG . '/' . BP_MEDIA_IMAGES_EDIT_SLUG . '/' . $this->id);
988
- $this->delete_url = trailingslashit($pre_url . BP_MEDIA_IMAGES_SLUG . '/' . BP_MEDIA_DELETE_SLUG . '/' . $this->id);
989
$this->thumbnail_id = $this->id;
990
break;
991
case 'album' :
992
$this->url = trailingslashit($pre_url . BP_MEDIA_ALBUMS_SLUG . '/' . $this->id);
993
$this->edit_url = trailingslashit($pre_url . BP_MEDIA_ALBUMS_SLUG . '/' . BP_MEDIA_ALBUMS_EDIT_SLUG . '/' . $this->id);
994
- $this->delete_url = trailingslashit($pre_url . BP_MEDIA_ALBUMS_SLUG . '/' . BP_MEDIA_DELETE_SLUG . '/' . $this->id);
995
// $this->thumbnail_id = get_post_meta($this->id, 'bp_media_thumbnail', true);
996
break;
997
default :
568
function show_comment_form() {
569
global $bp_media;
570
$activity_id = get_post_meta($this->id, 'bp_media_child_activity', true);
571
+ if (!$activity_id || !function_exists('bp_has_activities'))
572
return false;
573
if (bp_has_activities(array(
574
'display_comments' => 'stream',
973
case 'video' :
974
$this->url = trailingslashit($pre_url . BP_MEDIA_VIDEOS_SLUG . '/' . $this->id);
975
$this->edit_url = trailingslashit($pre_url . BP_MEDIA_VIDEOS_SLUG . '/' . BP_MEDIA_VIDEOS_EDIT_SLUG . '/' . $this->id);
976
+ $this->delete_url = wp_nonce_url(trailingslashit($pre_url . BP_MEDIA_VIDEOS_SLUG . '/' . BP_MEDIA_DELETE_SLUG . '/' . $this->id),'bp-media-delete-'.$this->id);
977
$this->thumbnail_id = get_post_meta($this->id, 'bp_media_thumbnail', true);
978
break;
979
case 'audio' :
980
$this->url = trailingslashit($pre_url . BP_MEDIA_AUDIO_SLUG . '/' . $this->id);
981
$this->edit_url = trailingslashit($pre_url . BP_MEDIA_AUDIO_SLUG . '/' . BP_MEDIA_AUDIO_EDIT_SLUG . '/' . $this->id);
982
+ $this->delete_url = wp_nonce_url(trailingslashit($pre_url . BP_MEDIA_AUDIO_SLUG . '/' . BP_MEDIA_DELETE_SLUG . '/' . $this->id),'bp-media-delete-'.$this->id);
983
$this->thumbnail_id = get_post_meta($this->id, 'bp_media_thumbnail', true);
984
break;
985
case 'image' :
986
$this->url = trailingslashit($pre_url . BP_MEDIA_IMAGES_SLUG . '/' . $this->id);
987
$this->edit_url = trailingslashit($pre_url . BP_MEDIA_IMAGES_SLUG . '/' . BP_MEDIA_IMAGES_EDIT_SLUG . '/' . $this->id);
988
+ $this->delete_url = wp_nonce_url(trailingslashit($pre_url . BP_MEDIA_IMAGES_SLUG . '/' . BP_MEDIA_DELETE_SLUG . '/' . $this->id),'bp-media-delete-'.$this->id);
989
$this->thumbnail_id = $this->id;
990
break;
991
case 'album' :
992
$this->url = trailingslashit($pre_url . BP_MEDIA_ALBUMS_SLUG . '/' . $this->id);
993
$this->edit_url = trailingslashit($pre_url . BP_MEDIA_ALBUMS_SLUG . '/' . BP_MEDIA_ALBUMS_EDIT_SLUG . '/' . $this->id);
994
+ $this->delete_url = wp_nonce_url(trailingslashit($pre_url . BP_MEDIA_ALBUMS_SLUG . '/' . BP_MEDIA_DELETE_SLUG . '/' . $this->id),'bp-media-delete-'.$this->id);
995
// $this->thumbnail_id = get_post_meta($this->id, 'bp_media_thumbnail', true);
996
break;
997
default :
app/main/profile/BPMediaAlbum.php CHANGED
@@ -104,11 +104,11 @@ class BPMediaAlbum {
104
$group_url = bp_get_group_permalink($current_group);
105
$this->url = trailingslashit($group_url . BP_MEDIA_ALBUMS_SLUG . '/' . $this->id);
106
$this->edit_url = trailingslashit($group_url . BP_MEDIA_ALBUMS_SLUG . '/' . BP_MEDIA_ALBUMS_EDIT_SLUG . '/' . $this->id);
107
- $this->delete_url = trailingslashit($group_url . BP_MEDIA_ALBUMS_SLUG . '/' . BP_MEDIA_DELETE_SLUG . '/' . $this->id);
108
} else {
109
$this->url = trailingslashit(bp_core_get_user_domain($this->owner) . BP_MEDIA_ALBUMS_SLUG . '/' . $this->id);
110
$this->edit_url = trailingslashit(bp_core_get_user_domain($this->owner) . BP_MEDIA_ALBUMS_SLUG . '/' . BP_MEDIA_ALBUMS_EDIT_SLUG . '/' . $this->id);
111
- $this->delete_url = trailingslashit(bp_core_get_user_domain($this->owner) . BP_MEDIA_ALBUMS_SLUG . '/' . BP_MEDIA_DELETE_SLUG . '/' . $this->id);
112
}
113
$attachments = get_children(array(
114
'numberposts' => 1,
104
$group_url = bp_get_group_permalink($current_group);
105
$this->url = trailingslashit($group_url . BP_MEDIA_ALBUMS_SLUG . '/' . $this->id);
106
$this->edit_url = trailingslashit($group_url . BP_MEDIA_ALBUMS_SLUG . '/' . BP_MEDIA_ALBUMS_EDIT_SLUG . '/' . $this->id);
107
+ $this->delete_url = wp_nonce_url(trailingslashit($group_url . BP_MEDIA_ALBUMS_SLUG . '/' . BP_MEDIA_DELETE_SLUG . '/' . $this->id),'bp-media-delete-'.$this->id);
108
} else {
109
$this->url = trailingslashit(bp_core_get_user_domain($this->owner) . BP_MEDIA_ALBUMS_SLUG . '/' . $this->id);
110
$this->edit_url = trailingslashit(bp_core_get_user_domain($this->owner) . BP_MEDIA_ALBUMS_SLUG . '/' . BP_MEDIA_ALBUMS_EDIT_SLUG . '/' . $this->id);
111
+ $this->delete_url = wp_nonce_url(trailingslashit(bp_core_get_user_domain($this->owner) . BP_MEDIA_ALBUMS_SLUG . '/' . BP_MEDIA_DELETE_SLUG . '/' . $this->id),'bp-media-delete-'.$this->id);
112
}
113
$attachments = get_children(array(
114
'numberposts' => 1,
app/main/profile/BPMediaScreen.php CHANGED
@@ -95,14 +95,14 @@ class BPMediaScreen {
95
}
96
97
public function hook_before() {
98
- global $bp;
99
do_action('bp_media_before_content');
100
- do_action('bp_media_before_' . $this->slug,$bp->action_variables[1]);
101
}
102
103
public function hook_after() {
104
- global $bp;
105
- do_action('bp_media_after_' . $this->slug,$bp->action_variables[1]);
106
do_action('bp_media_after_content');
107
}
108
@@ -134,7 +134,6 @@ class BPMediaScreen {
134
$entryslug = 'BP_MEDIA_' . $this->media_const . '_VIEW_SLUG';
135
136
global $bp;
137
-
138
remove_filter('bp_activity_get_user_join_filter', 'BPMediaFilters::activity_query_filter', 10);
139
if (isset($bp->action_variables[0])) {
140
switch ($bp->action_variables[0]) {
@@ -263,7 +262,20 @@ class BPMediaScreen {
263
echo '</h2>';
264
echo '<p>' . nl2br($bp_media_current_entry->get_description()) . '</p>';
265
echo '</div>';
266
- echo $bp_media_current_entry->show_comment_form();
267
echo '</div>';
268
echo '</div>';
269
$this->hook_after();
@@ -361,7 +373,7 @@ class BPMediaScreen {
361
* @global BPMediaHostWordpress $bp_media_current_entry
362
*/
363
function entry_delete() {
364
- global $bp;
365
if (bp_loggedin_user_id() != bp_displayed_user_id()) {
366
bp_core_no_access(array(
367
'message' => __('You do not have access to this page.', 'buddypress-media'),
@@ -387,11 +399,30 @@ class BPMediaScreen {
387
exit;
388
}
389
$post_id = $bp_media_current_entry->get_id();
390
- if (bp_is_active('activity')) {
391
- $activity_id = get_post_meta($post_id, 'bp_media_child_activity', true);
392
bp_activity_delete_by_activity_id($activity_id);
393
}
394
- $bp_media_current_entry->delete_media();
395
396
@setcookie('bp-message', __('Media deleted successfully', 'buddypress-media'), time() + 60 * 60 * 24, COOKIEPATH);
397
@setcookie('bp-message-type', 'success', time() + 60 * 60 * 24, COOKIEPATH);
95
}
96
97
public function hook_before() {
98
+ global $bp;
99
do_action('bp_media_before_content');
100
+ do_action('bp_media_before_' . $this->slug, $bp->action_variables[1]);
101
}
102
103
public function hook_after() {
104
+ global $bp;
105
+ do_action('bp_media_after_' . $this->slug, $bp->action_variables[1]);
106
do_action('bp_media_after_content');
107
}
108
134
$entryslug = 'BP_MEDIA_' . $this->media_const . '_VIEW_SLUG';
135
136
global $bp;
137
remove_filter('bp_activity_get_user_join_filter', 'BPMediaFilters::activity_query_filter', 10);
138
if (isset($bp->action_variables[0])) {
139
switch ($bp->action_variables[0]) {
262
echo '</h2>';
263
echo '<p>' . nl2br($bp_media_current_entry->get_description()) . '</p>';
264
echo '</div>';
265
+ if (!bp_is_active('activity') || !get_post_meta($bp_media_current_entry->get_id(), 'bp_media_child_activity')) {
266
+ echo '<div class="activity">';
267
+ echo '<ul id="activity-stream" class="activity-list item-list">';
268
+ echo '<li class="activity activity_update">';
269
+ echo '<div class="activity-content">';
270
+ echo '<div class="activity-meta no-ajax">';
271
+ do_action('bp_media_no_activity_entry_meta');
272
+ echo '</div>';
273
+ echo '</li>';
274
+ echo '</ul>';
275
+ echo '</div>';
276
+ } else {
277
+ echo $bp_media_current_entry->show_comment_form();
278
+ }
279
echo '</div>';
280
echo '</div>';
281
$this->hook_after();
373
* @global BPMediaHostWordpress $bp_media_current_entry
374
*/
375
function entry_delete() {
376
+ global $bp,$wpdb;
377
if (bp_loggedin_user_id() != bp_displayed_user_id()) {
378
bp_core_no_access(array(
379
'message' => __('You do not have access to this page.', 'buddypress-media'),
399
exit;
400
}
401
$post_id = $bp_media_current_entry->get_id();
402
+
403
+ if (!isset($_GET['_wpnonce'])|| ($_GET['_wpnonce']!= wp_create_nonce('bp-media-delete-'.$post_id))) {
404
+ @setcookie('bp-message', __('Something went wrong', 'buddypress-media'), time() + 60 * 60 * 24, COOKIEPATH);
405
+ @setcookie('bp-message-type', 'error', time() + 60 * 60 * 24, COOKIEPATH);
406
+ $this->template->redirect($this->media_const);
407
+ exit;
408
+ }
409
+
410
+ $activity_id = get_post_meta($post_id, 'bp_media_child_activity', true);
411
+
412
+ if (bp_is_active('activity')&&$activity_id) {
413
bp_activity_delete_by_activity_id($activity_id);
414
+ } elseif($activity_id) {
415
+ $wpdb->query( $wpdb->prepare("DELETE FROM {$wpdb->prefix}bp_activity
416
+ WHERE id = %d",
417
+ $activity_id ));
418
+ }
419
+
420
+ if ( 'album' == $bp_media_current_entry->get_type()){
421
+ $delete_handler = new BPMediaAlbum($post_id);
422
+ $delete_handler->delete_album();
423
+ } else {
424
+ $bp_media_current_entry->delete_media();
425
}
426
427
@setcookie('bp-message', __('Media deleted successfully', 'buddypress-media'), time() + 60 * 60 * 24, COOKIEPATH);
428
@setcookie('bp-message-type', 'success', time() + 60 * 60 * 24, COOKIEPATH);
index.php CHANGED
@@ -3,7 +3,7 @@
3
Plugin Name: BuddyPress Media
4
Plugin URI: http://rtcamp.com/buddypress-media/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
5
Description: This plugin adds missing media rich features like photos, videos and audio uploading to BuddyPress which are essential if you are building social network, seriously!
6
- Version: 2.10.3
7
Author: rtCamp
8
Text Domain: buddypress-media
9
Author URI: http://rtcamp.com/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
3
Plugin Name: BuddyPress Media
4
Plugin URI: http://rtcamp.com/buddypress-media/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
5
Description: This plugin adds missing media rich features like photos, videos and audio uploading to BuddyPress which are essential if you are building social network, seriously!
6
+ Version: 2.11
7
Author: rtCamp
8
Text Domain: buddypress-media
9
Author URI: http://rtcamp.com/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
readme.txt CHANGED
@@ -6,7 +6,7 @@ License: GPLv2 or later
6
License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
Requires at least: WordPress 3.5 + BuddyPress 1.6
8
Tested up to: WordPress 3.5 + BuddyPress 1.7
9
- Stable tag: 2.10.3
10
11
Adds Photos, Music, Videos & Albums to BuddyPress. Supports mobile devices (iPhone/iPad, etc) and automatic audio/video conversion.
12
@@ -119,6 +119,10 @@ Please visit [BuddyPress Media's Features page](http://rtcamp.com/buddypress-med
119
120
Please visit [BuddyPress Media's Roadmap page](http://rtcamp.com/buddypress-media/roadmap/?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media "Visit BuddyPress Media's Features page") to get some details about future releases.
121
122
= 2.10.3 =
123
* Removes lightbox from mobile devices
124
* Fixes a few bugs related to notifications
@@ -382,5 +386,5 @@ Please visit [BuddyPress Media's Roadmap page](http://rtcamp.com/buddypress-medi
382
* HTML5 Video Tag Support (with fallback)
383
384
== Upgrade Notice ==
385
- = 2.10.3 =
386
- Removes lightbox automatically on mobile devices. Bug fixes.
6
License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
Requires at least: WordPress 3.5 + BuddyPress 1.6
8
Tested up to: WordPress 3.5 + BuddyPress 1.7
9
+ Stable tag: 2.11
10
11
Adds Photos, Music, Videos & Albums to BuddyPress. Supports mobile devices (iPhone/iPad, etc) and automatic audio/video conversion.
12
119
120
Please visit [BuddyPress Media's Roadmap page](http://rtcamp.com/buddypress-media/roadmap/?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media "Visit BuddyPress Media's Features page") to get some details about future releases.
121
122
+ = 2.11 =
123
+ * Added media editing, deleting and other actions when activity stream is disabled
124
+ * Fixes comment posting on lightbox
125
+
126
= 2.10.3 =
127
* Removes lightbox from mobile devices
128
* Fixes a few bugs related to notifications
386
* HTML5 Video Tag Support (with fallback)
387
388
== Upgrade Notice ==
389
+ = 2.11 =
390
+ Added media editing, deleting and other actions when activity stream is disabled