Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/31/2014 01:57:38 PM (11 years ago)
Author:
imath
Message:

Move the Blogs and Groups create links into their directory main navs

Since r9157, we have removed the create links of these two components from the title of their WordPress post object.
For version 2.2, we've decided to move them into their directory main navs. As a result, each component navigation will now display 3 links for the logged in user :

  • All Groups / My Groups / Create a Group
  • All Sites / My Sites / Create a Site

We are aware, this might not be the best positioning for every users, so we are also introducing two new filters to help these users to neutralize it and choose their prefered positioning.

  • 'bp_get_group_create_nav_item'
  • 'bp_get_blog_create_nav_item'

Neutralizing the positioning can be achieve by simply returning false to these filters, here's an example for the Groups component create link.
add_filter( 'bp_get_group_create_nav_item', '__return_false' );

See #6008 / #4638

Props hnla, johnjamesjacoby, DJPaul, boonebgorges, modemlooper, imath

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-legacy/buddypress-functions.php

    r9190 r9291  
    109109            // Group buttons
    110110            if ( bp_is_active( 'groups' ) ) {
    111                 add_action( 'bp_group_header_actions',     'bp_group_join_button',           5 );
    112                 add_action( 'bp_group_header_actions',     'bp_group_new_topic_button',      20 );
    113                 add_action( 'bp_directory_groups_actions', 'bp_group_join_button' );
    114                 add_filter( 'bp_groups_directory_header',  'bp_legacy_theme_group_create_button' );
    115                 add_filter( 'bp_blogs_directory_header',   'bp_legacy_theme_blog_create_button' );
     111                add_action( 'bp_group_header_actions',          'bp_group_join_button',               5 );
     112                add_action( 'bp_group_header_actions',          'bp_group_new_topic_button',         20 );
     113                add_action( 'bp_directory_groups_actions',      'bp_group_join_button'                  );
     114                add_action( 'bp_groups_directory_group_filter', 'bp_legacy_theme_group_create_nav', 999 );
    116115            }
    117116
    118117            // Blog button
    119             if ( bp_is_active( 'blogs' ) )
    120                 add_action( 'bp_directory_blogs_actions',  'bp_blogs_visit_blog_button' );
     118            if ( bp_is_active( 'blogs' ) ) {
     119                add_action( 'bp_directory_blogs_actions',    'bp_blogs_visit_blog_button'           );
     120                add_action( 'bp_blogs_directory_blog_types', 'bp_legacy_theme_blog_create_nav', 999 );
     121            }
     122
    121123
    122124        }
     
    450452 *
    451453 * @since BuddyPress (2.0.0)
     454 * @todo Deprecate
    452455 *
    453456 * @param string $title Groups directory title.
     
    459462
    460463/**
     464 * Add the Create a Group nav to the Groups directory navigation.
     465 *
     466 * bp-legacy puts the Create a Group nav at the last position of
     467 * the Groups directory navigation.
     468 *
     469 * @since BuddyPress (2.2.0)
     470 *
     471 * @uses   bp_group_create_nav_item() to output the create a Group nav item
     472 * @return string
     473 */
     474function bp_legacy_theme_group_create_nav() {
     475    bp_group_create_nav_item();
     476}
     477
     478/**
    461479 * Add the Create a Site button to the Sites directory title.
    462480 *
     
    465483 *
    466484 * @since BuddyPress (2.0.0)
     485 * @todo Deprecate
    467486 *
    468487 * @param string $title Sites directory title.
     
    472491    return $title . ' ' . bp_get_blog_create_button();
    473492}
     493
     494/**
     495 * Add the Create a Site nav to the Sites directory navigation.
     496 *
     497 * bp-legacy puts the Create a Site nav at the last position of
     498 * the Sites directory navigation.
     499 *
     500 * @since BuddyPress (2.2.0)
     501 *
     502 * @uses   bp_blog_create_nav_item() to output the Create a Site nav item
     503 * @return string
     504 */
     505function bp_legacy_theme_blog_create_nav() {
     506    bp_blog_create_nav_item();
     507}
     508
    474509/**
    475510 * This function looks scarier than it actually is. :)
Note: See TracChangeset for help on using the changeset viewer.