Skip to:
Content

BuddyPress.org

Changeset 4729


Ignore:
Timestamp:
07/20/2011 03:39:22 PM (14 years ago)
Author:
boonebgorges
Message:

Adds template tags to fetch the current group id, slug, and object

Location:
trunk/bp-groups
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-groups/bp-groups-functions.php

    r4648 r4729  
    414414
    415415    return $count;
     416}
     417
     418/**
     419 * Returns the group object for the group currently being viewed
     420 *
     421 * @package BuddyPress
     422 * @since 1.3
     423 *
     424 * @return obj The current group object
     425 */
     426function groups_get_current_group() {
     427    global $bp;
     428   
     429    $current_group = isset( $bp->groups->current_group ) ? $bp->groups->current_group : false;
     430   
     431    return apply_filters( 'groups_get_current_group', $current_group );
    416432}
    417433
  • trunk/bp-groups/bp-groups-template.php

    r4678 r4729  
    27082708    }
    27092709
     2710/**
     2711 * Echoes the output of bp_get_current_group_id()
     2712 *
     2713 * @package BuddyPress
     2714 * @since 1.3
     2715 */
     2716function bp_current_group_id() {
     2717    echo bp_get_current_group_id();
     2718}   
     2719    /**
     2720     * Returns the ID of the current group
     2721     *
     2722     * @package BuddyPress
     2723     * @since 1.3
     2724     * @uses apply_filters() Filter bp_get_current_group_id to modify this output
     2725     *
     2726     * @return int $current_group_id The id of the current group, if there is one
     2727     */
     2728    function bp_get_current_group_id() {
     2729        $current_group = groups_get_current_group();
     2730       
     2731        $current_group_id = isset( $current_group->id ) ? (int)$current_group->id : 0;
     2732       
     2733        return apply_filters( 'bp_get_current_group_id', $current_group_id, $current_group );
     2734    }
     2735
     2736/**
     2737 * Echoes the output of bp_get_current_group_slug()
     2738 *
     2739 * @package BuddyPress
     2740 * @since 1.3
     2741 */
     2742function bp_current_group_slug() {
     2743    echo bp_get_current_group_slug();
     2744}   
     2745    /**
     2746     * Returns the slug of the current group
     2747     *
     2748     * @package BuddyPress
     2749     * @since 1.3
     2750     * @uses apply_filters() Filter bp_get_current_group_slug to modify this output
     2751     *
     2752     * @return str $current_group_slug The slug of the current group, if there is one
     2753     */
     2754    function bp_get_current_group_slug() {
     2755        $current_group = groups_get_current_group();
     2756       
     2757        $current_group_slug = isset( $current_group->slug ) ? $current_group->slug : '';
     2758       
     2759        return apply_filters( 'bp_get_current_group_slug', $current_group_slug, $current_group );
     2760    }
     2761
     2762/**
     2763 * Echoes the output of bp_get_current_group_name()
     2764 *
     2765 * @package BuddyPress
     2766 */
    27102767function bp_current_group_name() {
    27112768    echo bp_get_current_group_name();
    27122769}
     2770    /**
     2771     * Returns the name of the current group
     2772     *
     2773     * @package BuddyPress
     2774     * @since 1.3
     2775     * @uses apply_filters() Filter bp_get_current_group_name to modify this output
     2776     *
     2777     * @return str The name of the current group, if there is one
     2778     */
    27132779    function bp_get_current_group_name() {
    27142780        global $bp;
Note: See TracChangeset for help on using the changeset viewer.