Changeset 6344
- Timestamp:
- 03/02/2017 07:25:42 AM (7 years ago)
- Location:
- trunk/src
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/common/locks.php
r6341 r6344 40 40 : get_post_meta( $post->ID, '_edit_last', true ); 41 41 42 / ** This filter is documented in wp-admin/includes/ajax-actions.php */43 $time_window = apply_filters( ' wp_check_post_lock_window', 150);42 // Filter editing window duration 43 $time_window = apply_filters( 'bbp_check_post_lock_window', 3 * MINUTE_IN_SECONDS ); 44 44 45 45 // Return user who is or last edited 46 if ( ! empty( $time ) && ( $time > ( time() - $time_window ) ) && ( $user !== get_current_user_id() ) ) {47 return $user;46 if ( ! empty( $time ) && ( $time > ( time() - $time_window ) ) && ( $user !== bbp_get_current_user_id() ) ) { 47 return (int) $user; 48 48 } 49 49 -
trunk/src/includes/topics/template.php
r6320 r6344 4246 4246 return false; 4247 4247 } 4248 4249 /** Warning *******************************************************************/ 4250 4251 /** 4252 * Should the topic-lock alert appear? 4253 * 4254 * @since 2.6.0 bbPress (r6342) 4255 * 4256 * @return bool 4257 */ 4258 function bbp_show_topic_lock_alert() { 4259 4260 // Default to not showing the alert 4261 $retval = false; 4262 4263 // Get the current topic ID 4264 $topic_id = bbp_get_topic_id(); 4265 4266 // Only show on single topic pages 4267 if ( bbp_is_topic_edit() || bbp_is_single_topic() ) { 4268 4269 // Only show to moderators 4270 if ( current_user_can( 'moderate', $topic_id ) ) { 4271 4272 // Locked? 4273 $user_id = bbp_check_post_lock( $topic_id ); 4274 4275 // Only show if not locked by the current user 4276 if ( ! empty( $user_id ) && ( bbp_get_current_user_id() !== $user_id ) ) { 4277 $retval = true; 4278 } 4279 } 4280 } 4281 4282 return (bool) apply_filters( 'bbp_show_topic_lock_alert', $retval, $topic_id ); 4283 } 4284 4285 /** 4286 * Output the topic lock description 4287 * 4288 * @since 2.6.0 bbPress (r6343) 4289 * 4290 * @param int $topic_id Optional. Topic id 4291 */ 4292 function bbp_topic_lock_description( $topic_id = 0 ) { 4293 echo bbp_get_topic_lock_description( $topic_id ); 4294 } 4295 /** 4296 * Return the topic lock description 4297 * 4298 * @since 2.6.0 bbPress (r6343) 4299 * 4300 * @param int $topic_id Optional. Topic id 4301 */ 4302 function bbp_get_topic_lock_description( $topic_id = 0 ) { 4303 4304 // Check if topic is edit locked 4305 $topic_id = bbp_get_topic_id( $topic_id ); 4306 $user_id = bbp_check_post_lock( $topic_id ); 4307 $person = empty( $user_id ) 4308 ? esc_html__( 'Nobody', 'bbpress' ) 4309 : bbp_get_user_profile_link( $user_id ); 4310 4311 // Get the text 4312 $text = sprintf( esc_html__( '%1$s is currently editing this topic.', 'bbpress' ), $person ); 4313 4314 return apply_filters( 'bbp_get_topic_lock_description', $text, $user_id, $topic_id ); 4315 } -
trunk/src/templates/default/bbpress-functions.php
r6343 r6344 182 182 183 183 // Topic-specific scripts 184 if ( bbp_is_single_topic() ) {184 if ( bbp_is_single_topic() || bbp_is_topic_edit() ) { 185 185 186 186 // Topic favorite/unsubscribe -
trunk/src/templates/default/bbpress/content-single-topic.php
r6258 r6344 53 53 <?php endif; ?> 54 54 55 <?php bbp_get_template_part( 'alert', 'topic-lock' ); ?> 56 55 57 <?php do_action( 'bbp_template_after_single_topic' ); ?> 56 58 -
trunk/src/templates/default/bbpress/form-topic.php
r6258 r6344 24 24 25 25 <?php bbp_single_topic_description( array( 'topic_id' => bbp_get_topic_id() ) ); ?> 26 27 <?php bbp_get_template_part( 'alert', 'topic-lock' ); ?> 26 28 27 29 <?php endif; ?> -
trunk/src/templates/default/css/bbpress.css
r6253 r6344 1184 1184 } 1185 1185 1186 /* =Alerts 1187 -------------------------------------------------------------- */ 1188 1189 .bbp-alert-outer { 1190 height: 100%; 1191 width: 100%; 1192 top: 0; 1193 left: 0; 1194 position: fixed; 1195 background-color: rgba(0,0,0,0.2); 1196 z-index: 99999; 1197 } 1198 1199 .bbp-alert-inner { 1200 width: 350px; 1201 text-align: center; 1202 background: #fff; 1203 position: fixed; 1204 top: 50%; 1205 left: 50%; 1206 margin-top: -75px; 1207 margin-left: -185px; 1208 -webkit-border-radius: 3px; 1209 -moz-border-radius: 3px; 1210 border-radius: 3px; 1211 border: 1px solid #aaa; 1212 padding: 15px 10px 10px 1213 } 1214 1215 .bbp-alert-outer .bbp-alert-inner p { 1216 margin: 10px 0; 1217 } 1218 1219 .bbp-alert-actions a { 1220 padding: 5px 20px; 1221 text-decoration: none; 1222 } 1223 1186 1224 /*-------------------------------------------------------------- 1187 1225 Media Queries -
trunk/src/templates/default/js/editor.js
r5334 r6344 1 /* global edButtons, QTags, tinymce */ 1 2 jQuery(document).ready( function() { 2 3 -
trunk/src/templates/default/js/forum.js
r5334 r6344 1 /* global bbpForumJS */ 1 2 jQuery( document ).ready( function ( $ ) { 2 3 -
trunk/src/templates/default/js/topic.js
r5770 r6344 1 /* global bbpTopicJS */ 1 2 jQuery( document ).ready( function ( $ ) { 2 3 … … 29 30 bbp_ajax_call( 'subscription', $( this ).attr( 'data-topic' ), bbpTopicJS.subs_nonce, '#subscription-toggle' ); 30 31 } ); 32 33 $( '.bbp-alert-outer' ).on( 'click', '.bbp-alert-close', function( e ) { 34 e.preventDefault(); 35 $( this ).closest( '.bbp-alert-outer' ).fadeOut(); 36 } ); 37 38 $( '.bbp-alert-outer' ).on( 'click', function( e ) { 39 if ( this === e.target ) { 40 $( this ).closest( '.bbp-alert-outer' ).fadeOut(); 41 } 42 } ); 43 44 $( document ).keyup( function( e ) { 45 if ( e.keyCode === 27 ) { 46 $( '.bbp-alert-outer .bbp-alert-close' ).click(); 47 } 48 } ); 31 49 } );
Note: See TracChangeset
for help on using the changeset viewer.