Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/20/2014 09:02:33 PM (10 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-templates/bp-legacy/buddypress-functions.php

    r7570 r7942  
    112112                add_action( 'bp_group_header_actions',     'bp_group_new_topic_button',      20 );
    113113                add_action( 'bp_directory_groups_actions', 'bp_group_join_button' );
     114                add_filter( 'bp_groups_directory_title',   'bp_legacy_theme_group_create_button' );
     115                add_filter( 'bp_blogs_directory_title',    'bp_legacy_theme_blog_create_button' );
    114116            }
    115117
     
    421423
    422424/**
     425 * Add the Create a Group button to the Groups directory title.
     426 *
     427 * bp-legacy puts the Create a Group button into the page title, to mimic
     428 * the behavior of bp-default.
     429 *
     430 * @since BuddyPress (2.0.0)
     431 *
     432 * @param string $title Groups directory title.
     433 * @return string
     434 */
     435function bp_legacy_theme_group_create_button( $title ) {
     436    return $title . ' ' . bp_get_group_create_button();
     437}
     438
     439/**
     440 * Add the Create a Site button to the Sites directory title.
     441 *
     442 * bp-legacy puts the Create a Site button into the page title, to mimic
     443 * the behavior of bp-default.
     444 *
     445 * @since BuddyPress (2.0.0)
     446 *
     447 * @param string $title Sites directory title.
     448 * @return string
     449 */
     450function bp_legacy_theme_blog_create_button( $title ) {
     451    return $title . ' ' . bp_get_blog_create_button();
     452}
     453/**
    423454 * This function looks scarier than it actually is. :)
    424455 * Each object loop (activity/members/groups/blogs/forums) contains default
Note: See TracChangeset for help on using the changeset viewer.