Changeset 5441 for trunk/src/includes/extend/buddypress/functions.php
- Timestamp:
- 07/10/2014 03:54:41 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/extend/buddypress/functions.php
r5232 r5441 57 57 58 58 // Easy empty checking 59 if ( !empty( $user_id ) && is_numeric( $user_id ) ) 59 if ( !empty( $user_id ) && is_numeric( $user_id ) ) { 60 60 $bbp_user_id = $user_id; 61 } 61 62 62 63 // Currently viewing or editing a user 63 elseif ( ( true === $displayed_user_fallback ) && !empty( $did ) ) 64 elseif ( ( true === $displayed_user_fallback ) && !empty( $did ) ) { 64 65 $bbp_user_id = $did; 66 } 65 67 66 68 // Maybe fallback on the current_user ID 67 elseif ( ( true === $current_user_fallback ) && !empty( $lid ) ) 69 elseif ( ( true === $current_user_fallback ) && !empty( $lid ) ) { 68 70 $bbp_user_id = $lid; 71 } 69 72 70 73 return $bbp_user_id; … … 81 84 */ 82 85 function bbp_filter_is_single_user( $is = false ) { 83 if ( !empty( $is ) ) 86 if ( !empty( $is ) ) { 84 87 return $is; 88 } 85 89 86 90 return bp_is_user(); … … 97 101 */ 98 102 function bbp_filter_is_user_home( $is = false ) { 99 if ( !empty( $is ) ) 103 if ( !empty( $is ) ) { 100 104 return $is; 105 } 101 106 102 107 return bp_is_my_profile(); … … 293 298 294 299 // Use current group if none is set 295 if ( empty( $group_id ) ) 300 if ( empty( $group_id ) ) { 296 301 $group_id = bp_get_current_group_id(); 302 } 297 303 298 304 // Get the forums 299 if ( !empty( $group_id ) ) 305 if ( !empty( $group_id ) ) { 300 306 $forum_ids = groups_get_groupmeta( $group_id, 'forum_id' ); 307 } 301 308 302 309 // Make sure result is an array 303 if ( !is_array( $forum_ids ) ) 310 if ( !is_array( $forum_ids ) ) { 304 311 $forum_ids = (array) $forum_ids; 312 } 305 313 306 314 // Trim out any empty array items … … 322 330 323 331 // Use current group if none is set 324 if ( empty( $forum_id ) ) 332 if ( empty( $forum_id ) ) { 325 333 $forum_id = bbp_get_forum_id(); 334 } 326 335 327 336 // Get the forums 328 if ( !empty( $forum_id ) ) 337 if ( !empty( $forum_id ) ) { 329 338 $group_ids = get_post_meta( $forum_id, '_bbp_group_ids', true ); 339 } 330 340 331 341 // Make sure result is an array 332 if ( !is_array( $group_ids ) ) 342 if ( !is_array( $group_ids ) ) { 333 343 $group_ids = (array) $group_ids; 344 } 334 345 335 346 // Trim out any empty array items … … 348 359 349 360 // Use current group if none is set 350 if ( empty( $group_id ) ) 361 if ( empty( $group_id ) ) { 351 362 $group_id = bp_get_current_group_id(); 363 } 352 364 353 365 // Trim out any empties … … 386 398 387 399 // Use current group if none is set 388 if ( empty( $group_id ) ) 400 if ( empty( $group_id ) ) { 389 401 $group_id = bp_get_current_group_id(); 402 } 390 403 391 404 // Get current group IDs … … 411 424 412 425 // Use current group if none is set 413 if ( empty( $group_id ) ) 426 if ( empty( $group_id ) ) { 414 427 $group_id = bp_get_current_group_id(); 428 } 415 429 416 430 // Get current group IDs … … 436 450 437 451 // Use current group if none is set 438 if ( empty( $group_id ) ) 452 if ( empty( $group_id ) ) { 439 453 $group_id = bp_get_current_group_id(); 454 } 440 455 441 456 // Get current group IDs … … 461 476 462 477 // Use current group if none is set 463 if ( empty( $group_id ) ) 478 if ( empty( $group_id ) ) { 464 479 $group_id = bp_get_current_group_id(); 480 } 465 481 466 482 // Get current group IDs … … 483 499 484 500 // Use current group if none is set 485 if ( empty( $group_id ) ) 501 if ( empty( $group_id ) ) { 486 502 $group_id = bp_get_current_group_id(); 503 } 487 504 488 505 // Get current group IDs … … 556 573 557 574 // Bail if user is not logged in or not looking at a group 558 if ( ! is_user_logged_in() || ! bp_is_group() ) 575 if ( ! is_user_logged_in() || ! bp_is_group() ) { 559 576 return false; 577 } 560 578 561 579 $bbp = bbpress(); 562 580 563 581 // Set the global if not set 564 if ( ! isset( $bbp->current_user->is_group_admin ) ) 582 if ( ! isset( $bbp->current_user->is_group_admin ) ) { 565 583 $bbp->current_user->is_group_admin = groups_is_user_admin( get_current_user_id(), bp_get_current_group_id() ); 584 } 566 585 567 586 // Return the value … … 585 604 586 605 // Bail if user is not logged in or not looking at a group 587 if ( ! is_user_logged_in() || ! bp_is_group() ) 606 if ( ! is_user_logged_in() || ! bp_is_group() ) { 588 607 return false; 608 } 589 609 590 610 $bbp = bbpress(); 591 611 592 612 // Set the global if not set 593 if ( ! isset( $bbp->current_user->is_group_mod ) ) 613 if ( ! isset( $bbp->current_user->is_group_mod ) ) { 594 614 $bbp->current_user->is_group_mod = groups_is_user_mod( get_current_user_id(), bp_get_current_group_id() ); 615 } 595 616 596 617 // Return the value … … 614 635 615 636 // Bail if user is not logged in or not looking at a group 616 if ( ! is_user_logged_in() || ! bp_is_group() ) 637 if ( ! is_user_logged_in() || ! bp_is_group() ) { 617 638 return false; 639 } 618 640 619 641 $bbp = bbpress(); 620 642 621 643 // Set the global if not set 622 if ( ! isset( $bbp->current_user->is_group_member ) ) 644 if ( ! isset( $bbp->current_user->is_group_member ) ) { 623 645 $bbp->current_user->is_group_member = groups_is_user_member( get_current_user_id(), bp_get_current_group_id() ); 646 } 624 647 625 648 // Return the value … … 643 666 644 667 // Bail if user is not logged in or not looking at a group 645 if ( ! is_user_logged_in() || ! bp_is_group() ) 668 if ( ! is_user_logged_in() || ! bp_is_group() ) { 646 669 return false; 670 } 647 671 648 672 $bbp = bbpress(); 649 673 650 674 // Set the global if not set 651 if ( ! isset( $bbp->current_user->is_group_banned ) ) 675 if ( ! isset( $bbp->current_user->is_group_banned ) ) { 652 676 $bbp->current_user->is_group_banned = groups_is_user_banned( get_current_user_id(), bp_get_current_group_id() ); 677 } 653 678 654 679 // Return the value … … 672 697 673 698 // Bail if user is not logged in or not looking at a group 674 if ( ! is_user_logged_in() || ! bp_is_group() ) 699 if ( ! is_user_logged_in() || ! bp_is_group() ) { 675 700 return false; 701 } 676 702 677 703 $bbp = bbpress(); 678 704 679 705 // Set the global if not set 680 if ( ! isset( $bbp->current_user->is_group_creator ) ) 706 if ( ! isset( $bbp->current_user->is_group_creator ) ) { 681 707 $bbp->current_user->is_group_creator = groups_is_user_creator( get_current_user_id(), bp_get_current_group_id() ); 708 } 682 709 683 710 // Return the value
Note: See TracChangeset
for help on using the changeset viewer.