rtMedia for WordPress, BuddyPress and bbPress - Version 2.7.1

Version Description

  • Fixes bug related to group ids.
  • Fixes bug with stylesheet loading
  • Adds ajax loader to lightbox
  • Revamped uploader UI
Download this release

Release Info

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

Code changes from version 2.7 to 2.7.1

app/assets/css/main.css CHANGED
@@ -1,6 +1,142 @@
1
  /*
2
  * Default stylesheet for BuddyPress Media
3
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  .bp_media_content img{max-width:100%;}
5
  .bp_media_content .mejs-poster img{max-width: 100%;}
6
  .media.albums .album-edit{display:inline;}
@@ -26,14 +162,17 @@ ul.bp-media-gallery li span img{height: 150px;}
26
  #bp-media-activity-upload-ui { width: 50%;}
27
  .bp-media-area-allocate{height: 10px;width: 100%;display: block;}
28
  li #bp-media-upload-ui {padding: 0;max-width: 158px;position: relative;}
29
- #bp-media-upload-ui #drag-drop-area{border: 4px dashed #DDD;text-align: center;background: url('../img/drag-drop-bg.png') repeat scroll 0 0 transparent;overflow: hidden;padding: 15px 0;}
 
 
30
  li #bp-media-upload-ui #drag-drop-area{max-width: 150px;min-height: auto;}
31
  /*.albums li #bp-media-upload-ui #drag-drop-area{padding: 20px 0 10px;}*/
32
  #bp-media-upload-ui .drag-drop-inside{float: left;width: 48%;}
33
  .albums #bp-media-upload-ui .drag-drop-inside{float: none;width: auto;}
34
  li #bp-media-upload-ui .drag-drop-inside,li #bp-media-upload-ui #bp-media-album-prompt{float: none;max-width: 100%;width: auto;}
35
  li #bp-media-upload-ui #bp-media-album-prompt{margin: 8px auto 0;max-width: 144px;}
36
- #bp-media-upload-ui #bp-media-album-prompt{float: right;margin: 12px auto 0;width: 47%;}
 
37
  #bp-media-upload-ui .drag-drop-inside p.drag-drop-info{font-size: 20px;line-height: 100%;}
38
  #bp-media-upload-ui .drag-drop-buttons input,#bp-media-album-prompt input.button{-moz-box-sizing: content-box;border-color: #BBBBBB;border-radius: 15px;border-style: solid;border-width: 1px;color: #464646;cursor: pointer;font-size: 13px !important;line-height: 13px;padding: 5px 10px;text-decoration: none;}
39
  li #bp-media-album-prompt input.button{font-size: 12px !important;padding: 3px 8px;text-decoration: none;margin-top: 5px;}
@@ -42,14 +181,14 @@ li #bp-media-album-prompt > p,li #bp-media-upload-ui #drag-drop-area p{display:
42
  .albums li #bp-media-album-prompt > p,.albums li #bp-media-upload-ui #drag-drop-area p{display: block;}
43
  li #bp-media-upload-ui #drag-drop-area p.drag-drop-buttons{display: block;}
44
  #bp-media-album-prompt div.hide{display: none;margin: 0;}
45
- #bp-media-album-prompt > p{font-size: 20px;}
 
46
  /*#bp-media-upload-ui .drag-drop-inside p,#bp-media-album-prompt #bp_media_album_new{font-size: 14px;margin: 0;}*/
47
  #bp-media-album-prompt #bp_media_album_new{max-width: 90%;}
48
  li #bp-media-album-prompt #bp_media_album_new{margin: 0;max-width: 134px;width: 94%;}
49
  #bp-media-upload-ui .drag-drop-to{width: 22px;line-height: 22px;margin: 40px auto 0;float: left;}
50
  li #bp-media-upload-ui .drag-drop-to{width: 100%;line-height: 22px;margin: 0;float: none;}
51
- #bp-media-album-in, .albums #bp-media-album-or{background-color: #333333;border-radius: 11px 11px 11px 11px;color: #FFFFFF;display: block;float: left;font-size: 14px;line-height: 22px;margin: 30px auto;width: 22px;}
52
- .albums #bp-media-album-or{float: none;margin: 20px auto;font-size: 14px;}
53
  .upload #bp-media-album-or{font-size: 14px;}
54
  li #bp-media-album-in, .albums li #bp-media-album-or{float: none;margin: 20px auto;}
55
  #bp-media-album-prompt #create-new{background-color: #DF562C;color: #fff;}
@@ -115,6 +254,14 @@ ul#activity-stream li.media.album_updated ul li,ul.bp-media-list-media li{float:
115
  .bp-media-ajax-single{
116
  padding:0;
117
  }
 
 
 
 
 
 
 
 
118
  .simplemodal-container .simplemodal-close{
119
  background: url("../img/bp-media-modal.png") right bottom no-repeat;
120
  width:22px;
1
  /*
2
  * Default stylesheet for BuddyPress Media
3
  */
4
+ #wpbody-content div.metabox-fixed{width: 280px;margin-right: -300px;float: right;}
5
+ #wpbody-content div.wrap.bp-media-admin .columns-2{margin-right:300px;padding-top: 0;margin-top: 15px;width: 600px}
6
+ #wpbody-content .bp-media-settings-tabs{margin-bottom: 0; }
7
+ #wpbody-content .bp-media-settings-tabs .media-nav-tab{margin: 0 10px; text-decoration: underline; text-transform: capitalize}
8
+ #wpbody-content .bp-media-settings-tabs .media-nav-tab.media-nav-tab-active{font-weight: bold}
9
+
10
+ #wpbody-content .wrap div.bp-media-metabox-holder{padding-top: 0}
11
+ .bp-media-social{background: url('../img/bp_media_social.png');height: 35px;width: 35px;display: inline-block;font-size: 0px;margin-right:5px;}
12
+ .bp-media-facebook{background-position: 0px 0px;}
13
+ .bp-media-facebook:hover{background-position: 0px 36px;}
14
+ .bp-media-twitter{background-position: 80px 0px;}
15
+ .bp-media-twitter:hover{background-position: 80px 36px;}
16
+ .bp-media-rss{background-position: 35px 0px;}
17
+ .bp-media-rss:hover{background-position: 35px 36px;}
18
+ .bp-media-support .support_list{ margin-left: 25px}
19
+ .bp-media-support .support_list li{list-style: disc;margin-bottom: 10px}
20
+
21
+ #adminmenu li.toplevel_page_bp-media-settings .wp-menu-image a{background:url('../img/bpm-icon-16.png') center 1px no-repeat;}
22
+ #adminmenu li.toplevel_page_bp-media-settings:hover .wp-menu-image a,
23
+ #adminmenu li.current.toplevel_page_bp-media-settings .wp-menu-image a{background-position: center 1px;}
24
+ #adminmenu li.toplevel_page_bp-media-settings .wp-menu-image a img{display:none;}
25
+ #bp-media-settings-boxes{border:1px solid #CCC; overflow: hidden; padding: 10px; -webkit-border-bottom-left-radius:3px;border-bottom-left-radius:3px;-webkit-border-top-right-radius:3px;border-top-right-radius:3px;-webkit-border-bottom-right-radius:3px;border-bottom-right-radius:3px; float: left; width: 98%;}
26
+ #debug-info{border:1px solid #CCC; overflow: hidden; padding: 10px; margin-top: 10px; -webkit-border-bottom-left-radius:3px;border-bottom-left-radius:3px;-webkit-border-top-right-radius:3px;border-top-right-radius:3px;-webkit-border-bottom-right-radius:3px;border-bottom-right-radius:3px; float: left; width: 588px;}
27
+ .nav-tab-wrapper a#bp-media{background:url('../img/bpm-icon-32.png') transparent no-repeat; padding-left:32px;}
28
+ .nav-tab-wrapper a#bp-media:hover,.nav-tab-wrapper a#bp-media.nav-tab-active{background-position:left -96px;}
29
+ .metabox-holder .postbox#latest-news .inside ul li{background: transparent url('../img/bpm-icon-32.png') -5px 0px no-repeat; padding-left: 32px;}
30
+ .metabox-holder .postbox#latest-news .inside ul li:hover{background-position-y: -96px;}
31
+ #branding #logo{text-align:center;padding: 10px 0;display:block;}
32
+ ul#social{display:block;text-align:center;margin:0;clear: both;}
33
+ #branding #mc-embedded-subscribe-form{float: left;width: 100%;}
34
+ #branding label{float: right;}
35
+ #branding #mc-embedded-subscribe{float: right;padding: 0 3px;}
36
+ #branding #mce-EMAIL{float: left;}
37
+ ul#social li{display:inline;}
38
+ #spread-the-word .button{display:inline-block; margin: 9px 5px 0 5px;}
39
+ #spread-the-word label{display:block;}
40
+ #spread-the-word .inside{text-align: center;}
41
+ #spread-the-word .button-tweet{background: #33ACE6; border-color: #3399DD #3399DD #2288CC; color: #FFFFFF !important; text-shadow: -1px -1px 0 #3399DD;}
42
+ #spread-the-word .button-tweet:hover{background: #3399DD;border-color: #2288CC;box-shadow: 0 0 4px rgba(82, 168, 236, 0.75);}
43
+ #spread-the-word .button-rating{background: #8A8A8A; border-color: #222; color: #FFFFFF !important; text-shadow: -1px -1px 0 #444;}
44
+ #spread-the-word .button-rating:hover{background: #7E7E7E;border-color: #444;box-shadow: 0 0 4px rgba(128,128,128, 0.75);}
45
+ .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab{padding-left:20px;background:url('../img/tab-icon.png') 3px -4px no-repeat;}
46
+ .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab.addons{background-position-y:-34px;}
47
+ .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab.support{background-position-y:-64px;}
48
+ .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab.update-database{background-position-y:-94px;}
49
+ .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab.ffmpeg{background-position-y:-154px;}
50
+ .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab.kaltura{background-position-y:-184px;}
51
+ .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab.convert-videos{background-position-y:-214px;}
52
+ .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab.insta{background-position-y:-244px;}
53
+ .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab.watermark{background-position-y:-274px;}
54
+ /* Addons page Styling */
55
+
56
+ a.toplevel_page_bp-media-settings div.wp-menu-image{
57
+ background:url('../img/admin-menu.png') 0 -32px no-repeat;
58
+ }
59
+
60
+ #rt-donate-button, .rt-link img{vertical-align: middle;}
61
+ #adminmenu .menu-icon-generic.toplevel_page_bp-media-settings div.wp-menu-image{
62
+ background-position: 0 -32px;
63
+ }
64
+ #adminmenu .menu-icon-generic.wp-has-current-submenu.toplevel_page_bp-media-settings div.wp-menu-image,
65
+ #adminmenu .menu-icon-generic.toplevel_page_bp-media-settings:hover div.wp-menu-image{
66
+ background-position-y:0;
67
+ }
68
+
69
+ #bp-media-addons-list_metabox {background: #ffffff}
70
+ .products ul:after, ul.products:after {clear: both;content: "";display: block;}
71
+ .products ul, ul.products {clear: both;list-style: none outside none;margin: 0 0 14px;padding: 0;}
72
+ .bp-media-addon {margin: 0;}
73
+ .bp-media-addon.first { }
74
+ .bp-media-addon {margin: 20px 10px 30px;padding: 5px;position: relative;border: 1px solid #ccc;}
75
+ .bp-media-addon h4 {background: none repeat scroll 0 0 transparent;border: 0 none;color: #006999;cursor: pointer;font-family: "HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",sans-serif;font-size: 20px;font-weight: normal;line-height: 26px;margin: 0 0 10px;}
76
+ .bp-media-addon a {text-decoration: none;}
77
+ .bp-media-addon a img, div.product div.images img {box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4);}
78
+ .bp-media-addon a img {display: block;height: auto;margin: 5px 15px 5px 5px;transition: all 0.2s ease-in-out 0s;float: left; width: 200px}
79
+
80
+ .bp-media-addon .price, .bp-media-addon .price .amount, .bp-media-addon .price ins {color: #85AD74;font-size: 25px;font-weight: bold;}
81
+ .bp-media-addon .price {line-height: 1.4em;color: #85AD74;display: block;font-weight: normal;margin-bottom: 0.5em;}
82
+ .coming-soon { background: url("../img/coming-soon.png"); z-index: 5; position:absolute;height:191px; opacity:0.9;}
83
+ .coming-soon.coming-soon-l { background-position: 0 0; width:250px; top:-12px; left:-18px;}
84
+ .coming-soon.coming-soon-r { background-position: 347px 0; width:174px; bottom:-14px; right:-12px;}
85
+ .coming-soon.coming-soon-r:hover{background-position: 175px 0;}
86
+
87
+ .bp-media-addon .product_footer{margin: 20px 0 0;overflow: hidden;}
88
+ .bp-media-addon .add_to_cart_button{background: #C45200; color: #FFFFFF;display: inline-block;font-size: 18px;font-weight: bold; line-height: 1.4em; margin: 0 20px; padding: 4px 15px;text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.6)}
89
+ .bp-media-addon .product_footer .product_demo_link{font-size: 16px;margin: 8px 20px; font-weight: bold}
90
+
91
+ .bp-media-addon .add_to_cart_button:hover{background: none repeat scroll 0 0 #D75A00;
92
+ box-shadow: 0 1px rgba(0, 0, 0, 0.2), 0 0 1px rgba(0, 0, 0, 0.4) inset;
93
+ color: #FFFFFF;}
94
+
95
+ /* Admin bar Menu */
96
+ #wpadminbar .bp-media-settings-menu > .ab-item .ab-icon{background: url("../img/bpm-icon-16.png") no-repeat scroll -8px -7px transparent}
97
+ #wpadminbar .bp-media-settings-menu:hover .ab-icon{background-position: -8px -41px}
98
+
99
+ /* BuddyPress media admin support form styling */
100
+ .bp-media-updated, .bp-media-error{border-radius: 3px; padding: 0 7px; margin: 5px 0 15px; border: 1px solid}
101
+ .bp-media-updated p, .bp-media-error p{margin: 0.5em 0;padding: 2px;}
102
+ .bp-media-updated{background-color: #FFFFE0;border-color: #E6DB55;}
103
+ .bp-media-error{background-color: #FFEBE8;border-color: #CC0000;}
104
+ .bp-media-form li{margin-bottom: 10px}
105
+ .bp-media-form .bp-media-label{display: inline-block;margin-right: 10px;width: 150px;vertical-align: top; }
106
+ .bp-media-form .bp-media-input{background-color: #FFFFFF;border: 1px solid #DFDFDF;border-radius: 3px 3px 3px 3px;color: #333333;line-height: 16px;padding: 5px;width: 220px;}
107
+ .bp-media-form .bp-media-checkbox{margin-right: 10px; margin-left: 160px}
108
+ .bp-media-form .bp-media-textarea{background-color: #FFFFFF;border: 1px solid #DFDFDF;border-radius: 3px 3px 3px 3px;color: #333333;height: 175px;line-height: 16px;padding: 5px;width: 400px;}
109
+ .bp-media-form .bp-media-select{margin: 0;max-width: 400px;}
110
+ .bp-media-support-attachment label{float: left}
111
+ .bp-media-support-attachment .more-attachment{margin-left: 160px; margin-top: 10px}
112
+ .bp-media-support-attachment .more-attachment:first-child{margin-top: 0px}
113
+ .bp-media-support-attachment .add-more-attachment-btn{clear: both;display: inline-block;margin-left: 160px;margin-top: 10px;}
114
+ .template_select_label{float: left}
115
+ .template_select_container{overflow-x:scroll; width:405px;float: left}
116
+ #bp_media_settings_form .support_form_laoder{height: 100px; width: 200px; background: url("../img/loader.gif") no-repeat }
117
+ /* Miscellaneous */
118
+ #normal-sortables .postbox .bp-media-form .submit{float: none; margin-left: 150px}
119
+ .rt-success{background-color: #E1FFDF;border-color: #2ACF2A;}
120
+ .rt-update{background-color: #FFEAA6;border-color:#E1CA82;}
121
+ img.bp-media-donation-image{display:block;margin: 10px auto;}
122
+ #donate form{text-align: center;}
123
+ /*Transcoding Teaser*/
124
+ .para-blockquote { background: #E5E5E5; padding: 10px; font-style: italic; }
125
+ #latest-update img, #members-list .update img, #members-list .update {display:block; overflow: hidden;}
126
+ #rtprogressbar {
127
+ background-color: #444;
128
+ border-radius: 13px;
129
+ padding: 3px;
130
+ }
131
+
132
+ #rtprogressbar div {
133
+ background-color: #fb6003;
134
+ width: 0;
135
+ height: 20px;
136
+ border-radius: 10px;
137
+ }
138
+
139
+
140
  .bp_media_content img{max-width:100%;}
141
  .bp_media_content .mejs-poster img{max-width: 100%;}
142
  .media.albums .album-edit{display:inline;}
162
  #bp-media-activity-upload-ui { width: 50%;}
163
  .bp-media-area-allocate{height: 10px;width: 100%;display: block;}
164
  li #bp-media-upload-ui {padding: 0;max-width: 158px;position: relative;}
165
+ #bp-media-upload-ui {margin-top: 10px;}
166
+ #bp-media-upload-ui #drag-drop-area{border: 4px dashed #DDD;text-align: center;background: #fafafa;overflow: hidden;padding: 15px 0;}
167
+ #bp-media-upload-ui.hover #drag-drop-area {border-color: #83b4d8;}
168
  li #bp-media-upload-ui #drag-drop-area{max-width: 150px;min-height: auto;}
169
  /*.albums li #bp-media-upload-ui #drag-drop-area{padding: 20px 0 10px;}*/
170
  #bp-media-upload-ui .drag-drop-inside{float: left;width: 48%;}
171
  .albums #bp-media-upload-ui .drag-drop-inside{float: none;width: auto;}
172
  li #bp-media-upload-ui .drag-drop-inside,li #bp-media-upload-ui #bp-media-album-prompt{float: none;max-width: 100%;width: auto;}
173
  li #bp-media-upload-ui #bp-media-album-prompt{margin: 8px auto 0;max-width: 144px;}
174
+ #bp-media-upload-ui #bp-media-album-prompt{float: left;width: 47%;}
175
+ #bp-media-upload-ui .drag-drop-info{font-size:16px;}
176
  #bp-media-upload-ui .drag-drop-inside p.drag-drop-info{font-size: 20px;line-height: 100%;}
177
  #bp-media-upload-ui .drag-drop-buttons input,#bp-media-album-prompt input.button{-moz-box-sizing: content-box;border-color: #BBBBBB;border-radius: 15px;border-style: solid;border-width: 1px;color: #464646;cursor: pointer;font-size: 13px !important;line-height: 13px;padding: 5px 10px;text-decoration: none;}
178
  li #bp-media-album-prompt input.button{font-size: 12px !important;padding: 3px 8px;text-decoration: none;margin-top: 5px;}
181
  .albums li #bp-media-album-prompt > p,.albums li #bp-media-upload-ui #drag-drop-area p{display: block;}
182
  li #bp-media-upload-ui #drag-drop-area p.drag-drop-buttons{display: block;}
183
  #bp-media-album-prompt div.hide{display: none;margin: 0;}
184
+ #bp-media-album-prompt > span{font-size: 16px;}
185
+ .bp-media-album-content { display: inline }
186
  /*#bp-media-upload-ui .drag-drop-inside p,#bp-media-album-prompt #bp_media_album_new{font-size: 14px;margin: 0;}*/
187
  #bp-media-album-prompt #bp_media_album_new{max-width: 90%;}
188
  li #bp-media-album-prompt #bp_media_album_new{margin: 0;max-width: 134px;width: 94%;}
189
  #bp-media-upload-ui .drag-drop-to{width: 22px;line-height: 22px;margin: 40px auto 0;float: left;}
190
  li #bp-media-upload-ui .drag-drop-to{width: 100%;line-height: 22px;margin: 0;float: none;}
191
+ #bp-media-album-in {background-color: #333333;border-radius: 11px 11px 11px 11px;color: #FFFFFF;display: block;float: left;font-size: 14px;line-height: 22px;width: 22px;}
 
192
  .upload #bp-media-album-or{font-size: 14px;}
193
  li #bp-media-album-in, .albums li #bp-media-album-or{float: none;margin: 20px auto;}
194
  #bp-media-album-prompt #create-new{background-color: #DF562C;color: #fff;}
254
  .bp-media-ajax-single{
255
  padding:0;
256
  }
257
+ .bp-media-ajax-single .lightbox-spinner{
258
+ height:24px;
259
+ width:24px;
260
+ background: url("../img/boxspinner.gif") center center;
261
+ left:50%;
262
+ top:50%;
263
+ position:absolute;
264
+ }
265
  .simplemodal-container .simplemodal-close{
266
  background: url("../img/bp-media-modal.png") right bottom no-repeat;
267
  width:22px;
app/assets/img/boxspinner.gif ADDED
Binary file
app/assets/js/main.js CHANGED
@@ -16,6 +16,17 @@ function bp_media_create_element(id){
16
  var $current;
17
  jQuery(document).ready(function(){
18
 
 
 
 
 
 
 
 
 
 
 
 
19
  var bp_media_recent_tabs = jQuery('.media-tabs-container-tabs');
20
  if(bp_media_recent_tabs.length>0){
21
  jQuery(bp_media_recent_tabs).tabs();
@@ -138,13 +149,15 @@ jQuery(document).ready(function(){
138
  });
139
  }
140
  function transit_media($current){
 
 
 
141
  jQuery.get($current.attr('href'),function(response){
142
  $mediacontent = jQuery(response).find('.bp-media-single');
143
  $medialoaded = jQuery('.bp-media-ajax-single');
144
  $medialoaded.empty();
145
  $medialoaded.append($mediacontent);
146
  do_fixes($medialoaded);
147
-
148
  });
149
  }
150
 
@@ -171,11 +184,13 @@ jQuery(document).ready(function(){
171
  }
172
 
173
  function adjust_dimensions($image){
174
-
175
  $height = ($image.height()>480)?$image.height():480;
176
  $width = ($image.width()>640)?$image.width():640;
177
  $width = $width +280;
 
 
178
  return [$height,$width];
 
179
  }
180
 
181
  function adjust_comment_div($height){
16
  var $current;
17
  jQuery(document).ready(function(){
18
 
19
+ jQuery('#item-body').on('click','#bp-media-upload-button', function(){
20
+ jQuery(this).next().slideToggle();
21
+ });
22
+
23
+ jQuery('#bp-media-upload-ui').bind('dragover', function(e){
24
+ jQuery(this).addClass('hover');return 0;
25
+ });
26
+ jQuery('#bp-media-upload-ui').bind('dragleave', function(e){
27
+ jQuery(this).removeClass('hover');return 0;
28
+ });
29
+
30
  var bp_media_recent_tabs = jQuery('.media-tabs-container-tabs');
31
  if(bp_media_recent_tabs.length>0){
32
  jQuery(bp_media_recent_tabs).tabs();
149
  });
150
  }
151
  function transit_media($current){
152
+ $medialoaded = jQuery('.bp-media-ajax-single');
153
+ $medialoaded.empty();
154
+ $medialoaded.append( jQuery('<div class="lightbox-spinner" />'));
155
  jQuery.get($current.attr('href'),function(response){
156
  $mediacontent = jQuery(response).find('.bp-media-single');
157
  $medialoaded = jQuery('.bp-media-ajax-single');
158
  $medialoaded.empty();
159
  $medialoaded.append($mediacontent);
160
  do_fixes($medialoaded);
 
161
  });
162
  }
163
 
184
  }
185
 
186
  function adjust_dimensions($image){
 
187
  $height = ($image.height()>480)?$image.height():480;
188
  $width = ($image.width()>640)?$image.width():640;
189
  $width = $width +280;
190
+ $image.hide();
191
+ $image.show();
192
  return [$height,$width];
193
+
194
  }
195
 
196
  function adjust_comment_div($height){
app/helper/BPMediaSettings.php CHANGED
@@ -39,12 +39,12 @@ if (!class_exists('BPMediaSettings')) {
39
  add_settings_field('bpm-video', __('Video', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-settings', array(
40
  'setting' => 'bp_media_options',
41
  'option' => 'videos_enabled',
42
- 'desc' => __('Enable Video', BP_MEDIA_TXT_DOMAIN)
43
  ));
44
  add_settings_field('bpm-audio', __('Audio', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-settings', array(
45
  'setting' => 'bp_media_options',
46
  'option' => 'audio_enabled',
47
- 'desc' => __('Enable Audio', BP_MEDIA_TXT_DOMAIN)
48
  ));
49
  if (bp_is_active('activity')) {
50
  add_settings_section('bpm-activity-upload', __('Activity Upload', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-settings');
39
  add_settings_field('bpm-video', __('Video', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-settings', array(
40
  'setting' => 'bp_media_options',
41
  'option' => 'videos_enabled',
42
+ 'desc' => __('Enable Video (mp4)', BP_MEDIA_TXT_DOMAIN)
43
  ));
44
  add_settings_field('bpm-audio', __('Audio', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-settings', array(
45
  'setting' => 'bp_media_options',
46
  'option' => 'audio_enabled',
47
+ 'desc' => __('Enable Audio (mp3)', BP_MEDIA_TXT_DOMAIN)
48
  ));
49
  if (bp_is_active('activity')) {
50
  add_settings_section('bpm-activity-upload', __('Activity Upload', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-settings');
app/main/activity/BPMediaActivity.php CHANGED
@@ -4,168 +4,171 @@
4
  *
5
  * @author Joshua Abenazer <joshua.abenazer@rtcamp.com>
6
  */
7
- if (!class_exists('BPMediaActivity')) {
8
-
9
- class BPMediaActivity {
10
-
11
- var $default_album_id;
12
- var $attachment_id = 0;
13
- var $content = '';
14
- var $media_count = 1;
15
-
16
- public function __construct() {
17
- global $bp_media;
18
- $options = $bp_media->options;
19
- if (isset($options['activity_upload']) && $options['activity_upload'] != 0) {
20
- add_action('bp_activity_post_form_options', array($this, 'activity_uploader'));
21
- add_action('bp_groups_posted_update', array($this, 'override_media_album_id'), '', 4);
22
- add_filter('bp_activity_new_update_content', array($this, 'override_update'));
23
- add_filter('bp_activity_latest_update_content', array($this, 'override_update'));
24
- add_filter('bp_get_member_latest_update', array($this, 'latest_update'));
25
- add_filter('bp_get_activity_latest_update', array($this, 'latest_update'));
26
- add_action('wp_ajax_bp_media_get_latest_activity', array($this, 'latest_update'));
27
- add_filter('groups_activity_new_update_content', array($this, 'override_update'));
28
-
29
- add_filter('bp_activity_allowed_tags', 'BPMediaFunction::override_allowed_tags', 1);
30
- add_action('init', array($this, 'scripts'));
31
- //remove_filter( 'bp_get_activity_content_body', 'wptexturize' );
32
- remove_filter('bp_get_activity_content', 'wptexturize');
33
- }
34
- }
35
-
36
- public function scripts() {
37
- wp_enqueue_script('json2');
38
- wp_enqueue_script('bp-media-activity-uploader', BP_MEDIA_URL . 'app/assets/js/bp-media-activity-uploader.js', array('plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4', 'plupload-handlers'), BP_MEDIA_VERSION);
39
- }
40
-
41
- public function activity_uploader() {
42
- ?>
43
- <input type ="hidden" id="bp-media-update-text" />
44
- <input type ="hidden" id="bp-media-update-json" />
45
- <input type ="hidden" id="bp-media-latest-update" />
46
- <div id="bp-media-activity-upload-ui" class="hide-if-no-js drag-drop">
47
- <input id="bp-media-activity-upload-browse-button" type="button" value="<?php _e('Attach Media', BP_MEDIA_TXT_DOMAIN); ?>" class="button" />
48
- <div id="bp-media-activity-uploaded-files"></div>
49
- </div>
50
- <?php
51
- }
52
-
53
- public function decode($content) {
54
- $content = stripslashes($content);
55
- $activity_json = json_decode($content, true);
56
- return $activity_json;
57
- }
58
-
59
- public function get_media($content) {
60
- $activity_json = $this->decode($content);
61
- $activity_media = json_decode($activity_json['media'], true);
62
- return $activity_media;
63
- }
64
-
65
- public function get_text($content) {
66
- $activity_json = $this->decode($content);
67
- $activity_text = $activity_json['update_txt'];
68
- return $activity_text;
69
- }
70
-
71
- public function latest_update($content) {
72
- global $bp;
73
- if( isset($_GET['content'] ) ) {
74
- $update_id = $_GET['id'];
75
- $content = $_GET['content'];
76
- }else{
77
- if ( bp_displayed_user_id() )
78
- $user_id = bp_displayed_user_id();
79
- else
80
- $user_id = bp_get_member_user_id();
81
- if (!$update = bp_get_user_meta($user_id, 'bp_latest_update', true))
82
- return $content;
83
- $update_id = $update['id'];
84
- $content = $update['content'];
85
- }
86
- //$activity_id = $update[''];
87
- $activity_media = $this->get_media($content);
88
- $newcontent = $this->get_text($content);
89
- if (isset($activity_media)) {
90
- if (!is_array($activity_media)) {
91
- $activity_media[] = $activity_media;
92
- }
93
- $media_id = $activity_media[count($activity_media) - 1];
94
- try{
95
- $media = new BPMediaHostWordpress($media_id);
96
  $newcontent .= '<a href="' . $media->get_url() . '">
97
  <img src="' . $media->get_media_thumbnail() . '"/>
98
  </a>';
99
- }catch (Exception $e) {
100
  echo $e->getMessage();
101
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
 
103
- }
104
-
105
- $newcontent .= ' <a href="' . bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/p/' . $update_id . '/"> ' . __('View', 'buddypress') . '</a>';
106
- if (isset($_GET['content'])) {
107
- echo $newcontent;
108
- die;
109
- } else {
110
- return $newcontent;
111
- }
112
- }
113
-
114
- public function override_update($content) {
115
- $this->content = $content;
116
- $activity_media = $this->get_media($content);
117
- $newcontent = '<p>' . $this->get_text($content) . '</p>';
118
- if (isset($activity_media)) {
119
- if (!is_array($activity_media)) {
120
- $activity_media[] = $activity_media;
121
- }
122
-
123
- if (count($activity_media) > 1) {
124
- $newcontent .= '<ul class="bp-media-list-media">';
125
- }
126
-
127
- foreach ($activity_media as $media_id) {
128
- $media = new BPMediaHostWordpress($media_id);
129
- if (count($activity_media) > 1) {
130
- $newcontent .= $media->get_album_activity_content();
131
- } else {
132
- add_filter('bp_media_single_activity_title', create_function('', 'return;'));
133
- $newcontent .= $media->get_media_activity_content();
134
- }
135
- }
136
- if (count($activity_media) > 1) {
137
- $newcontent .= '</ul>';
138
- }
139
- }
140
- return $newcontent;
141
- }
142
-
143
- public function override_media_album_id($content, $user_id, $group_id, $activity_id) {
144
- global $bp;
145
- $activity_media = $this->get_media($content);
146
- if (isset($activity_media)) {
147
- if (!is_array($activity_media)) {
148
- $activity_media[] = $activity_media;
149
- }
150
-
151
- foreach ($activity_media as $media_id) {
152
- update_post_meta($media_id, 'bp-media-key', -$group_id);
153
- $attachment = get_post($media_id);
154
- $attachment->post_parent = groups_get_groupmeta($group_id, 'bp_media_default_album');
155
- wp_update_post($attachment);
156
- $activity_id = groups_record_activity(array(
157
- 'id' => $activity_id,
158
- 'user_id' => $user_id,
159
- 'action' => sprintf(__('%1$s posted an update in the group %2$s', 'buddypress'), bp_core_get_userlink($user_id), '<a href="' . bp_get_group_permalink($bp->groups->current_group) . '">' . esc_attr($bp->groups->current_group->name) . '</a>'),
160
- 'content' => $this->override_update($this->content),
161
- 'type' => 'activity_update',
162
- 'item_id' => $group_id
163
- ));
164
- }
165
- }
166
- }
167
-
168
- }
169
 
170
  }
171
  ?>
4
  *
5
  * @author Joshua Abenazer <joshua.abenazer@rtcamp.com>
6
  */
7
+ if ( ! class_exists( 'BPMediaActivity' ) ) {
8
+
9
+ class BPMediaActivity {
10
+
11
+ var $default_album_id;
12
+ var $attachment_id = 0;
13
+ var $content = '';
14
+ var $media_count = 1;
15
+
16
+ public function __construct() {
17
+ global $bp_media;
18
+ $options = $bp_media->options;
19
+ if ( isset( $options[ 'activity_upload' ] ) && $options[ 'activity_upload' ] != 0 ) {
20
+ add_action( 'bp_activity_post_form_options', array( $this, 'activity_uploader' ) );
21
+ add_action( 'bp_groups_posted_update', array( $this, 'override_media_album_id' ), '', 4 );
22
+ add_filter( 'bp_activity_new_update_content', array( $this, 'override_update' ) );
23
+ add_filter( 'bp_activity_latest_update_content', array( $this, 'override_update' ) );
24
+ add_filter( 'bp_get_member_latest_update', array( $this, 'latest_update' ) );
25
+ add_filter( 'bp_get_activity_latest_update', array( $this, 'latest_update' ) );
26
+ add_action( 'wp_ajax_bp_media_get_latest_activity', array( $this, 'latest_update' ) );
27
+ add_filter( 'groups_activity_new_update_content', array( $this, 'override_update' ) );
28
+
29
+ add_filter( 'bp_activity_allowed_tags', 'BPMediaFunction::override_allowed_tags', 1 );
30
+ add_action( 'init', array( $this, 'scripts' ) );
31
+ //remove_filter( 'bp_get_activity_content_body', 'wptexturize' );
32
+ remove_filter( 'bp_get_activity_content', 'wptexturize' );
33
+ }
34
+ }
35
+
36
+ public function scripts() {
37
+ wp_enqueue_script( 'json2' );
38
+ wp_enqueue_script( 'bp-media-activity-uploader', BP_MEDIA_URL . 'app/assets/js/bp-media-activity-uploader.js', array( 'plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4', 'plupload-handlers' ), BP_MEDIA_VERSION );
39
+ }
40
+
41
+ public function activity_uploader() {
42
+ ?>
43
+ <input type ="hidden" id="bp-media-update-text" />
44
+ <input type ="hidden" id="bp-media-update-json" />
45
+ <input type ="hidden" id="bp-media-latest-update" />
46
+ <div id="bp-media-activity-upload-ui" class="hide-if-no-js drag-drop">
47
+ <input id="bp-media-activity-upload-browse-button" type="button" value="<?php _e( 'Attach Media', BP_MEDIA_TXT_DOMAIN ); ?>" class="button" />
48
+ <div id="bp-media-activity-uploaded-files"></div>
49
+ </div>
50
+ <?php
51
+ }
52
+
53
+ public function decode( $content ) {
54
+ $content = stripslashes( $content );
55
+ $activity_json = json_decode( $content, true );
56
+ return $activity_json;
57
+ }
58
+
59
+ public function get_media( $content ) {
60
+ $activity_json = $this->decode( $content );
61
+ $activity_media = json_decode( $activity_json[ 'media' ], true );
62
+ return $activity_media;
63
+ }
64
+
65
+ public function get_text( $content ) {
66
+ $activity_json = $this->decode( $content );
67
+ $activity_text = $activity_json[ 'update_txt' ];
68
+ return $activity_text;
69
+ }
70
+
71
+ public function latest_update( $content ) {
72
+ global $bp;
73
+ if ( isset( $_GET[ 'content' ] ) ) {
74
+ $update_id = $_GET[ 'id' ];
75
+ $content = $_GET[ 'content' ];
76
+ } else {
77
+ if ( bp_displayed_user_id() )
78
+ $user_id = bp_displayed_user_id();
79
+ else
80
+ $user_id = bp_get_member_user_id();
81
+ if ( ! $update = bp_get_user_meta( $user_id, 'bp_latest_update', true ) )
82
+ return $content;
83
+ $update_id = $update[ 'id' ];
84
+ $content = $update[ 'content' ];
85
+ }
86
+ //$activity_id = $update[''];
87
+ $activity_media = $this->get_media( $content );
88
+ $newcontent = $this->get_text( $content );
89
+ if ( isset( $activity_media ) ) {
90
+ if ( ! is_array( $activity_media ) ) {
91
+ $activity_media[ ] = $activity_media;
92
+ }
93
+ $media_id = $activity_media[ count( $activity_media ) - 1 ];
94
+ try {
95
+ $media = new BPMediaHostWordpress( $media_id );
96
  $newcontent .= '<a href="' . $media->get_url() . '">
97
  <img src="' . $media->get_media_thumbnail() . '"/>
98
  </a>';
99
+ } catch ( Exception $e ) {
100
  echo $e->getMessage();
101
  }
102
+ }
103
+
104
+ $newcontent .= ' <a href="' . bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/p/' . $update_id . '/"> ' . __( 'View', 'buddypress' ) . '</a>';
105
+ if ( isset( $_GET[ 'content' ] ) ) {
106
+ echo $newcontent;
107
+ die;
108
+ } else {
109
+ return $newcontent;
110
+ }
111
+ }
112
+
113
+ public function override_update( $content ) {
114
+ $this->content = $content;
115
+ $activity_media = $this->get_media( $content );
116
+ $newcontent = '<p>' . $this->get_text( $content ) . '</p>';
117
+ if ( isset( $activity_media ) ) {
118
+ if ( ! is_array( $activity_media ) ) {
119
+ $activity_media[ ] = $activity_media;
120
+ }
121
+
122
+ if ( count( $activity_media ) > 1 ) {
123
+ $newcontent .= '<ul class="bp-media-list-media">';
124
+ }
125
+
126
+ foreach ( $activity_media as $media_id ) {
127
+ try {
128
+ $media = new BPMediaHostWordpress( $media_id );
129
+ if ( count( $activity_media ) > 1 ) {
130
+ $newcontent .= $media->get_album_activity_content();
131
+ } else {
132
+ add_filter( 'bp_media_single_activity_title', create_function( '', 'return;' ) );
133
+ $newcontent .= $media->get_media_activity_content();
134
+ }
135
+ } catch ( Exception $e ) {
136
+ echo $e->getMessage();
137
+ }
138
+ }
139
+ if ( count( $activity_media ) > 1 ) {
140
+ $newcontent .= '</ul>';
141
+ }
142
+ }
143
+ return $newcontent;
144
+ }
145
+
146
+ public function override_media_album_id( $content, $user_id, $group_id, $activity_id ) {
147
+ global $bp;
148
+ $activity_media = $this->get_media( $content );
149
+ if ( isset( $activity_media ) ) {
150
+ if ( ! is_array( $activity_media ) ) {
151
+ $activity_media[ ] = $activity_media;
152
+ }
153
+
154
+ foreach ( $activity_media as $media_id ) {
155
+ update_post_meta( $media_id, 'bp-media-key', -$group_id );
156
+ $attachment = get_post( $media_id );
157
+ $attachment->post_parent = groups_get_groupmeta( $group_id, 'bp_media_default_album' );
158
+ wp_update_post( $attachment );
159
+ $activity_id = groups_record_activity( array(
160
+ 'id' => $activity_id,
161
+ 'user_id' => $user_id,
162
+ 'action' => sprintf( __( '%1$s posted an update in the group %2$s', 'buddypress' ), bp_core_get_userlink( $user_id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . esc_attr( $bp->groups->current_group->name ) . '</a>' ),
163
+ 'content' => $this->override_update( $this->content ),
164
+ 'type' => 'activity_update',
165
+ 'item_id' => $group_id
166
+ ) );
167
+ }
168
+ }
169
+ }
170
 
171
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
 
173
  }
174
  ?>
app/main/includes/BPMediaActions.php CHANGED
@@ -172,9 +172,6 @@ class BPMediaActions {
172
  wp_localize_script('bp-media-default', 'bp_media_vars', $bp_media_vars);
173
  wp_enqueue_style('bp-media-mecss', BP_MEDIA_URL . 'lib/media-element/mediaelementplayer.min.css', '', BP_MEDIA_VERSION);
174
  wp_enqueue_style('bp-media-default', BP_MEDIA_URL . 'app/assets/css/main.css', '', BP_MEDIA_VERSION);
175
- if (is_admin()) {
176
- wp_enqueue_style('bp-media-default', BP_MEDIA_URL . 'app/assets/css/admin.css', '', BP_MEDIA_VERSION);
177
- }
178
  }
179
 
180
  /**
@@ -460,55 +457,54 @@ class BPMediaActions {
460
  }
461
 
462
  function upload_enqueue() {
463
- if( is_user_logged_in()){
464
- if (bp_is_activity_component() || bp_is_group_home()) {
465
- $params = array(
466
- 'url' => BP_MEDIA_URL . 'app/main/includes/bp-media-upload-handler.php',
467
- 'runtimes' => 'gears,html5,flash,silverlight,browserplus',
468
- 'browse_button' => 'bp-media-activity-upload-browse-button',
469
- 'container' => 'bp-media-activity-upload-ui',
470
- 'drop_element' => 'drag-drop-area',
471
- 'filters' => apply_filters('bp_media_plupload_files_filter', array(array('title' => "Media Files", 'extensions' => "mp4,jpg,png,jpeg,gif,mp3"))),
472
- 'max_file_size' => min(array(ini_get('upload_max_filesize'), ini_get('post_max_size'))),
473
- 'multipart' => true,
474
- 'urlstream_upload' => true,
475
- 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
476
- 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
477
- 'file_data_name' => 'bp_media_file', // key passed to $_FILE.
478
- 'multi_selection' => true,
479
- 'multipart_params' => apply_filters('bp_media_multipart_params_filter', array('action' => 'wp_handle_upload'))
480
- );
481
- wp_enqueue_script('bp-media-activity-uploader', BP_MEDIA_URL . 'app/assets/js/bp-media-activity-uploader.js', array('plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4', 'plupload-handlers'), BP_MEDIA_VERSION);
482
- wp_localize_script('bp-media-activity-uploader', 'bp_media_uploader_params', $params);
483
- wp_localize_script('bp-media-activity-uploader', 'activity_ajax_url', admin_url('admin-ajax.php'));
484
- if (bp_get_current_group_id())
485
- $default_album = $this->default_group_album();
486
- else
487
- $default_album = $this->default_user_album();
488
- wp_localize_script('bp-media-activity-uploader', 'default_album', $default_album ? $default_album : 0);
489
- } elseif (in_array(bp_current_action(), array(BP_MEDIA_IMAGES_SLUG, BP_MEDIA_VIDEOS_SLUG, BP_MEDIA_AUDIO_SLUG, BP_MEDIA_SLUG, BP_MEDIA_ALBUMS_SLUG))) {
490
- $params = array(
491
- 'url' => BP_MEDIA_URL . 'app/main/includes/bp-media-upload-handler.php',
492
- 'runtimes' => 'gears,html5,flash,silverlight,browserplus',
493
- 'browse_button' => 'bp-media-upload-browse-button',
494
- 'container' => 'bp-media-upload-ui',
495
- 'drop_element' => 'drag-drop-area',
496
- 'filters' => apply_filters('bp_media_plupload_files_filter', array(array('title' => "Media Files", 'extensions' => "mp4,jpg,png,jpeg,gif,mp3"))),
497
- 'max_file_size' => min(array(ini_get('upload_max_filesize'), ini_get('post_max_size'))),
498
- 'multipart' => true,
499
- 'urlstream_upload' => true,
500
- 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
501
- 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
502
- 'file_data_name' => 'bp_media_file', // key passed to $_FILE.
503
- 'multi_selection' => true,
504
- 'multipart_params' => apply_filters('bp_media_multipart_params_filter', array('action' => 'wp_handle_upload'))
505
- );
506
- wp_enqueue_script('bp-media-uploader', BP_MEDIA_URL . 'app/assets/js/bp-media-uploader.js', array('plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4', 'plupload-handlers'), BP_MEDIA_VERSION);
507
- wp_localize_script('bp-media-uploader', 'bp_media_uploader_params', $params);
 
508
  }
509
- }
510
  wp_enqueue_style('bp-media-default', BP_MEDIA_URL . 'app/assets/css/main.css', '', BP_MEDIA_VERSION);
511
- wp_enqueue_style('bp-media-admin', BP_MEDIA_URL . 'app/assets/css/admin.css', '', BP_MEDIA_VERSION);
512
  }
513
 
514
  //This is used only on the uploads page so its added as action in the screens function of upload page.
@@ -894,24 +890,26 @@ class BPMediaActions {
894
 
895
  public function default_group_album() {
896
  $album_id = 0;
897
- if ($group_id = bp_get_current_group_id()) {
898
- $album_id = groups_get_groupmeta($group_id, 'bp_media_default_album');
899
- if (!$album_id) {
900
- $args = array(
901
- 'post_type' => 'bp_media_album',
902
- 'posts_per_page' => 1,
903
- 'meta_key' => 'bp-media-key',
904
- 'meta_value' => -$group_id,
905
- 'meta_compare' => '=',
906
- 'order' => 'ASC'
907
- );
908
- $query = new WP_Query($args);
909
- wp_reset_postdata();
910
- if (isset($query->posts) && isset($query->posts[0])) {
911
- $album_id = $query->posts[0]->ID;
912
- }
913
- if ($album_id) {
914
- groups_update_groupmeta($group_id, 'bp_media_default_album', $album_id);
 
 
915
  }
916
  }
917
  }
172
  wp_localize_script('bp-media-default', 'bp_media_vars', $bp_media_vars);
173
  wp_enqueue_style('bp-media-mecss', BP_MEDIA_URL . 'lib/media-element/mediaelementplayer.min.css', '', BP_MEDIA_VERSION);
174
  wp_enqueue_style('bp-media-default', BP_MEDIA_URL . 'app/assets/css/main.css', '', BP_MEDIA_VERSION);
 
 
 
175
  }
176
 
177
  /**
457
  }
458
 
459
  function upload_enqueue() {
460
+ if (is_user_logged_in()) {
461
+ if (bp_is_activity_component() || bp_is_group_home()) {
462
+ $params = array(
463
+ 'url' => BP_MEDIA_URL . 'app/main/includes/bp-media-upload-handler.php',
464
+ 'runtimes' => 'gears,html5,flash,silverlight,browserplus',
465
+ 'browse_button' => 'bp-media-activity-upload-browse-button',
466
+ 'container' => 'bp-media-activity-upload-ui',
467
+ 'drop_element' => 'drag-drop-area',
468
+ 'filters' => apply_filters('bp_media_plupload_files_filter', array(array('title' => "Media Files", 'extensions' => "mp4,jpg,png,jpeg,gif,mp3"))),
469
+ 'max_file_size' => min(array(ini_get('upload_max_filesize'), ini_get('post_max_size'))),
470
+ 'multipart' => true,
471
+ 'urlstream_upload' => true,
472
+ 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
473
+ 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
474
+ 'file_data_name' => 'bp_media_file', // key passed to $_FILE.
475
+ 'multi_selection' => true,
476
+ 'multipart_params' => apply_filters('bp_media_multipart_params_filter', array('action' => 'wp_handle_upload'))
477
+ );
478
+ wp_enqueue_script('bp-media-activity-uploader', BP_MEDIA_URL . 'app/assets/js/bp-media-activity-uploader.js', array('plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4', 'plupload-handlers'), BP_MEDIA_VERSION);
479
+ wp_localize_script('bp-media-activity-uploader', 'bp_media_uploader_params', $params);
480
+ wp_localize_script('bp-media-activity-uploader', 'activity_ajax_url', admin_url('admin-ajax.php'));
481
+ if (bp_is_active('groups') && bp_get_current_group_id())
482
+ $default_album = $this->default_group_album();
483
+ else
484
+ $default_album = $this->default_user_album();
485
+ wp_localize_script('bp-media-activity-uploader', 'default_album', $default_album ? $default_album : 0);
486
+ } elseif (in_array(bp_current_action(), array(BP_MEDIA_IMAGES_SLUG, BP_MEDIA_VIDEOS_SLUG, BP_MEDIA_AUDIO_SLUG, BP_MEDIA_SLUG, BP_MEDIA_ALBUMS_SLUG))) {
487
+ $params = array(
488
+ 'url' => BP_MEDIA_URL . 'app/main/includes/bp-media-upload-handler.php',
489
+ 'runtimes' => 'gears,html5,flash,silverlight,browserplus',
490
+ 'browse_button' => 'bp-media-upload-browse-button',
491
+ 'container' => 'bp-media-upload-ui',
492
+ 'drop_element' => 'drag-drop-area',
493
+ 'filters' => apply_filters('bp_media_plupload_files_filter', array(array('title' => "Media Files", 'extensions' => "mp4,jpg,png,jpeg,gif,mp3"))),
494
+ 'max_file_size' => min(array(ini_get('upload_max_filesize'), ini_get('post_max_size'))),
495
+ 'multipart' => true,
496
+ 'urlstream_upload' => true,
497
+ 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
498
+ 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
499
+ 'file_data_name' => 'bp_media_file', // key passed to $_FILE.
500
+ 'multi_selection' => true,
501
+ 'multipart_params' => apply_filters('bp_media_multipart_params_filter', array('action' => 'wp_handle_upload'))
502
+ );
503
+ wp_enqueue_script('bp-media-uploader', BP_MEDIA_URL . 'app/assets/js/bp-media-uploader.js', array('plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4', 'plupload-handlers'), BP_MEDIA_VERSION);
504
+ wp_localize_script('bp-media-uploader', 'bp_media_uploader_params', $params);
505
+ }
506
  }
 
507
  wp_enqueue_style('bp-media-default', BP_MEDIA_URL . 'app/assets/css/main.css', '', BP_MEDIA_VERSION);
 
508
  }
509
 
510
  //This is used only on the uploads page so its added as action in the screens function of upload page.
890
 
891
  public function default_group_album() {
892
  $album_id = 0;
893
+ if (bp_is_active('groups')) {
894
+ if ($group_id = bp_get_current_group_id()) {
895
+ $album_id = groups_get_groupmeta($group_id, 'bp_media_default_album');
896
+ if (!$album_id) {
897
+ $args = array(
898
+ 'post_type' => 'bp_media_album',
899
+ 'posts_per_page' => 1,
900
+ 'meta_key' => 'bp-media-key',
901
+ 'meta_value' => -$group_id,
902
+ 'meta_compare' => '=',
903
+ 'order' => 'ASC'
904
+ );
905
+ $query = new WP_Query($args);
906
+ wp_reset_postdata();
907
+ if (isset($query->posts) && isset($query->posts[0])) {
908
+ $album_id = $query->posts[0]->ID;
909
+ }
910
+ if ($album_id) {
911
+ groups_update_groupmeta($group_id, 'bp_media_default_album', $album_id);
912
+ }
913
  }
914
  }
915
  }
app/main/profile/BPMediaAlbumScreen.php CHANGED
@@ -12,230 +12,230 @@
12
  */
13
  class BPMediaAlbumScreen extends BPMediaScreen {
14
 
15
- var $filters;
16
-
17
- /**
18
- *
19
- * @param type $media_type
20
- * @param type $slug
21
- */
22
- public function __construct( $media_type, $slug ) {
23
- parent::__construct( $media_type, $slug );
24
- }
25
-
26
- /**
27
- *
28
- * @global type $bp
29
- */
30
- function screen() {
31
- global $bp;
32
- if ( isset( $bp->action_variables[ 0 ] ) ) {
33
- switch ( $bp->action_variables[ 0 ] ) {
34
- case BP_MEDIA_ALBUMS_EDIT_SLUG :
35
- $this->edit_screen();
36
- break;
37
- case BP_MEDIA_ALBUMS_VIEW_SLUG:
38
- $this->entry_screen();
39
- $this->template_actions( 'entry_screen' );
40
- break;
41
- case BP_MEDIA_DELETE_SLUG :
42
- if ( ! isset( $bp->action_variables[ 1 ] ) ) {
43
- $this->page_not_exist();
44
- }
45
- $this->entry_delete();
46
- break;
47
- default:
48
- $this->set_query();
49
- $this->template_actions( 'screen' );
50
- }
51
- } else {
52
- $this->set_query();
53
- $this->template_actions( 'screen' );
54
- }
55
- $this->template->loader();
56
- }
57
-
58
- /**
59
- *
60
- * @global type $bp_media_albums_query
61
- */
62
-
63
- /**
64
- *
65
- * @global type $bp_media_albums_query
66
- */
67
- function screen_content() {
68
- global $bp_media_albums_query;
69
-
70
- $this->hook_before();
71
-
72
- if ( $bp_media_albums_query && $bp_media_albums_query->have_posts() ):
73
- echo '<ul id="bp-album-list" class="bp-media-gallery item-list">';
74
- while ( $bp_media_albums_query->have_posts() ) : $bp_media_albums_query->the_post();
75
- $this->template->the_album_content();
76
- endwhile;
77
- echo '</ul>';
78
- $this->template->show_more( 'albums' );
79
- else:
80
- BPMediaFunction::show_formatted_error_message( sprintf( __( 'Sorry, no %s were found.', BP_MEDIA_TXT_DOMAIN ), $this->slug ), 'info' );
81
- endif;
82
- $this->hook_after();
83
- }
84
-
85
- /**
86
- *
87
- * @global type $bp
88
- * @global BPMediaAlbum $bp_media_current_album
89
- * @return boolean
90
- */
91
- function entry_screen() {
92
- global $bp, $bp_media_current_album;
93
- if ( ! $bp->action_variables[ 0 ] == BP_MEDIA_ALBUMS_VIEW_SLUG )
94
- return false;
95
- try {
96
- $bp_media_current_album = new BPMediaAlbum( $bp->action_variables[ 1 ] );
97
- } catch ( Exception $e ) {
98
- /* Send the values to the cookie for page reload display */
99
- @setcookie( 'bp-message', $_COOKIE[ 'bp-message' ], time() + 60 * 60 * 24, COOKIEPATH );
100
- @setcookie( 'bp-message-type', $_COOKIE[ 'bp-message-type' ], time() + 60 * 60 * 24, COOKIEPATH );
101
- $this->template->redirect( $this->media_const );
102
- exit;
103
- }
104
- }
105
-
106
- /**
107
- *
108
- * @global type $bp
109
- * @global BPMediaAlbum $bp_media_current_album
110
- * @global type $bp_media_query
111
- * @return boolean
112
- */
113
- function entry_screen_content() {
114
- global $bp, $bp_media_current_album, $bp_media_query;
115
- if ( ! $bp->action_variables[ 0 ] == BP_MEDIA_ALBUMS_VIEW_SLUG )
116
- return false;
117
- $allowed_edit = false;
118
- if ( is_user_logged_in() ) {
119
- if(!bp_is_user()){
120
- if ( bp_is_active( 'groups' ) ) {
121
- if ( groups_is_user_admin( bp_loggedin_user_id(), $bp->groups->current_group->id ) ) {
122
- $allowed_edit = true;
123
- } elseif ( bp_displayed_user_id() == bp_loggedin_user_id() ) {
124
- $allowed_edit = true;
125
- }
126
- }
127
- } else {
128
- if ( bp_displayed_user_id() == bp_loggedin_user_id() ) {
129
- $allowed_edit = true;
130
- }
131
- }
132
-
133
- if ( $allowed_edit != false ) {
134
- echo '<div class="album-edit">';
135
- 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="' . __( 'Edit Album', BP_MEDIA_TXT_DOMAIN ) . '">' . __( 'Edit', BP_MEDIA_TXT_DOMAIN ) . '</a>';
136
- 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>';
137
- echo '</div>';
138
- }
139
- }
140
- $this->inner_query( $bp_media_current_album->get_id() );
141
- $this->hook_before();
142
- if ( $bp_media_current_album && $bp_media_query->have_posts() ):
143
- echo '<ul id="bp-media-list" class="bp-media-gallery albums item-list">';
144
- if ( bp_is_my_profile() || BPMediaGroupLoader::can_upload() ) {
145
- echo '<li>';
146
- BPMediaUploadScreen::upload_screen_content();
147
- echo '</li>';
148
- }
149
- while ( $bp_media_query->have_posts() ) : $bp_media_query->the_post();
150
- $this->template->the_content();
151
- endwhile;
152
- echo '</ul>';
153
- $this->template->show_more();
154
- else:
155
- BPMediaFunction::show_formatted_error_message( __( 'Sorry, no media items were found in this album.', BP_MEDIA_TXT_DOMAIN ), 'info' );
156
- if ( bp_is_my_profile() || BPMediaGroupLoader::can_upload() ) {
157
- echo '<div class="bp-media-area-allocate"></div>';
158
- BPMediaUploadScreen::upload_screen_content();
159
- }
160
- endif;
161
- $this->hook_after();
162
- }
163
-
164
- function entry_screen_title() {
165
-
166
- global $bp_media_current_album;
167
- /** @var $bp_media_current_entry BPMediaHostWordpress */
168
- if ( is_object( $bp_media_current_album ) )
169
- echo $bp_media_current_album->get_title();
170
- }
171
-
172
- /**
173
- *
174
- * @global type $bp
175
- * @global type $bp_media_albums_query
176
- */
177
- function set_query() {
178
- global $bp, $bp_media_albums_query;
179
- if ( isset( $bp->action_variables ) && is_array( $bp->action_variables ) && isset( $bp->action_variables[ 0 ] ) && $bp->action_variables[ 0 ] == 'page' && isset( $bp->action_variables[ 1 ] ) && is_numeric( $bp->action_variables[ 1 ] ) ) {
180
- $paged = $bp->action_variables[ 1 ];
181
- } else {
182
- $paged = 1;
183
- }
184
- if ( $bp->current_action == BP_MEDIA_ALBUMS_SLUG ) {
185
- $query = new BPMediaQuery();
186
- $args = $query->init( 'album' );
187
- $bp_media_albums_query = new WP_Query( $args );
188
- }
189
- }
190
-
191
- /**
192
- *
193
- * @global type $bp
194
- * @global type $bp_media_query
195
- * @param type $album_id
196
- */
197
- function inner_query( $album_id = 0 ) {
198
- global $bp, $bp_media_query;
199
- $paged = 0;
200
- $action_variables = isset( $bp->canonical_stack[ 'action_variables' ] ) ? $bp->canonical_stack[ 'action_variables' ] : null;
201
- if ( isset( $action_variables ) && is_array( $action_variables ) && isset( $action_variables[ 0 ] ) ) {
202
- if ( $action_variables[ 0 ] == 'page' && isset( $action_variables[ 1 ] ) && is_numeric( $action_variables[ 1 ] ) )
203
- $paged = $action_variables[ 1 ];
204
- else if ( isset( $action_variables[ 1 ] ) && $action_variables[ 1 ] == 'page' && isset( $action_variables[ 2 ] ) && is_numeric( $action_variables[ 2 ] ) )
205
- $paged = $action_variables[ 2 ];
206
- }
207
- if ( ! $paged )
208
- $paged = 1;
209
- $this->filter_entries();
210
- if ( $bp->current_component == 'groups' ) {
211
- $query = new BPMediaQuery();
212
- $args = $query->init( false, $album_id, false, $paged );
213
- $bp_media_query = new WP_Query( $args );
214
- }
215
- if ( $bp->current_action == BP_MEDIA_ALBUMS_SLUG ) {
216
- $query = new BPMediaQuery();
217
- $args = $query->init( false, $album_id, false, $paged );
218
- $bp_media_query = new WP_Query( $args );
219
- }
220
- }
221
-
222
- function filter_entries() {
223
- global $bp_media;
224
- $enabled = $bp_media->enabled();
225
- if ( isset( $enabled[ 'upload' ] ) )
226
- unset( $enabled[ 'upload' ] );
227
- if ( isset( $enabled[ 'album' ] ) )
228
- unset( $enabled[ 'album' ] );
229
- foreach ( $enabled as $type => $active ) {
230
- if ( $active == true ) {
231
- $filters[ ] = $type;
232
- }
233
- }
234
-
235
- if ( count( $filters ) == 1 )
236
- $filters = $filters[ 0 ];
237
- $this->filters = $filters;
238
- }
239
 
240
  }
241
 
12
  */
13
  class BPMediaAlbumScreen extends BPMediaScreen {
14
 
15
+ var $filters;
16
+
17
+ /**
18
+ *
19
+ * @param type $media_type
20
+ * @param type $slug
21
+ */
22
+ public function __construct($media_type, $slug) {
23
+ parent::__construct($media_type, $slug);
24
+ }
25
+
26
+ /**
27
+ *
28
+ * @global type $bp
29
+ */
30
+ function screen() {
31
+ global $bp;
32
+ if (isset($bp->action_variables[0])) {
33
+ switch ($bp->action_variables[0]) {
34
+ case BP_MEDIA_ALBUMS_EDIT_SLUG :
35
+ $this->edit_screen();
36
+ break;
37
+ case BP_MEDIA_ALBUMS_VIEW_SLUG:
38
+ $this->entry_screen();
39
+ $this->template_actions('entry_screen');
40
+ break;
41
+ case BP_MEDIA_DELETE_SLUG :
42
+ if (!isset($bp->action_variables[1])) {
43
+ $this->page_not_exist();
44
+ }
45
+ $this->entry_delete();
46
+ break;
47
+ default:
48
+ $this->set_query();
49
+ $this->template_actions('screen');
50
+ }
51
+ } else {
52
+ $this->set_query();
53
+ $this->template_actions('screen');
54
+ }
55
+ $this->template->loader();
56
+ }
57
+
58
+ /**
59
+ *
60
+ * @global type $bp_media_albums_query
61
+ */
62
+
63
+ /**
64
+ *
65
+ * @global type $bp_media_albums_query
66
+ */
67
+ function screen_content() {
68
+ global $bp_media_albums_query;
69
+
70
+ $this->hook_before();
71
+
72
+ if ($bp_media_albums_query && $bp_media_albums_query->have_posts()):
73
+ echo '<ul id="bp-album-list" class="bp-media-gallery item-list">';
74
+ while ($bp_media_albums_query->have_posts()) : $bp_media_albums_query->the_post();
75
+ $this->template->the_album_content();
76
+ endwhile;
77
+ echo '</ul>';
78
+ $this->template->show_more('albums');
79
+ else:
80
+ BPMediaFunction::show_formatted_error_message(sprintf(__('Sorry, no %s were found.', BP_MEDIA_TXT_DOMAIN), $this->slug), 'info');
81
+ endif;
82
+ $this->hook_after();
83
+ }
84
+
85
+ /**
86
+ *
87
+ * @global type $bp
88
+ * @global BPMediaAlbum $bp_media_current_album
89
+ * @return boolean
90
+ */
91
+ function entry_screen() {
92
+ global $bp, $bp_media_current_album;
93
+ if (!$bp->action_variables[0] == BP_MEDIA_ALBUMS_VIEW_SLUG)
94
+ return false;
95
+ try {
96
+ $bp_media_current_album = new BPMediaAlbum($bp->action_variables[1]);
97
+ } catch (Exception $e) {
98
+ /* Send the values to the cookie for page reload display */
99
+ @setcookie('bp-message', $_COOKIE['bp-message'], time() + 60 * 60 * 24, COOKIEPATH);
100
+ @setcookie('bp-message-type', $_COOKIE['bp-message-type'], time() + 60 * 60 * 24, COOKIEPATH);
101
+ $this->template->redirect($this->media_const);
102
+ exit;
103
+ }
104
+ }
105
+
106
+ /**
107
+ *
108
+ * @global type $bp
109
+ * @global BPMediaAlbum $bp_media_current_album
110
+ * @global type $bp_media_query
111
+ * @return boolean
112
+ */
113
+ function entry_screen_content() {
114
+ global $bp, $bp_media_current_album, $bp_media_query;
115
+ if (!$bp->action_variables[0] == BP_MEDIA_ALBUMS_VIEW_SLUG)
116
+ return false;
117
+ $allowed_edit = false;
118
+ if (is_user_logged_in()) {
119
+ if (!bp_is_user()) {
120
+ if (bp_is_active('groups')) {
121
+ if (groups_is_user_admin(bp_loggedin_user_id(), $bp->groups->current_group->id)) {
122
+ $allowed_edit = true;
123
+ } elseif (bp_displayed_user_id() == bp_loggedin_user_id()) {
124
+ $allowed_edit = true;
125
+ }
126
+ }
127
+ } else {
128
+ if (bp_displayed_user_id() == bp_loggedin_user_id()) {
129
+ $allowed_edit = true;
130
+ }
131
+ }
132
+
133
+ if ($allowed_edit != false) {
134
+ echo '<div class="album-edit">';
135
+ 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="' . __('Edit Album', BP_MEDIA_TXT_DOMAIN) . '">' . __('Edit', BP_MEDIA_TXT_DOMAIN) . '</a>';
136
+ 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>';
137
+ echo '</div>';
138
+ }
139
+ }
140
+ $this->inner_query($bp_media_current_album->get_id());
141
+ $this->hook_before();
142
+ if ($bp_media_current_album && $bp_media_query->have_posts()) {
143
+ if (bp_is_my_profile() || BPMediaGroupLoader::can_upload()) {
144
+ BPMediaUploadScreen::upload_screen_content();
145
+ }
146
+ echo '<ul id="bp-media-list" class="bp-media-gallery albums item-list">';
147
+
148
+ while ($bp_media_query->have_posts()) {
149
+ $bp_media_query->the_post();
150
+ $this->template->the_content();
151
+ }
152
+ echo '</ul>';
153
+ $this->template->show_more();
154
+ } else {
155
+ BPMediaFunction::show_formatted_error_message(__('Sorry, no media items were found in this album.', BP_MEDIA_TXT_DOMAIN), 'info');
156
+ if (bp_is_my_profile() || BPMediaGroupLoader::can_upload()) {
157
+ echo '<div class="bp-media-area-allocate"></div>';
158
+ BPMediaUploadScreen::upload_screen_content();
159
+ }
160
+ }
161
+ $this->hook_after();
162
+ }
163
+
164
+ function entry_screen_title() {
165
+
166
+ global $bp_media_current_album;
167
+ /** @var $bp_media_current_entry BPMediaHostWordpress */
168
+ if (is_object($bp_media_current_album))
169
+ echo $bp_media_current_album->get_title();
170
+ }
171
+
172
+ /**
173
+ *
174
+ * @global type $bp
175
+ * @global type $bp_media_albums_query
176
+ */
177
+ function set_query() {
178
+ global $bp, $bp_media_albums_query;
179
+ if (isset($bp->action_variables) && is_array($bp->action_variables) && isset($bp->action_variables[0]) && $bp->action_variables[0] == 'page' && isset($bp->action_variables[1]) && is_numeric($bp->action_variables[1])) {
180
+ $paged = $bp->action_variables[1];
181
+ } else {
182
+ $paged = 1;
183
+ }
184
+ if ($bp->current_action == BP_MEDIA_ALBUMS_SLUG) {
185
+ $query = new BPMediaQuery();
186
+ $args = $query->init('album');
187
+ $bp_media_albums_query = new WP_Query($args);
188
+ }
189
+ }
190
+
191
+ /**
192
+ *
193
+ * @global type $bp
194
+ * @global type $bp_media_query
195
+ * @param type $album_id
196
+ */
197
+ function inner_query($album_id = 0) {
198
+ global $bp, $bp_media_query;
199
+ $paged = 0;
200
+ $action_variables = isset($bp->canonical_stack['action_variables']) ? $bp->canonical_stack['action_variables'] : null;
201
+ if (isset($action_variables) && is_array($action_variables) && isset($action_variables[0])) {
202
+ if ($action_variables[0] == 'page' && isset($action_variables[1]) && is_numeric($action_variables[1]))
203
+ $paged = $action_variables[1];
204
+ else if (isset($action_variables[1]) && $action_variables[1] == 'page' && isset($action_variables[2]) && is_numeric($action_variables[2]))
205
+ $paged = $action_variables[2];
206
+ }
207
+ if (!$paged)
208
+ $paged = 1;
209
+ $this->filter_entries();
210
+ if ($bp->current_component == 'groups') {
211
+ $query = new BPMediaQuery();
212
+ $args = $query->init(false, $album_id, false, $paged);
213
+ $bp_media_query = new WP_Query($args);
214
+ }
215
+ if ($bp->current_action == BP_MEDIA_ALBUMS_SLUG) {
216
+ $query = new BPMediaQuery();
217
+ $args = $query->init(false, $album_id, false, $paged);
218
+ $bp_media_query = new WP_Query($args);
219
+ }
220
+ }
221
+
222
+ function filter_entries() {
223
+ global $bp_media;
224
+ $enabled = $bp_media->enabled();
225
+ if (isset($enabled['upload']))
226
+ unset($enabled['upload']);
227
+ if (isset($enabled['album']))
228
+ unset($enabled['album']);
229
+ foreach ($enabled as $type => $active) {
230
+ if ($active == true) {
231
+ $filters[] = $type;
232
+ }
233
+ }
234
+
235
+ if (count($filters) == 1)
236
+ $filters = $filters[0];
237
+ $this->filters = $filters;
238
+ }
239
 
240
  }
241
 
app/main/profile/BPMediaScreen.php CHANGED
@@ -179,25 +179,24 @@ class BPMediaScreen {
179
 
180
  $this->hook_before();
181
 
182
- if ($bp_media_query && $bp_media_query->have_posts()):
183
- echo '<ul id="bp-media-list" class="bp-media-gallery item-list">';
184
  if (bp_is_my_profile() || BPMediaGroupLoader::can_upload()) {
185
- echo '<li>';
186
  BPMediaUploadScreen::upload_screen_content();
187
- echo '</li>';
188
  }
189
- while ($bp_media_query->have_posts()) : $bp_media_query->the_post();
 
 
190
  $this->template->the_content();
191
- endwhile;
192
  echo '</ul>';
193
  $this->template->show_more();
194
- else:
195
  BPMediaFunction::show_formatted_error_message(sprintf(__('Sorry, no %s were found.', BP_MEDIA_TXT_DOMAIN), $this->slug), 'info');
196
  if (bp_is_my_profile() || BPMediaGroupLoader::can_upload()) {
197
  echo '<div class="bp-media-area-allocate"></div>';
198
  BPMediaUploadScreen::upload_screen_content();
199
  }
200
- endif;
201
  $this->hook_after();
202
  }
203
 
@@ -251,19 +250,19 @@ class BPMediaScreen {
251
  $this->hook_before();
252
  if (!$bp->action_variables[0] == constant($entryslug))
253
  return false;
254
- echo '<div class="bp-media-single bp-media-image" id="bp-media-id-'.$bp_media_current_entry->get_id().'">';
255
- echo '<div class="bp-media-content-wrap" id="bp-media-content-wrap">';
256
  echo $bp_media_current_entry->get_media_single_content();
257
- echo '</div>';
258
- echo '<div class="bp-media-meta-content-wrap">';
259
- echo '<div class="bp-media-mod-title">';
260
- echo '<h2>';
261
- $this->entry_screen_title();
262
- echo '</h2>';
263
- echo '<p>'.nl2br($bp_media_current_entry->get_description()).'</p>';
264
- echo '</div>';
265
  echo $bp_media_current_entry->show_comment_form();
266
- echo '</div>';
267
  echo '</div>';
268
  $this->hook_after();
269
  }
179
 
180
  $this->hook_before();
181
 
182
+ if ($bp_media_query && $bp_media_query->have_posts()) {
 
183
  if (bp_is_my_profile() || BPMediaGroupLoader::can_upload()) {
 
184
  BPMediaUploadScreen::upload_screen_content();
 
185
  }
186
+ echo '<ul id="bp-media-list" class="bp-media-gallery item-list">';
187
+ while ($bp_media_query->have_posts()) {
188
+ $bp_media_query->the_post();
189
  $this->template->the_content();
190
+ }
191
  echo '</ul>';
192
  $this->template->show_more();
193
+ } else {
194
  BPMediaFunction::show_formatted_error_message(sprintf(__('Sorry, no %s were found.', BP_MEDIA_TXT_DOMAIN), $this->slug), 'info');
195
  if (bp_is_my_profile() || BPMediaGroupLoader::can_upload()) {
196
  echo '<div class="bp-media-area-allocate"></div>';
197
  BPMediaUploadScreen::upload_screen_content();
198
  }
199
+ }
200
  $this->hook_after();
201
  }
202
 
250
  $this->hook_before();
251
  if (!$bp->action_variables[0] == constant($entryslug))
252
  return false;
253
+ echo '<div class="bp-media-single bp-media-image" id="bp-media-id-' . $bp_media_current_entry->get_id() . '">';
254
+ echo '<div class="bp-media-content-wrap" id="bp-media-content-wrap">';
255
  echo $bp_media_current_entry->get_media_single_content();
256
+ echo '</div>';
257
+ echo '<div class="bp-media-meta-content-wrap">';
258
+ echo '<div class="bp-media-mod-title">';
259
+ echo '<h2>';
260
+ $this->entry_screen_title();
261
+ echo '</h2>';
262
+ echo '<p>' . nl2br($bp_media_current_entry->get_description()) . '</p>';
263
+ echo '</div>';
264
  echo $bp_media_current_entry->show_comment_form();
265
+ echo '</div>';
266
  echo '</div>';
267
  $this->hook_after();
268
  }
app/main/profile/BPMediaTemplate.php CHANGED
@@ -16,69 +16,83 @@ class BPMediaTemplate {
16
  * @global type $bp_media_current_album
17
  */
18
  function upload_form_multiple() {
19
- global $bp_media_current_album;
20
- $post_max_size = ini_get('post_max_size');
21
  $upload_max_filesize = ini_get('upload_max_filesize');
22
- $memory_limit = ini_get('memory_limit');
23
- $post_wall = __('Wall Posts', BP_MEDIA_TXT_DOMAIN); ?>
24
- <div id="bp-media-upload-ui" class="hide-if-no-js drag-drop">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  <div id="drag-drop-area">
26
- <div class="drag-drop-inside">
27
- <p class="drag-drop-info"><?php _e('Drop files here', BP_MEDIA_TXT_DOMAIN); ?></p>
28
- <p id="bp-media-album-or"><?php _e(' or ', BP_MEDIA_TXT_DOMAIN); ?></p>
29
- <p class="drag-drop-buttons"><input id="bp-media-upload-browse-button" type="button" value="<?php _e('Upload Media', BP_MEDIA_TXT_DOMAIN); ?>" class="button" /></p>
30
- </div>
31
- <?php if (!isset($bp_media_current_album)) { ?>
32
- <div id="bp-media-album-in"><span><?php _e('to', BP_MEDIA_TXT_DOMAIN); ?></span></div>
33
  <div id="bp-media-album-prompt" title="Album">
34
- <p><?php _e('Album', BP_MEDIA_TXT_DOMAIN); ?></p>
35
- <div class="bp-media-album-content">
36
  <select id="bp-media-selected-album"><?php
37
- if (bp_is_current_component('groups')) {
38
- $albums = new WP_Query(array(
39
- 'post_type' => 'bp_media_album',
40
- 'posts_per_page' => -1,
41
- 'meta_key' => 'bp-media-key',
42
- 'meta_value' => -bp_get_current_group_id(),
43
- 'meta_compare' => '='
44
- ));
45
- } else {
46
- $albums = new WP_Query(array(
47
- 'post_type' => 'bp_media_album',
48
- 'posts_per_page' => -1,
49
- 'author' => get_current_user_id()
50
- ));
51
- }
52
- if (isset($albums->posts) && is_array($albums->posts) && count($albums->posts) > 0) {
53
- foreach ($albums->posts as $album) {
54
- if ($album->post_title == $post_wall)
55
- echo '<option value="' . $album->ID . '" selected="selected">' . $album->post_title . '</option>';
56
- else
57
- echo '<option value="' . $album->ID . '">' . $album->post_title . '</option>';
58
- };
59
- }else {
60
- $album = new BPMediaAlbum();
61
- if (bp_is_current_component('groups')) {
62
- $current_group = new BP_Groups_Group(bp_get_current_group_id());
63
- $album->add_album($post_wall, $current_group->creator_id, bp_get_current_group_id());
64
- } else {
65
- $album->add_album($post_wall, bp_loggedin_user_id());
66
- }
67
- echo '<option value="' . $album->get_id() . '" selected="selected">' . $album->get_title() . '</option>';
68
- }
69
- echo '<option id="create-new" value="create_new" >' . __('+ Create New Album', BP_MEDIA_TXT_DOMAIN) . '</option>';
70
- ?>
71
  </select>
72
- </div>
73
  <div class="hide">
74
  <input type="text" id="bp_media_album_new" value="" placeholder="Album Name" /><br/>
75
  <input type="button" class="button" id="btn-create-new" value="<?php _e('Create', BP_MEDIA_TXT_DOMAIN); ?>"/>
76
  <input type="button" class="button" id="btn-create-cancel" value="<?php _e('Cancel', BP_MEDIA_TXT_DOMAIN); ?>"/>
77
  </div>
78
  </div>
79
- <?php } else { ?>
80
- <input type="hidden" id="bp-media-selected-album" value="<?php echo $bp_media_current_album->get_id(); ?>"/>
81
- <?php } ?>
 
 
 
 
82
  </div>
83
  <div id="bp-media-uploaded-files"></div>
84
  </div>
@@ -170,24 +184,24 @@ class BPMediaTemplate {
170
  */
171
  function show_more($type = 'media') {
172
  $showmore = false;
173
- global $bp_media;
174
- $count = $bp_media->default_count();
175
  switch ($type) {
176
  case 'media':
177
  global $bp_media_query;
178
  //found_posts
179
- if ( bp_is_my_profile() || BPMediaGroupLoader::can_upload() ) {
180
- if (isset($bp_media_query->found_posts) && $bp_media_query->found_posts > ($count-1) )
181
  $showmore = true;
182
  } else {
183
- if (isset($bp_media_query->found_posts) && $bp_media_query->found_posts > $count )
184
  $showmore = true;
185
  }
186
  break;
187
  case 'albums':
188
  global $bp_media_albums_query;
189
- if (isset($bp_media_albums_query->found_posts) && $bp_media_albums_query->found_posts > $count ){
190
- $showmore = true;
191
  }
192
  break;
193
  }
@@ -230,20 +244,20 @@ class BPMediaTemplate {
230
  </div>
231
  <div class="bp-media-album-content">
232
  <select id="bp-media-selected-album"><?php
233
- $albums = new WP_Query(array(
234
- 'post_type' => 'bp_media_album',
235
- 'posts_per_page' => -1,
236
- 'author' => get_current_user_id()
237
- ));
238
- if (isset($albums->posts) && is_array($albums->posts) && count($albums->posts) > 0) {
239
- foreach ($albums->posts as $album) {
240
- if ($album->post_title == $post_wall)
241
- echo '<option value="' . $album->ID . '" selected="selected">' . $album->post_title . '</option>';
242
- else
243
- echo '<option value="' . $album->ID . '">' . $album->post_title, BP_MEDIA_TXT_DOMAIN . '</option>';
244
- };
245
- }
246
- ?></select>
247
  </div>
248
  <div class="select-btn-div">
249
  <input id="selected-btn" type="button" class="btn" value="<?php _e('Select', BP_MEDIA_TXT_DOMAIN); ?>" />
16
  * @global type $bp_media_current_album
17
  */
18
  function upload_form_multiple() {
19
+ global $bp_media_current_album, $bp_media_query;
20
+ $post_max_size = ini_get('post_max_size');
21
  $upload_max_filesize = ini_get('upload_max_filesize');
22
+ $numeric_pms = (int)str_replace(array('K', 'M', 'G'), array('000', '000000', '000000000'), $post_max_size);
23
+ $numeric_umf = (int)str_replace(array('K', 'M', 'G'), array('000', '000000', '000000000'), $upload_max_filesize);
24
+ if ( $numeric_pms < $numeric_umf ) {
25
+ $size_limit = $post_max_size;
26
+ } else {
27
+ $size_limit = $upload_max_filesize;
28
+ }
29
+ $post_wall = __('Wall Posts', BP_MEDIA_TXT_DOMAIN);
30
+ if ($bp_media_query && $bp_media_query->have_posts()) {
31
+ $hidden = ' style="display:none;"';
32
+ ?>
33
+ <input id="bp-media-upload-button" type="button" value="Upload" class="button"><?php
34
+ } else {
35
+ $hidden = '';
36
+ }
37
+ ?>
38
+ <div id="bp-media-upload-ui" class="hide-if-no-js drag-drop"<?php echo $hidden; ?>>
39
  <div id="drag-drop-area">
40
+ <?php if (isset($bp_media_current_album)) { ?>
41
+ <input type="hidden" id="bp-media-selected-album" value="<?php echo $bp_media_current_album->get_id(); ?>"/>
42
+ <?php } else { ?>
 
 
 
 
43
  <div id="bp-media-album-prompt" title="Album">
44
+ <span><?php _e('Select Album: ', BP_MEDIA_TXT_DOMAIN); ?></span>
45
+ <span class="bp-media-album-content">
46
  <select id="bp-media-selected-album"><?php
47
+ if (bp_is_current_component('groups')) {
48
+ $albums = new WP_Query(array(
49
+ 'post_type' => 'bp_media_album',
50
+ 'posts_per_page' => -1,
51
+ 'meta_key' => 'bp-media-key',
52
+ 'meta_value' => -bp_get_current_group_id(),
53
+ 'meta_compare' => '='
54
+ ));
55
+ } else {
56
+ $albums = new WP_Query(array(
57
+ 'post_type' => 'bp_media_album',
58
+ 'posts_per_page' => -1,
59
+ 'author' => get_current_user_id()
60
+ ));
61
+ }
62
+ if (isset($albums->posts) && is_array($albums->posts) && count($albums->posts) > 0) {
63
+ foreach ($albums->posts as $album) {
64
+ if ($album->post_title == $post_wall)
65
+ echo '<option value="' . $album->ID . '" selected="selected">' . $album->post_title . '</option>';
66
+ else
67
+ echo '<option value="' . $album->ID . '">' . $album->post_title . '</option>';
68
+ };
69
+ }else {
70
+ $album = new BPMediaAlbum();
71
+ if (bp_is_current_component('groups')) {
72
+ $current_group = new BP_Groups_Group(bp_get_current_group_id());
73
+ $album->add_album($post_wall, $current_group->creator_id, bp_get_current_group_id());
74
+ } else {
75
+ $album->add_album($post_wall, bp_loggedin_user_id());
76
+ }
77
+ echo '<option value="' . $album->get_id() . '" selected="selected">' . $album->get_title() . '</option>';
78
+ }
79
+ echo '<option id="create-new" value="create_new" >' . __('+ Create New Album', BP_MEDIA_TXT_DOMAIN) . '</option>';
80
+ ?>
81
  </select>
82
+ </span>
83
  <div class="hide">
84
  <input type="text" id="bp_media_album_new" value="" placeholder="Album Name" /><br/>
85
  <input type="button" class="button" id="btn-create-new" value="<?php _e('Create', BP_MEDIA_TXT_DOMAIN); ?>"/>
86
  <input type="button" class="button" id="btn-create-cancel" value="<?php _e('Cancel', BP_MEDIA_TXT_DOMAIN); ?>"/>
87
  </div>
88
  </div>
89
+ <div id="bp-media-album-in"><span><?php _e('&', BP_MEDIA_TXT_DOMAIN); ?></span></div>
90
+ <?php } ?>
91
+ <div class="drag-drop-inside">
92
+ <span class="drag-drop-info"><?php _e('Drop files here', BP_MEDIA_TXT_DOMAIN); ?></span>
93
+ <span id="bp-media-album-or"><?php _e(' or ', BP_MEDIA_TXT_DOMAIN); ?></span>
94
+ <span class="drag-drop-buttons"><input id="bp-media-upload-browse-button" type="button" value="<?php _e('Upload Media', BP_MEDIA_TXT_DOMAIN); ?>" class="button" />(<?php _e('Max Upload Size', BP_MEDIA_TXT_DOMAIN);echo ': '.$size_limit; ?>)</span>
95
+ </div>
96
  </div>
97
  <div id="bp-media-uploaded-files"></div>
98
  </div>
184
  */
185
  function show_more($type = 'media') {
186
  $showmore = false;
187
+ global $bp_media;
188
+ $count = $bp_media->default_count();
189
  switch ($type) {
190
  case 'media':
191
  global $bp_media_query;
192
  //found_posts
193
+ if (bp_is_my_profile() || BPMediaGroupLoader::can_upload()) {
194
+ if (isset($bp_media_query->found_posts) && $bp_media_query->found_posts > ($count - 1))
195
  $showmore = true;
196
  } else {
197
+ if (isset($bp_media_query->found_posts) && $bp_media_query->found_posts > $count)
198
  $showmore = true;
199
  }
200
  break;
201
  case 'albums':
202
  global $bp_media_albums_query;
203
+ if (isset($bp_media_albums_query->found_posts) && $bp_media_albums_query->found_posts > $count) {
204
+ $showmore = true;
205
  }
206
  break;
207
  }
244
  </div>
245
  <div class="bp-media-album-content">
246
  <select id="bp-media-selected-album"><?php
247
+ $albums = new WP_Query(array(
248
+ 'post_type' => 'bp_media_album',
249
+ 'posts_per_page' => -1,
250
+ 'author' => get_current_user_id()
251
+ ));
252
+ if (isset($albums->posts) && is_array($albums->posts) && count($albums->posts) > 0) {
253
+ foreach ($albums->posts as $album) {
254
+ if ($album->post_title == $post_wall)
255
+ echo '<option value="' . $album->ID . '" selected="selected">' . $album->post_title . '</option>';
256
+ else
257
+ echo '<option value="' . $album->ID . '">' . $album->post_title, BP_MEDIA_TXT_DOMAIN . '</option>';
258
+ };
259
+ }
260
+ ?></select>
261
  </div>
262
  <div class="select-btn-div">
263
  <input id="selected-btn" type="button" class="btn" value="<?php _e('Select', BP_MEDIA_TXT_DOMAIN); ?>" />
app/main/query/BPMediaQuery.php CHANGED
@@ -122,16 +122,7 @@ class BPMediaQuery {
122
  $my_profile = true;
123
  }
124
  }
125
- if ( ($my_profile === true) && ($album==false) ) {
126
- if ( $page > 1 ) {
127
- $offset = $limit * ($page - 1) - 1;
128
- } else {
129
- $offset = 0;
130
- $limit = $limit - 1;
131
- }
132
- } else {
133
- $offset = $limit * ($page - 1);
134
- }
135
  return array( $limit, $offset );
136
  }
137
 
122
  $my_profile = true;
123
  }
124
  }
125
+ $offset = $limit * ($page - 1);
 
 
 
 
 
 
 
 
 
126
  return array( $limit, $offset );
127
  }
128
 
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.7
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.7.1
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.6
9
- Stable tag: 2.7
10
 
11
  Adds Photos, Music, Videos & Albums to BuddyPress. Supports mobile devices (iPhone/iPad, etc) and automatic audio/video conversion.
12
 
@@ -120,6 +120,12 @@ Please visit [BuddyPress Media's Features page](http://rtcamp.com/buddypress-med
120
  == Changelog ==
121
 
122
  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.
 
 
 
 
 
 
123
  = 2.7 =
124
  * Added activity uploader
125
  * Added lightbox
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.6
9
+ Stable tag: 2.7.1
10
 
11
  Adds Photos, Music, Videos & Albums to BuddyPress. Supports mobile devices (iPhone/iPad, etc) and automatic audio/video conversion.
12
 
120
  == Changelog ==
121
 
122
  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.
123
+ = 2.7.1 =
124
+ * Fixes bug related to group ids.
125
+ * Fixes bug with stylesheet loading
126
+ * Adds ajax loader to lightbox
127
+ * Revamped uploader UI
128
+
129
  = 2.7 =
130
  * Added activity uploader
131
  * Added lightbox