Changeset 5436 for trunk/src/includes/users/template.php
- Timestamp:
- 07/09/2014 10:59:31 PM (12 years ago)
- File:
-
- 1 edited
-
trunk/src/includes/users/template.php (modified) (23 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/users/template.php
r5369 r5436 216 216 217 217 $user = bbp_get_current_user_id(); 218 if ( empty( $user ) ) 218 if ( empty( $user ) ) { 219 219 $user = bbp_get_current_anonymous_user_data( 'email' ); 220 } 220 221 221 222 $avatar = get_avatar( $user, $size ); … … 252 253 // Validate user id 253 254 $user_id = bbp_get_user_id( $user_id ); 254 if ( empty( $user_id ) ) 255 if ( empty( $user_id ) ) { 255 256 return false; 257 } 256 258 257 259 $user = get_userdata( $user_id ); … … 285 287 // Bail if no user ID passed 286 288 $user_id = bbp_get_user_id( $user_id ); 287 if ( empty( $user_id ) ) 289 if ( empty( $user_id ) ) { 288 290 return false; 291 } 289 292 290 293 // Parse default arguments … … 346 349 // Use displayed user ID if there is one, and one isn't requested 347 350 $user_id = bbp_get_user_id( $user_id ); 348 if ( empty( $user_id ) ) 351 if ( empty( $user_id ) ) { 349 352 return false; 353 } 350 354 351 355 // Allow early overriding of the profile URL to cut down on processing 352 356 $early_profile_url = apply_filters( 'bbp_pre_get_user_profile_url', (int) $user_id ); 353 if ( is_string( $early_profile_url ) ) 357 if ( is_string( $early_profile_url ) ) { 354 358 return $early_profile_url; 359 } 355 360 356 361 // Pretty permalinks … … 402 407 // Validate user id 403 408 $user_id = bbp_get_user_id( $user_id ); 404 if ( empty( $user_id ) ) 409 if ( empty( $user_id ) ) { 405 410 return false; 411 } 406 412 407 413 $user = get_userdata( $user_id ); … … 443 449 $bbp = bbpress(); 444 450 $user_id = bbp_get_user_id( $user_id ); 445 if ( empty( $user_id ) ) 451 if ( empty( $user_id ) ) { 446 452 return false; 453 } 447 454 448 455 // Pretty permalinks … … 547 554 */ 548 555 function bbp_get_admin_link( $args = '' ) { 549 if ( !current_user_can( 'moderate' ) ) 556 if ( !current_user_can( 'moderate' ) ) { 550 557 return; 551 552 if ( !empty( $args ) && is_string( $args ) && ( false === strpos( $args, '=' ) ) ) 558 } 559 560 if ( !empty( $args ) && is_string( $args ) && ( false === strpos( $args, '=' ) ) ) { 553 561 $args = array( 'text' => $args ); 562 } 554 563 555 564 // Parse arguments against default values … … 811 820 // Use displayed user ID if there is one, and one isn't requested 812 821 $user_id = bbp_get_user_id( $user_id ); 813 if ( empty( $user_id ) ) 822 if ( empty( $user_id ) ) { 814 823 return false; 824 } 815 825 816 826 // Allow early overriding of the profile URL to cut down on processing 817 827 $early_profile_url = apply_filters( 'bbp_pre_get_favorites_permalink', (int) $user_id ); 818 if ( is_string( $early_profile_url ) ) 828 if ( is_string( $early_profile_url ) ) { 819 829 return $early_profile_url; 830 } 820 831 821 832 // Pretty permalinks … … 974 985 // Use displayed user ID if there is one, and one isn't requested 975 986 $user_id = bbp_get_user_id( $user_id ); 976 if ( empty( $user_id ) ) 987 if ( empty( $user_id ) ) { 977 988 return false; 989 } 978 990 979 991 // Allow early overriding of the profile URL to cut down on processing 980 992 $early_profile_url = apply_filters( 'bbp_pre_get_subscriptions_permalink', (int) $user_id ); 981 if ( is_string( $early_profile_url ) ) 993 if ( is_string( $early_profile_url ) ) { 982 994 return $early_profile_url; 995 } 983 996 984 997 // Pretty permalinks … … 1202 1215 $public_display['display_username'] = $bbp->displayed_user->user_login; 1203 1216 1204 if ( !empty( $bbp->displayed_user->nickname ) ) 1217 if ( !empty( $bbp->displayed_user->nickname ) ) { 1205 1218 $public_display['display_nickname'] = $bbp->displayed_user->nickname; 1206 1207 if ( !empty( $bbp->displayed_user->first_name ) ) 1219 } 1220 1221 if ( !empty( $bbp->displayed_user->first_name ) ) { 1208 1222 $public_display['display_firstname'] = $bbp->displayed_user->first_name; 1209 1210 if ( !empty( $bbp->displayed_user->last_name ) ) 1223 } 1224 1225 if ( !empty( $bbp->displayed_user->last_name ) ) { 1211 1226 $public_display['display_lastname'] = $bbp->displayed_user->last_name; 1227 } 1212 1228 1213 1229 if ( !empty( $bbp->displayed_user->first_name ) && !empty( $bbp->displayed_user->last_name ) ) { … … 1216 1232 } 1217 1233 1218 if ( !in_array( $bbp->displayed_user->display_name, $public_display ) ) // Only add this if it isn't duplicated elsewhere 1234 // Only add this if it isn't duplicated elsewhere 1235 if ( !in_array( $bbp->displayed_user->display_name, $public_display ) ) { 1219 1236 $public_display = array( 'display_displayname' => $bbp->displayed_user->display_name ) + $public_display; 1237 } 1220 1238 1221 1239 $public_display = array_map( 'trim', $public_display ); … … 1243 1261 1244 1262 // Return if no user is being edited 1245 if ( ! bbp_is_single_user_edit() ) 1263 if ( ! bbp_is_single_user_edit() ) { 1246 1264 return; 1265 } 1247 1266 1248 1267 // Get users current blog role … … 1274 1293 1275 1294 // Return if no user is being edited 1276 if ( ! bbp_is_single_user_edit() ) 1295 if ( ! bbp_is_single_user_edit() ) { 1277 1296 return; 1297 } 1278 1298 1279 1299 // Get the user's current forum role … … 1284 1304 1285 1305 // Only keymasters can set other keymasters 1286 if ( ! bbp_is_user_keymaster() ) 1287 unset( $dynamic_roles[ bbp_get_keymaster_role() ] ); ?> 1306 if ( ! bbp_is_user_keymaster() ) { 1307 unset( $dynamic_roles[ bbp_get_keymaster_role() ] ); 1308 } ?> 1288 1309 1289 1310 <select name="bbp-forums-role" id="bbp-forums-role"> … … 1347 1368 // Use displayed user ID if there is one, and one isn't requested 1348 1369 $user_id = bbp_get_user_id( $user_id ); 1349 if ( empty( $user_id ) ) 1370 if ( empty( $user_id ) ) { 1350 1371 return false; 1372 } 1351 1373 1352 1374 // Allow early overriding of the profile URL to cut down on processing 1353 1375 $early_url = apply_filters( 'bbp_pre_get_user_topics_created_url', (int) $user_id ); 1354 if ( is_string( $early_url ) ) 1376 if ( is_string( $early_url ) ) { 1355 1377 return $early_url; 1378 } 1356 1379 1357 1380 // Pretty permalinks … … 1407 1430 // Use displayed user ID if there is one, and one isn't requested 1408 1431 $user_id = bbp_get_user_id( $user_id ); 1409 if ( empty( $user_id ) ) 1432 if ( empty( $user_id ) ) { 1410 1433 return false; 1434 } 1411 1435 1412 1436 // Allow early overriding of the profile URL to cut down on processing 1413 1437 $early_url = apply_filters( 'bbp_pre_get_user_replies_created_url', (int) $user_id ); 1414 if ( is_string( $early_url ) ) 1438 if ( is_string( $early_url ) ) { 1415 1439 return $early_url; 1440 } 1416 1441 1417 1442 // Pretty permalinks … … 1497 1522 1498 1523 // Bail if user is not logged in 1499 if ( !is_user_logged_in() ) 1524 if ( !is_user_logged_in() ) { 1500 1525 return; 1526 } 1501 1527 1502 1528 // Setup the profile page to redirect to … … 1520 1546 ?> 1521 1547 1522 <input type="hidden" name="user-cookie" value="1" />1523 1524 <?php1525 1526 // Allow custom login redirection1527 $redirect_to = apply_filters( 'bbp_user_login_redirect_to', '' );1528 bbp_redirect_to_field( $redirect_to );1529 1530 // Prevent intention hi-jacking of log-in form1531 wp_nonce_field( 'bbp-user-login' );1548 <input type="hidden" name="user-cookie" value="1" /> 1549 1550 <?php 1551 1552 // Allow custom login redirection 1553 $redirect_to = apply_filters( 'bbp_user_login_redirect_to', '' ); 1554 bbp_redirect_to_field( $redirect_to ); 1555 1556 // Prevent intention hi-jacking of log-in form 1557 wp_nonce_field( 'bbp-user-login' ); 1532 1558 } 1533 1559 … … 1548 1574 ?> 1549 1575 1550 <input type="hidden" name="action" value="register" />1551 <input type="hidden" name="user-cookie" value="1" />1552 1553 <?php1554 1555 // Allow custom registration redirection1556 $redirect_to = apply_filters( 'bbp_user_register_redirect_to', '' );1557 bbp_redirect_to_field( add_query_arg( array( 'checkemail' => 'registered' ), $redirect_to ) );1558 1559 // Prevent intention hi-jacking of sign-up form1560 wp_nonce_field( 'bbp-user-register' );1576 <input type="hidden" name="action" value="register" /> 1577 <input type="hidden" name="user-cookie" value="1" /> 1578 1579 <?php 1580 1581 // Allow custom registration redirection 1582 $redirect_to = apply_filters( 'bbp_user_register_redirect_to', '' ); 1583 bbp_redirect_to_field( add_query_arg( array( 'checkemail' => 'registered' ), $redirect_to ) ); 1584 1585 // Prevent intention hi-jacking of sign-up form 1586 wp_nonce_field( 'bbp-user-register' ); 1561 1587 } 1562 1588 … … 1575 1601 ?> 1576 1602 1577 <input type="hidden" name="user-cookie" value="1" />1578 1579 <?php1580 1581 // Allow custom lost pass redirection1582 $redirect_to = apply_filters( 'bbp_user_lost_pass_redirect_to', get_permalink() );1583 bbp_redirect_to_field( add_query_arg( array( 'checkemail' => 'confirm' ), $redirect_to ) );1584 1585 // Prevent intention hi-jacking of lost pass form1586 wp_nonce_field( 'bbp-user-lost-pass' );1603 <input type="hidden" name="user-cookie" value="1" /> 1604 1605 <?php 1606 1607 // Allow custom lost pass redirection 1608 $redirect_to = apply_filters( 'bbp_user_lost_pass_redirect_to', get_permalink() ); 1609 bbp_redirect_to_field( add_query_arg( array( 'checkemail' => 'confirm' ), $redirect_to ) ); 1610 1611 // Prevent intention hi-jacking of lost pass form 1612 wp_nonce_field( 'bbp-user-lost-pass' ); 1587 1613 } 1588 1614 … … 1870 1896 1871 1897 // Private forums 1872 if ( !current_user_can( 'read_private_forums' ) ) 1898 if ( !current_user_can( 'read_private_forums' ) ) { 1873 1899 $private = bbp_get_private_forum_ids(); 1900 } 1874 1901 1875 1902 // Hidden forums 1876 if ( !current_user_can( 'read_hidden_forums' ) ) 1903 if ( !current_user_can( 'read_hidden_forums' ) ) { 1877 1904 $hidden = bbp_get_hidden_forum_ids(); 1905 } 1878 1906 1879 1907 // Merge private and hidden forums together and remove any empties … … 1881 1909 1882 1910 // There are forums that need to be ex 1883 if ( !empty( $forum_ids ) ) 1911 if ( !empty( $forum_ids ) ) { 1884 1912 $post__not_in = implode( ',', $forum_ids ); 1913 } 1885 1914 1886 1915 // Parse arguments against default values … … 1896 1925 1897 1926 // No availabe forums 1898 if ( empty( $forums ) ) 1927 if ( empty( $forums ) ) { 1899 1928 $forums = false; 1929 } 1900 1930 1901 1931 return apply_filters( 'bbp_get_forums_for_current_user', $forums );
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)