Changeset 4633
- Timestamp:
- 12/22/2012 09:10:51 AM (12 years ago)
- Location:
- trunk/includes/extend/buddypress
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/extend/buddypress/functions.php
r4572 r4633 479 479 return (bool) apply_filters( 'bbp_is_forum_group_forum', $retval, $forum_id, $group_ids ); 480 480 } 481 482 /*** Group Member Status ******************************************************/ 483 484 /** 485 * Is the current user an admin of the current group 486 * 487 * @since bbPress (r4632) 488 * 489 * @uses is_user_logged_in() 490 * @uses bp_is_group() 491 * @uses bbpress() 492 * @uses get_current_user_id() 493 * @uses bp_get_current_group_id() 494 * @uses groups_is_user_admin() 495 * @return If current user is an admin of the current group 496 */ 497 function bbp_group_is_admin() { 498 499 // Bail if user is not logged in or not looking at a group 500 if ( ! is_user_logged_in() || ! bp_is_group() ) 501 return false; 502 503 $bbp = bbpress(); 504 505 // Set the global if not set 506 if ( ! isset( $bbp->current_user->is_group_admin ) ) 507 $bbp->current_user->is_group_admin = groups_is_user_admin( get_current_user_id(), bp_get_current_group_id() ); 508 509 // Return the value 510 return (bool) $bbp->current_user->is_group_admin; 511 } 512 513 /** 514 * Is the current user a moderator of the current group 515 * 516 * @since bbPress (r4632) 517 * 518 * @uses is_user_logged_in() 519 * @uses bp_is_group() 520 * @uses bbpress() 521 * @uses get_current_user_id() 522 * @uses bp_get_current_group_id() 523 * @uses groups_is_user_admin() 524 * @return If current user is a moderator of the current group 525 */ 526 function bbp_group_is_mod() { 527 528 // Bail if user is not logged in or not looking at a group 529 if ( ! is_user_logged_in() || ! bp_is_group() ) 530 return false; 531 532 $bbp = bbpress(); 533 534 // Set the global if not set 535 if ( ! isset( $bbp->current_user->is_group_mod ) ) 536 $bbp->current_user->is_group_mod = groups_is_user_mod( get_current_user_id(), bp_get_current_group_id() ); 537 538 // Return the value 539 return (bool) $bbp->current_user->is_group_mod; 540 } 541 542 /** 543 * Is the current user a member of the current group 544 * 545 * @since bbPress (r4632) 546 * 547 * @uses is_user_logged_in() 548 * @uses bp_is_group() 549 * @uses bbpress() 550 * @uses get_current_user_id() 551 * @uses bp_get_current_group_id() 552 * @uses groups_is_user_admin() 553 * @return If current user is a member of the current group 554 */ 555 function bbp_group_is_member() { 556 557 // Bail if user is not logged in or not looking at a group 558 if ( ! is_user_logged_in() || ! bp_is_group() ) 559 return false; 560 561 $bbp = bbpress(); 562 563 // Set the global if not set 564 if ( ! isset( $bbp->current_user->is_group_member ) ) 565 $bbp->current_user->is_group_member = groups_is_user_member( get_current_user_id(), bp_get_current_group_id() ); 566 567 // Return the value 568 return (bool) $bbp->current_user->is_group_member; 569 } 570 571 /** 572 * Is the current user banned from the current group 573 * 574 * @since bbPress (r4632) 575 * 576 * @uses is_user_logged_in() 577 * @uses bp_is_group() 578 * @uses bbpress() 579 * @uses get_current_user_id() 580 * @uses bp_get_current_group_id() 581 * @uses groups_is_user_admin() 582 * @return If current user is banned from the current group 583 */ 584 function bbp_group_is_banned() { 585 586 // Bail if user is not logged in or not looking at a group 587 if ( ! is_user_logged_in() || ! bp_is_group() ) 588 return false; 589 590 $bbp = bbpress(); 591 592 // Set the global if not set 593 if ( ! isset( $bbp->current_user->is_group_banned ) ) 594 $bbp->current_user->is_group_banned = groups_is_user_banned( get_current_user_id(), bp_get_current_group_id() ); 595 596 // Return the value 597 return (bool) $bbp->current_user->is_group_banned; 598 } 599 600 /** 601 * Is the current user the creator of the current group 602 * 603 * @since bbPress (r4632) 604 * 605 * @uses is_user_logged_in() 606 * @uses bp_is_group() 607 * @uses bbpress() 608 * @uses get_current_user_id() 609 * @uses bp_get_current_group_id() 610 * @uses groups_is_user_admin() 611 * @return If current user the creator of the current group 612 */ 613 function bbp_group_is_creator() { 614 615 // Bail if user is not logged in or not looking at a group 616 if ( ! is_user_logged_in() || ! bp_is_group() ) 617 return false; 618 619 $bbp = bbpress(); 620 621 // Set the global if not set 622 if ( ! isset( $bbp->current_user->is_group_creator ) ) 623 $bbp->current_user->is_group_creator = groups_is_user_creator( get_current_user_id(), bp_get_current_group_id() ); 624 625 // Return the value 626 return (bool) $bbp->current_user->is_group_creator; 627 } -
trunk/includes/extend/buddypress/group.php
r4613 r4633 192 192 case 'read_hidden_forums' : 193 193 case 'read_private_forums' : 194 if ( b p_group_is_member() || bp_group_is_mod() ||bp_group_is_admin() ) {194 if ( bbp_group_is_member() || bbp_group_is_mod() || bbp_group_is_admin() ) { 195 195 $caps = array( 'participate' ); 196 196 } … … 204 204 case 'edit_others_replies' : 205 205 case 'edit_others_topics' : 206 if ( b p_group_is_mod() ||bp_group_is_admin() ) {206 if ( bbp_group_is_mod() || bbp_group_is_admin() ) { 207 207 $caps = array( 'participate' ); 208 208 } … … 212 212 case 'delete_topic' : 213 213 case 'delete_reply' : 214 if ( b p_group_is_admin() ) {214 if ( bbp_group_is_admin() ) { 215 215 $caps = array( 'participate' ); 216 216 } … … 979 979 980 980 // Non-members cannot see forms 981 if ( ! b p_group_is_member() ) {981 if ( ! bbp_group_is_member() ) { 982 982 $retval = false; 983 983 984 984 // Banned users cannot see forms 985 } elseif ( b p_group_is_user_banned() ) {985 } elseif ( bbp_group_is_user_banned() ) { 986 986 $retval = false; 987 987 }
Note: See TracChangeset
for help on using the changeset viewer.