Ticket #6008: 6008.03.patch
File 6008.03.patch, 8.3 KB (added by , 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() { 1467 1467 'component' => 'blogs', 1468 1468 'link_text' => __( 'Create a Site', 'buddypress' ), 1469 1469 'link_title' => __( 'Create a Site', 'buddypress' ), 1470 'link_class' => 'b utton blog-create bp-title-button',1470 'link_class' => 'blog-create no-ajax', 1471 1471 'link_href' => trailingslashit( bp_get_root_domain() ) . trailingslashit( bp_get_blogs_root_slug() ) . trailingslashit( 'create' ), 1472 1472 'wrapper' => false, 1473 1473 ); … … function bp_blog_create_button() { 1483 1483 } 1484 1484 1485 1485 /** 1486 * Output the Create a Site nav item. 1487 * 1488 * @since BuddyPress (2.2.0) 1489 */ 1490 function 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 */ 1524 function 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 } 1537 add_action( 'bp_blogs_directory_blog_types', 'bp_blog_backcompat_create_nav_item', 1000 ); 1538 1539 /** 1486 1540 * Output button for visiting a blog in a loop. 1487 1541 * 1488 1542 * @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() { 2850 2850 'component' => 'groups', 2851 2851 'link_text' => __( 'Create a Group', 'buddypress' ), 2852 2852 'link_title' => __( 'Create a Group', 'buddypress' ), 2853 'link_class' => ' button group-create bp-title-button',2853 'link_class' => 'group-create no-ajax', 2854 2854 'link_href' => trailingslashit( bp_get_root_domain() ) . trailingslashit( bp_get_groups_root_slug() ) . trailingslashit( 'create' ), 2855 2855 'wrapper' => false, 2856 2856 ); … … function bp_group_create_button() { 2859 2859 } 2860 2860 2861 2861 /** 2862 * Output the Create a Group nav item. 2863 * 2864 * @since BuddyPress (2.2.0) 2865 */ 2866 function 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 */ 2900 function 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 } 2913 add_action( 'bp_groups_directory_group_filter', 'bp_group_backcompat_create_nav_item', 1000 ); 2914 2915 /** 2862 2916 * Prints a message if the group is not visible to the current user (it is a 2863 2917 * hidden or private group, and the user does not have access). 2864 2918 * -
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 { 108 108 109 109 // Group buttons 110 110 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 ); 116 115 } 117 116 118 117 // 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 121 123 122 124 } 123 125 … … endif; 449 451 * the behavior of bp-default. 450 452 * 451 453 * @since BuddyPress (2.0.0) 454 * @todo Deprecate 452 455 * 453 456 * @param string $title Groups directory title. 454 457 * @return string … … function bp_legacy_theme_group_create_button( $title ) { 458 461 } 459 462 460 463 /** 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 */ 474 function bp_legacy_theme_group_create_nav() { 475 bp_group_create_nav_item(); 476 } 477 478 /** 461 479 * Add the Create a Site button to the Sites directory title. 462 480 * 463 481 * bp-legacy puts the Create a Site button into the page title, to mimic 464 482 * the behavior of bp-default. 465 483 * 466 484 * @since BuddyPress (2.0.0) 485 * @todo Deprecate 467 486 * 468 487 * @param string $title Sites directory title. 469 488 * @return string … … function bp_legacy_theme_group_create_button( $title ) { 471 490 function bp_legacy_theme_blog_create_button( $title ) { 472 491 return $title . ' ' . bp_get_blog_create_button(); 473 492 } 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 */ 505 function bp_legacy_theme_blog_create_nav() { 506 bp_blog_create_nav_item(); 507 } 508 474 509 /** 475 510 * This function looks scarier than it actually is. :) 476 511 * 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() { 835 835 836 836 /* When a navigation tab is clicked - e.g. | All Groups | My Groups | */ 837 837 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') ) { 839 839 return; 840 840 } 841 841