Changeset 10595
- Timestamp:
- 01/19/2021 04:40:47 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-hooks.php
r10580 r10595 1301 1301 $blocked_role = bbp_get_blocked_role(); 1302 1302 $password_broken = ( 0 === strpos( $user->user_pass, $blocked_prefix ) ); 1303 $note_text = false; 1303 1304 1304 1305 if ( $blocked_role === $new_role && ! $password_broken ) { … … 1322 1323 1323 1324 // Add a user note about this action. 1324 Plugin::get_instance()->user_notes->add_user_note( 1325 $user->ID, 1326 sprintf( 1327 'Forum role changed to %s.', 1328 get_role( $new_role )->name 1329 ) 1325 $note_text = sprintf( 1326 'Forum role changed to %s.', 1327 get_role( $new_role )->name 1330 1328 ); 1331 1329 } else if ( … … 1348 1346 1349 1347 // Add a user note about this action. 1348 $note_text = sprintf( 1349 'Forum role changed to %s.', 1350 get_role( $new_role )->name 1351 ); 1352 } 1353 1354 if ( $note_text ) { 1355 // Add a user note about this action. 1356 $notes = Plugin::get_instance()->user_notes->get_user_notes( $user->ID ); 1357 $note_id = 0; 1358 1359 // Check to see if the last note added was from the current user in the last few minutes, and if so, append to it. 1360 if ( $notes->count ) { 1361 $last_note_id = array_key_last( $notes->raw ); 1362 $last_note = $notes->raw[ $last_note_id ]; 1363 if ( 1364 // Note from the current user 1365 $last_note->moderator === wp_get_current_user()->user_nicename && 1366 // ..and created within 5 minutes. 1367 absint( time() - strtotime( $last_note->date ) ) <= 5 * MINUTE_IN_SECONDS 1368 ) { 1369 $note_id = $last_note_id; 1370 1371 // Prefix the existing message. 1372 $note_text = trim( $last_note->text . "\n\n" . $note_text ); 1373 } 1374 } 1375 1376 // Add a user note about this action. 1350 1377 Plugin::get_instance()->user_notes->add_user_note( 1351 1378 $user->ID, 1352 sprintf( 1353 'Forum role changed to %s.', 1354 get_role( $new_role )->name 1355 ) 1379 $note_text, 1380 null, 1381 $note_id 1356 1382 ); 1357 1383 }
Note: See TracChangeset
for help on using the changeset viewer.