[buddypress-trac] [BuddyPress Trac] #5144: Don't set 'Create a Group' button as part of the title
buddypress-trac
noreply at wordpress.org
Thu Feb 20 10:15:03 UTC 2014
#5144: Don't set 'Create a Group' button as part of the title
--------------------------+------------------
Reporter: rogercoathup | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 2.0
Component: Theme | Version: 1.7
Severity: normal | Resolution:
Keywords: has-patch |
--------------------------+------------------
Comment (by hnla):
Don't want to present this as a patch (as more food for thought) but but
this approach works locally for me:
In bp-groups-screen.php I've refactored directory_dummy_post() $title to
remove the if user can create groups and associated markup altogether &
adding a new filter:
{{{
$title = __( 'Groups', 'buddypress' ) .
apply_filters('bp_group_dir_title', $title);
}}}
In bp-legacy functions.php I would add:
{{{
function group_create_button($title) {
if( bp_is_active( 'groups' ) && bp_user_can_create_groups() ) {
$title .= '<a class="button group-create" href="' . trailingslashit(
bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create' ) .
'">' . __( 'Create a Group', 'buddypress' ) . '</a>';
}
return $title;
}
add_filter('bp_group_dir_title', 'group_create_button');
}}}
That would preserve the existing behaviour adding the button into the
$title.
We now run the button markup, regardless of whether bp-legacy or new
templates, from functions.php; with the addition of new do_actions in
templates in a new functions.php we would simply run the above function
as:
{{{
function group_create_button() {
if( bp_is_active( 'groups' ) && bp_user_can_create_groups() ) {
echo '<a class="button group-create" href="' . trailingslashit(
bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create' ) .
'">' . __( 'Create a Group', 'buddypress' ) . '</a>';
}
}
add_action('bp_group_create_button', 'group_create_button' );
}}}
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5144#comment:15>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list