Skip to:
Content

BuddyPress.org

Ticket #6008: 6008.03.patch

File 6008.03.patch, 8.3 KB (added by imath, 10 years ago)
  • src/bp-blogs/bp-blogs-template.php

    diff --git src/bp-blogs/bp-blogs-template.php src/bp-blogs/bp-blogs-template.php
    index 838f54f..b9ece7e 100644
    function bp_blog_create_button() { 
    14671467                        'component'  => 'blogs',
    14681468                        'link_text'  => __( 'Create a Site', 'buddypress' ),
    14691469                        'link_title' => __( 'Create a Site', 'buddypress' ),
    1470                         'link_class' => 'button blog-create bp-title-button',
     1470                        'link_class' => 'blog-create no-ajax',
    14711471                        'link_href'  => trailingslashit( bp_get_root_domain() ) . trailingslashit( bp_get_blogs_root_slug() ) . trailingslashit( 'create' ),
    14721472                        'wrapper'    => false,
    14731473                );
    function bp_blog_create_button() { 
    14831483        }
    14841484
    14851485/**
     1486 * Output the Create a Site nav item.
     1487 *
     1488 * @since BuddyPress (2.2.0)
     1489 */
     1490function bp_blog_create_nav_item() {
     1491        echo bp_get_blog_create_nav_item();
     1492}
     1493
     1494        /**
     1495         * Get the Create a Site nav item.
     1496         *
     1497         * @since BuddyPress (2.2.0)
     1498         *
     1499         * @return string
     1500         */
     1501        function bp_get_blog_create_nav_item() {
     1502                // Get the create a site button
     1503                $create_blog_button = bp_get_blog_create_button();
     1504
     1505                // Make sure the button is available
     1506                if ( empty( $create_blog_button ) ) {
     1507                        return;
     1508                }
     1509
     1510                $output = '<li id="blog-create-nav">' . $create_blog_button . '</li>';
     1511
     1512                return apply_filters( 'bp_get_blog_create_nav_item', $output );
     1513        }
     1514
     1515/**
     1516 * Checks if a specific theme is still filtering the Blogs directory title
     1517 * if so, transform the title button into a Blogs directory nav item.
     1518 *
     1519 * @since BuddyPress (2.2.0)
     1520 *
     1521 * @uses   bp_blog_create_nav_item() to output the Create a Site nav item
     1522 * @return string HTML Output
     1523 */
     1524function bp_blog_backcompat_create_nav_item() {
     1525        // Bail if Blogs nav item is already used by bp-legacy
     1526        if ( has_action( 'bp_blogs_directory_blog_types', 'bp_legacy_theme_blog_create_nav', 999 ) ) {
     1527                return;
     1528        }
     1529
     1530        // Bail if the theme is not filtering the Blogs directory title
     1531        if ( ! has_filter( 'bp_blogs_directory_header' ) ) {
     1532                return;
     1533        }
     1534
     1535        bp_blog_create_nav_item();
     1536}
     1537add_action( 'bp_blogs_directory_blog_types', 'bp_blog_backcompat_create_nav_item', 1000 );
     1538
     1539/**
    14861540 * Output button for visiting a blog in a loop.
    14871541 *
    14881542 * @see bp_get_blogs_visit_blog_button() for description of arguments.
  • src/bp-groups/bp-groups-template.php

    diff --git src/bp-groups/bp-groups-template.php src/bp-groups/bp-groups-template.php
    index 37a4904..16c24c5 100644
    function bp_group_create_button() { 
    28502850                        'component'  => 'groups',
    28512851                        'link_text'  => __( 'Create a Group', 'buddypress' ),
    28522852                        'link_title' => __( 'Create a Group', 'buddypress' ),
    2853                         'link_class' => 'button group-create bp-title-button',
     2853                        'link_class' => 'group-create no-ajax',
    28542854                        'link_href'  => trailingslashit( bp_get_root_domain() ) . trailingslashit( bp_get_groups_root_slug() ) . trailingslashit( 'create' ),
    28552855                        'wrapper'    => false,
    28562856                );
    function bp_group_create_button() { 
    28592859        }
    28602860
    28612861/**
     2862 * Output the Create a Group nav item.
     2863 *
     2864 * @since BuddyPress (2.2.0)
     2865 */
     2866function bp_group_create_nav_item() {
     2867        echo bp_get_group_create_nav_item();
     2868}
     2869
     2870        /**
     2871         * Get the Create a Group nav item.
     2872         *
     2873         * @since BuddyPress (2.2.0)
     2874         *
     2875         * @return string
     2876         */
     2877        function bp_get_group_create_nav_item() {
     2878                // Get the create a group button
     2879                $create_group_button = bp_get_group_create_button();
     2880
     2881                // Make sure the button is available
     2882                if ( empty( $create_group_button ) ) {
     2883                        return;
     2884                }
     2885
     2886                $output = '<li id="group-create-nav">' . $create_group_button . '</li>';
     2887
     2888                return apply_filters( 'bp_get_group_create_nav_item', $output );
     2889        }
     2890
     2891/**
     2892 * Checks if a specific theme is still filtering the Groups directory title
     2893 * if so, transform the title button into a Groups directory nav item.
     2894 *
     2895 * @since BuddyPress (2.2.0)
     2896 *
     2897 * @uses   bp_group_create_nav_item() to output the create a Group nav item
     2898 * @return string HTML Output
     2899 */
     2900function bp_group_backcompat_create_nav_item() {
     2901        // Bail if the Groups nav item is already used by bp-legacy
     2902        if ( has_action( 'bp_groups_directory_group_filter', 'bp_legacy_theme_group_create_nav', 999 ) ) {
     2903                return;
     2904        }
     2905
     2906        // Bail if the theme is not filtering the Groups directory title
     2907        if ( ! has_filter( 'bp_groups_directory_header' ) ) {
     2908                return;
     2909        }
     2910
     2911        bp_group_create_nav_item();
     2912}
     2913add_action( 'bp_groups_directory_group_filter', 'bp_group_backcompat_create_nav_item', 1000 );
     2914
     2915/**
    28622916 * Prints a message if the group is not visible to the current user (it is a
    28632917 * hidden or private group, and the user does not have access).
    28642918 *
  • src/bp-templates/bp-legacy/buddypress-functions.php

    diff --git src/bp-templates/bp-legacy/buddypress-functions.php src/bp-templates/bp-legacy/buddypress-functions.php
    index a5230c7..76edf76 100644
    class BP_Legacy extends BP_Theme_Compat { 
    108108
    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                }
    123125
    endif; 
    449451 * the behavior of bp-default.
    450452 *
    451453 * @since BuddyPress (2.0.0)
     454 * @todo Deprecate
    452455 *
    453456 * @param string $title Groups directory title.
    454457 * @return string
    function bp_legacy_theme_group_create_button( $title ) { 
    458461}
    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 *
    463481 * bp-legacy puts the Create a Site button into the page title, to mimic
    464482 * the behavior of bp-default.
    465483 *
    466484 * @since BuddyPress (2.0.0)
     485 * @todo Deprecate
    467486 *
    468487 * @param string $title Sites directory title.
    469488 * @return string
    function bp_legacy_theme_group_create_button( $title ) { 
    471490function bp_legacy_theme_blog_create_button( $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. :)
    476511 * Each object loop (activity/members/groups/blogs/forums) contains default
  • src/bp-templates/bp-legacy/js/buddypress.js

    diff --git src/bp-templates/bp-legacy/js/buddypress.js src/bp-templates/bp-legacy/js/buddypress.js
    index e2eec0b..fbe54a6 100644
    jq(document).ready( function() { 
    835835
    836836        /* When a navigation tab is clicked - e.g. | All Groups | My Groups | */
    837837        jq('div.item-list-tabs').on( 'click', function(event) {
    838                 if ( jq(this).hasClass('no-ajax') )  {
     838                if ( jq(this).hasClass('no-ajax')  || jq( event.target ).hasClass('no-ajax') )  {
    839839                        return;
    840840                }
    841841