Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/20/2014 09:02:33 PM (11 years ago)
Author:
boonebgorges
Message:

Introduce blog- and group-create button functions, and use to build directory headers in bp-legacy

The new functions bp_get_blog_create_button() and bp_get_group_create_button()
standardize the treatment of these buttons by using bp_get_button(). They also
make life easier for themers, who will not need to build the buttons from
scratch.

In this changeset we modify the way that bp-legacy loads these buttons into the
titles of the directory pages. Previously, it was done directly in BP's theme
compat layer, with the result that all template packs had to follow the
questionable practice of embedding a button inside of a header element. Now,
the directory title is a string, but is filtered; bp-legacy then chooses to
add a button by using the new create-button functions + the new filters.

Fixes #5144

Props hnla, r-a-y

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-blogs/bp-blogs-template.php

    r7919 r7942  
    11501150
    11511151/**
     1152 * Output the Create a Site button.
     1153 *
     1154 * @since BuddyPress (2.0.0)
     1155 */
     1156function bp_blog_create_button() {
     1157    echo bp_get_blog_create_button();
     1158}
     1159    /**
     1160     * Get the Create a Site button.
     1161     *
     1162     * @since BuddyPress (2.0.0)
     1163     *
     1164     * @return string
     1165     */
     1166    function bp_get_blog_create_button() {
     1167        if ( ! is_user_logged_in() ) {
     1168            return false;
     1169        }
     1170
     1171        if ( ! bp_blog_signup_enabled() ) {
     1172            return false;
     1173        }
     1174
     1175        $button_args = array(
     1176            'id'         => 'create_blog',
     1177            'component'  => 'blogs',
     1178            'link_text'  => __( 'Create a Site', 'buddypress' ),
     1179            'link_title' => __( 'Create a Site', 'buddypress' ),
     1180            'link_class' => 'button blog-create bp-title-button',
     1181            'link_href'  => trailingslashit( bp_get_root_domain() ) . trailingslashit( bp_get_blogs_root_slug() ) . trailingslashit( 'create' ),
     1182            'wrapper'    => false,
     1183        );
     1184
     1185        return bp_get_button( $button_args );
     1186    }
     1187
     1188/**
    11521189 * Output button for visiting a blog in a loop.
    11531190 *
Note: See TracChangeset for help on using the changeset viewer.