Skip to:
Content

BuddyPress.org

Ticket #7485: 7485.2.diff

File 7485.2.diff, 1.6 KB (added by dcavins, 8 years ago)

Adds a new function bp_get_group_link() to produce an HTML-formatted link to a group.

  • src/bp-groups/bp-groups-template.php

    diff --git a/src/bp-groups/bp-groups-template.php b/src/bp-groups/bp-groups-template.php
    index 15eb8ca..95142a9 100644
    a b function bp_group_permalink( $group = null ) { 
    995995        }
    996996
    997997/**
     998 * Output an HTML-formatted link for the current group in the loop.
     999 *
     1000 * @since 2.9.0
     1001 *
     1002 * @param BP_Groups_Group|null $group     Optional. Group object.
     1003 *                                        Default: current group in loop.
     1004 */
     1005function bp_group_link( $group = null ) {
     1006        echo bp_get_group_link( $group );
     1007}
     1008        /**
     1009         * Return an HTML-formatted link for the current group in the loop.
     1010         *
     1011         * @since 2.9.0
     1012         *
     1013         * @param BP_Groups_Group|null $group     Optional. Group object.
     1014         *                                        Default: current group in loop.
     1015         * @return string
     1016         */
     1017        function bp_get_group_link( $group = null ) {
     1018                global $groups_template;
     1019
     1020                if ( empty( $group ) ) {
     1021                        $group =& $groups_template->group;
     1022                }
     1023
     1024                $link = sprintf(
     1025                        '<a href="%s">%s</a>',
     1026                        esc_url( bp_get_group_permalink( $group ) ),
     1027                        esc_html( bp_get_group_name( $group ) )
     1028                );
     1029
     1030                /**
     1031                 * Filters the HTML-formatted link for the current group in the loop.
     1032                 *
     1033                 * @since 2.9.0
     1034                 *
     1035                 * @param string $value HTML-formatted link for the current group in the loop.
     1036                 * @param object $group Group object.
     1037                 */
     1038                return apply_filters( 'bp_get_group_link', $link, $group );
     1039        }
     1040
     1041/**
    9981042 * Output the permalink for the admin section of the current group in the loop.
    9991043 *
    10001044 * @since 1.0.0