Changeset 8459
- Timestamp:
- 05/28/2014 09:00:39 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/bp-groups-template.php
r8411 r8459 1515 1515 1516 1516 function bp_group_admin_tabs( $group = false ) { 1517 global $bp, $groups_template; 1518 1519 if ( empty( $group ) ) 1520 $group = ( $groups_template->group ) ? $groups_template->group : $bp->groups->current_group; 1517 global $groups_template; 1518 1519 if ( empty( $group ) ) { 1520 $group = ( $groups_template->group ) ? $groups_template->group : groups_get_current_group(); 1521 } 1521 1522 1522 1523 $current_tab = bp_get_group_current_admin_tab(); … … 3447 3448 3448 3449 if ( empty( $r['group_id'] ) ) { 3449 if ( ! empty( buddypress()->groups->current_group) ) {3450 if ( groups_get_current_group() ) { 3450 3451 $r['group_id'] = bp_get_current_group_id(); 3451 } else 3452 } elseif ( ! empty( buddypress()->groups->new_group_id ) ) { 3452 3453 $r['group_id'] = buddypress()->groups->new_group_id; 3453 3454 } … … 3601 3602 } 3602 3603 function bp_get_group_activity_feed_link() { 3603 global $bp; 3604 3605 return apply_filters( 'bp_get_group_activity_feed_link', bp_get_group_permalink( $bp->groups->current_group ) . 'feed/' ); 3604 return apply_filters( 'bp_get_group_activity_feed_link', bp_get_group_permalink( groups_get_current_group() ) . 'feed/' ); 3606 3605 } 3607 3606 … … 3625 3624 */ 3626 3625 function bp_get_current_group_id() { 3627 $current_group = groups_get_current_group(); 3628 3626 $current_group = groups_get_current_group(); 3629 3627 $current_group_id = isset( $current_group->id ) ? (int) $current_group->id : 0; 3630 3628 … … 3651 3649 */ 3652 3650 function bp_get_current_group_slug() { 3653 $current_group = groups_get_current_group(); 3654 3651 $current_group = groups_get_current_group(); 3655 3652 $current_group_slug = isset( $current_group->slug ) ? $current_group->slug : ''; 3656 3653 … … 3676 3673 */ 3677 3674 function bp_get_current_group_name() { 3678 global $bp; 3679 3680 $name = apply_filters( 'bp_get_group_name', $bp->groups->current_group->name ); 3681 return apply_filters( 'bp_get_current_group_name', $name ); 3682 } 3683 3675 $current_group = groups_get_current_group(); 3676 $current_group_name = isset( $current_group->name ) ? $current_group->name : ''; 3677 $name = apply_filters( 'bp_get_group_name', $current_group_name ); 3678 3679 return apply_filters( 'bp_get_current_group_name', $name, $current_group ); 3680 } 3681 3682 /** 3683 * Echoes the output of bp_get_current_group_description() 3684 * 3685 * @package BuddyPress 3686 * @since BuddyPress (2.1.0) 3687 */ 3688 function bp_current_group_description() { 3689 echo bp_get_current_group_description(); 3690 } 3691 /** 3692 * Returns the description of the current group 3693 * 3694 * @package BuddyPress 3695 * @since BuddyPress (2.1.0) 3696 * @uses apply_filters() Filter bp_get_current_group_description to modify 3697 * this output 3698 * 3699 * @return string The description of the current group, if there is one 3700 */ 3701 function bp_get_current_group_description() { 3702 $current_group = groups_get_current_group(); 3703 $current_group_desc = isset( $current_group->description ) ? $current_group->description : ''; 3704 $desc = apply_filters( 'bp_get_group_description', $current_group_desc ); 3705 3706 return apply_filters( 'bp_get_current_group_description', $desc ); 3707 } 3708 3709 /** 3710 * Output a URL for a group component action 3711 * 3712 * @since BuddyPress (1.2) 3713 * 3714 * @param string $action 3715 * @param string $query_args 3716 * @param bool $nonce 3717 * @return string 3718 */ 3684 3719 function bp_groups_action_link( $action = '', $query_args = '', $nonce = false ) { 3685 3720 echo bp_get_groups_action_link( $action, $query_args, $nonce ); 3686 3721 } 3722 /** 3723 * Get a URL for a group component action 3724 * 3725 * @since BuddyPress (1.2) 3726 * 3727 * @param string $action 3728 * @param string $query_args 3729 * @param bool $nonce 3730 * @return string 3731 */ 3687 3732 function bp_get_groups_action_link( $action = '', $query_args = '', $nonce = false ) { 3688 global $bp; 3733 3734 $current_group = groups_get_current_group(); 3735 $url = ''; 3689 3736 3690 3737 // Must be a group 3691 if ( empty( $bp->groups->current_group->id ) ) 3692 return; 3693 3694 // Append $action to $url if provided 3695 if ( !empty( $action ) ) 3696 $url = bp_get_group_permalink( groups_get_current_group() ) . $action; 3697 else 3698 $url = bp_get_group_permalink( groups_get_current_group() ); 3699 3700 // Add a slash at the end of our user url 3701 $url = trailingslashit( $url ); 3702 3703 // Add possible query arg 3704 if ( !empty( $query_args ) && is_array( $query_args ) ) 3705 $url = add_query_arg( $query_args, $url ); 3706 3707 // To nonce, or not to nonce... 3708 if ( true === $nonce ) 3709 $url = wp_nonce_url( $url ); 3710 elseif ( is_string( $nonce ) ) 3711 $url = wp_nonce_url( $url, $nonce ); 3712 3713 // Return the url, if there is one 3714 if ( !empty( $url ) ) 3715 return $url; 3738 if ( ! empty( $current_group->id ) ) { 3739 3740 // Append $action to $url if provided 3741 if ( !empty( $action ) ) { 3742 $url = bp_get_group_permalink( $current_group ) . $action; 3743 } else { 3744 $url = bp_get_group_permalink( $current_group ); 3745 } 3746 3747 // Add a slash at the end of our user url 3748 $url = trailingslashit( $url ); 3749 3750 // Add possible query args 3751 if ( !empty( $query_args ) && is_array( $query_args ) ) { 3752 $url = add_query_arg( $query_args, $url ); 3753 } 3754 3755 // To nonce, or not to nonce... 3756 if ( true === $nonce ) { 3757 $url = wp_nonce_url( $url ); 3758 } elseif ( is_string( $nonce ) ) { 3759 $url = wp_nonce_url( $url, $nonce ); 3760 } 3761 } 3762 3763 // Return the url 3764 return apply_filters( 'bp_get_groups_action_link', $url, $action, $query_args, $nonce ); 3716 3765 } 3717 3766
Note: See TracChangeset
for help on using the changeset viewer.