Changeset 11623 for sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-hooks.php
- Timestamp:
- 03/02/2022 07:51:58 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-hooks.php
r11350 r11623 1336 1336 $user_has_blocked_role = ! empty( $user->roles ) && in_array( $blocked_role, $user->roles, true ); 1337 1337 1338 // Define what has blocked the user. 1339 if ( ! ms_is_switched() ) { 1340 $where_from = preg_replace( '!^https?://!i', '', home_url( is_admin() ? '/wp-admin' : '' ) ); 1341 } else { 1342 // When we're switched, we can't determine the source of the switch, so we use a bit of URL parsing magic. 1343 $where_from = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; 1344 if ( str_contains( $where_from, '?' ) ) { 1345 list( $where_from, ) = explode( '?', $where_from ); 1346 } 1347 // Trim actual filename off, just the major path component. 1348 $where_from = preg_replace( '!/[^/?]+\.[a-z]{3}$!i', '', $where_from ); 1349 } 1350 1338 1351 if ( 1339 1352 ( $blocked_role === $new_role || $user_has_blocked_role ) && … … 1360 1373 // Add a user note about this action. 1361 1374 $note_text = sprintf( 1362 'Forum role changed to %s.', 1363 get_role( $new_role )->name 1375 $where_from ? 'Forum role changed to %s via %s.' : 'Forum role changed to %s.', 1376 get_role( $new_role )->name, 1377 $where_from 1364 1378 ); 1379 1380 // Used in wporg-login to add context. 1381 $note_text = apply_filters( 'wporg_bbp_forum_role_changed_note_text', $note_text, $user ); 1365 1382 } else if ( 1366 1383 $password_broken && … … 1383 1400 // Add a user note about this action. 1384 1401 $note_text = sprintf( 1385 'Forum role changed to %s.', 1386 get_role( $new_role )->name 1402 $where_from ? 'Forum role changed to %s via %s.' : 'Forum role changed to %s.', 1403 get_role( $new_role )->name, 1404 $where_from 1387 1405 ); 1406 1407 // Unused, here for consistency with above. 1408 $note_text = apply_filters( 'wporg_bbp_forum_role_changed_note_text', $note_text, $user ); 1388 1409 } 1389 1410
Note: See TracChangeset
for help on using the changeset viewer.