Skip to:
Content

BuddyPress.org

Ticket #6008: 6008.02.patch

File 6008.02.patch, 11.8 KB (added by imath, 10 years ago)
  • src/bp-blogs/bp-blogs-screens.php

    diff --git src/bp-blogs/bp-blogs-screens.php src/bp-blogs/bp-blogs-screens.php
    index b1ab651..8b6f91a 100644
    class BP_Blogs_Theme_Compat { 
    141141         */
    142142        public function directory_dummy_post() {
    143143
    144                 $title = apply_filters( 'bp_blogs_directory_header', __( 'Sites', 'buddypress' ) );
    145 
    146144                bp_theme_compat_reset_post( array(
    147145                        'ID'             => 0,
    148                         'post_title'     => $title,
     146                        'post_title'     => __( 'Sites', 'buddypress' ),
    149147                        'post_author'    => 0,
    150148                        'post_date'      => 0,
    151149                        'post_content'   => '',
    class BP_Blogs_Theme_Compat { 
    201199
    202200                // Title based on ability to create blogs
    203201                if ( is_user_logged_in() && bp_blog_signup_enabled() ) {
    204                         $title = '<a class="button bp-title-button" href="' . trailingslashit( bp_get_root_domain() . '/' . bp_get_blogs_root_slug() ) . '">' . __( 'Sites', 'buddypress' ) . '</a>&nbsp;' . __( 'Create a Site', 'buddypress' );
     202                        $title = __( 'Create a Site', 'buddypress' );
    205203                } else {
    206204                        $title = __( 'Sites', 'buddypress' );
    207205                }
  • src/bp-blogs/bp-blogs-template.php

    diff --git src/bp-blogs/bp-blogs-template.php src/bp-blogs/bp-blogs-template.php
    index 1cd4425..040e945 100644
    function bp_blog_create_button() { 
    12151215                        'component'  => 'blogs',
    12161216                        'link_text'  => __( 'Create a Site', 'buddypress' ),
    12171217                        'link_title' => __( 'Create a Site', 'buddypress' ),
    1218                         'link_class' => 'button blog-create bp-title-button',
     1218                        'link_class' => 'blog-create no-ajax',
    12191219                        'link_href'  => trailingslashit( bp_get_root_domain() ) . trailingslashit( bp_get_blogs_root_slug() ) . trailingslashit( 'create' ),
    12201220                        'wrapper'    => false,
    12211221                );
    function bp_blogs_get_profile_stats( $args = '' ) { 
    13261326        // Filter and return
    13271327        return apply_filters( 'bp_blogs_get_profile_stats', $r['output'], $r );
    13281328}
     1329
     1330/**
     1331 * Checks if a specific theme is still filtering the Blogs directory title
     1332 * if so, move it into the Blogs directory item tabs
     1333 *
     1334 * @since BuddyPress (?)
     1335 *
     1336 * @return string HTML Output
     1337 */
     1338function bp_blogs_backcompat_create_blog() {
     1339        // Bail if bp-legacy is in use
     1340        if ( did_action( 'bp_blogs_directory_blog_types', 'bp_legacy_theme_blog_create_button', 999 ) ) {
     1341                return;
     1342        }
     1343
     1344        // Get the button if the specific theme is still filtering the Blogs directory title
     1345        $create_blog_button = trim( apply_filters( 'bp_blogs_directory_header', '' ) );
     1346
     1347        if ( empty( $create_blog_button ) ) {
     1348                return;
     1349        }
     1350        ?>
     1351        <li id="blog-create-button"><?php echo $create_blog_button ;?></li>
     1352        <?php
     1353}
     1354add_action( 'bp_blogs_directory_blog_types', 'bp_blogs_backcompat_create_blog', 1000 );
  • src/bp-groups/bp-groups-screens.php

    diff --git src/bp-groups/bp-groups-screens.php src/bp-groups/bp-groups-screens.php
    index e89c72b..cdd7f34 100644
    class BP_Groups_Theme_Compat { 
    10991099         * @since BuddyPress (1.7.0)
    11001100         */
    11011101        public function directory_dummy_post() {
    1102 
    1103                 $title = apply_filters( 'bp_groups_directory_header', bp_get_directory_title( 'groups' ) );
    1104 
    11051102                bp_theme_compat_reset_post( array(
    11061103                        'ID'             => 0,
    1107                         'post_title'     => $title,
     1104                        'post_title'     => bp_get_directory_title( 'groups' ),
    11081105                        'post_author'    => 0,
    11091106                        'post_date'      => 0,
    11101107                        'post_content'   => '',
    class BP_Groups_Theme_Compat { 
    12221219        public function single_dummy_post() {
    12231220                bp_theme_compat_reset_post( array(
    12241221                        'ID'             => 0,
    1225                         'post_title'     => '<a href="' . bp_get_group_permalink( groups_get_current_group() ) . '">' . bp_get_current_group_name() . '</a>',
     1222                        'post_title'     => bp_get_current_group_name(),
    12261223                        'post_author'    => 0,
    12271224                        'post_date'      => 0,
    12281225                        'post_content'   => '',
  • src/bp-groups/bp-groups-template.php

    diff --git src/bp-groups/bp-groups-template.php src/bp-groups/bp-groups-template.php
    index f729076..7d697c8 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_groups_get_profile_stats( $args = '' ) { 
    47784778        // Filter and return
    47794779        return apply_filters( 'bp_groups_get_profile_stats', $r['output'], $r );
    47804780}
     4781
     4782/**
     4783 * Checks if a specific theme is still filtering the Groups directory title
     4784 * if so, move it into the Groups directory item tabs
     4785 *
     4786 * @since BuddyPress (?)
     4787 *
     4788 * @return string HTML Output
     4789 */
     4790function bp_groups_backcompat_create_group() {
     4791        // Bail if bp-legacy is in use
     4792        if ( did_action( 'bp_groups_directory_group_filter', 'bp_legacy_theme_group_create_button', 999 ) ) {
     4793                return;
     4794        }
     4795
     4796        // Get the button if the specific theme is still filtering the Groups directory title
     4797        $create_group_button = trim( apply_filters( 'bp_groups_directory_header', '' ) );
     4798
     4799        if ( empty( $create_group_button ) ) {
     4800                return;
     4801        }
     4802        ?>
     4803        <li id="group-create-button"><?php echo $create_group_button ;?></li>
     4804        <?php
     4805}
     4806add_action( 'bp_groups_directory_group_filter', 'bp_groups_backcompat_create_group', 1000 );
  • src/bp-members/bp-members-screens.php

    diff --git src/bp-members/bp-members-screens.php src/bp-members/bp-members-screens.php
    index 80f5565..9341d78 100644
    function bp_core_screen_activation() { 
    235235
    236236        // grab the key (the old way)
    237237        $key = isset( $_GET['key'] ) ? $_GET['key'] : '';
    238  
     238
    239239        // grab the key (the new way)
    240240        if ( empty( $key ) ) {
    241241                $key = bp_current_action();
    function bp_core_screen_activation() { 
    245245        if ( empty( $key ) ) {
    246246                return;
    247247        }
    248  
     248
    249249        // Activate the signup
    250250        $user = apply_filters( 'bp_core_activate_account', bp_core_activate_signup( $key ) );
    251251
    class BP_Members_Theme_Compat { 
    425425        public function single_dummy_post() {
    426426                bp_theme_compat_reset_post( array(
    427427                        'ID'             => 0,
    428                         'post_title'     => '<a href="' . bp_get_displayed_user_link() . '">' . bp_get_displayed_user_fullname() . '</a>',
     428                        'post_title'     => bp_get_displayed_user_fullname(),
    429429                        'post_author'    => 0,
    430430                        'post_date'      => 0,
    431431                        'post_content'   => '',
  • 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 47bc605..6a8f87e 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_button', 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_blogs_directory_blog_types', 'bp_legacy_theme_blog_create_button', 999 );
     120                                add_action( 'bp_directory_blogs_actions',    'bp_blogs_visit_blog_button'              );
     121                        }
    121122
    122123                }
    123124
    new BP_Legacy(); 
    443444endif;
    444445
    445446/**
    446  * Add the Create a Group button to the Groups directory title.
     447 * Add the Create a Group button to the Groups directory item tabs.
    447448 *
    448  * bp-legacy puts the Create a Group button into the page title, to mimic
    449  * the behavior of bp-default.
     449 * bp-legacy puts the Create a Group button into the directory item tabs
     450 * to avoid adding extra html to the title of the page
    450451 *
    451452 * @since BuddyPress (2.0.0)
    452453 *
    453  * @param string $title Groups directory title.
    454454 * @return string
    455455 */
    456 function bp_legacy_theme_group_create_button( $title ) {
    457         return $title . ' ' . bp_get_group_create_button();
     456function bp_legacy_theme_group_create_button() {
     457        $create_group_button = bp_get_group_create_button();
     458
     459        if ( empty( $create_group_button ) ) {
     460                return;
     461        }
     462        ?>
     463        <li id="group-create-button"><?php echo $create_group_button ;?></li>
     464        <?php
    458465}
    459466
    460467/**
    461  * Add the Create a Site button to the Sites directory title.
     468 * Add the Create a Site button to the Sites directory item tabs.
    462469 *
    463  * bp-legacy puts the Create a Site button into the page title, to mimic
    464  * the behavior of bp-default.
     470 * bp-legacy puts the Create a Site button into the directory item tabs
     471 * to avoid adding extra html to the title of the page
    465472 *
    466473 * @since BuddyPress (2.0.0)
    467474 *
    468  * @param string $title Sites directory title.
    469475 * @return string
    470476 */
    471 function bp_legacy_theme_blog_create_button( $title ) {
    472         return $title . ' ' . bp_get_blog_create_button();
     477function bp_legacy_theme_blog_create_button() {
     478        $create_blog_button = bp_get_blog_create_button();
     479
     480        if ( empty( $create_blog_button ) ) {
     481                return;
     482        }
     483        ?>
     484        <li id="blog-create-button"><?php echo $create_blog_button ;?></li>
     485        <?php
    473486}
    474487/**
    475488 * This function looks scarier than it actually is. :)
  • src/bp-templates/bp-legacy/css/buddypress.css

    diff --git src/bp-templates/bp-legacy/css/buddypress.css src/bp-templates/bp-legacy/css/buddypress.css
    index f924fe5..0e6216a 100644
    body.no-js #buddypress #notifications-bulk-management #select-all-notifications 
    764764#buddypress input[type=reset],
    765765#buddypress ul.button-nav li a,
    766766#buddypress div.generic-button a,
    767 #buddypress .comment-reply-link,
    768 a.bp-title-button {
     767#buddypress .comment-reply-link {
    769768        background: #fff; /* Old browsers */
    770769        border: 1px solid #ccc;
    771770        color: #777;
    a.bp-title-button { 
    776775        text-align: center;
    777776        text-decoration: none;
    778777}
     778
    779779#buddypress button:hover,
    780780#buddypress a.button:hover,
    781781#buddypress a.button:focus,
    body.activity-permalink #buddypress ul.item-list li.activity-item { 
    13151315        float: right;
    13161316        margin: 7px 0 0;
    13171317}
     1318#buddypress div.item-list-tabs ul li#group-create-button,
     1319#buddypress div.item-list-tabs ul li#blog-create-button {
     1320        margin:0;
     1321}
    13181322#buddypress div.item-list-tabs#subnav ul li.last {
    13191323        margin-top: 4px;
    13201324}
    body.register #buddypress div.page ul { 
    15861590                margin-bottom: 1em;
    15871591                width: 50%;
    15881592        }
    1589         a.bp-title-button {
    1590                 margin-left: 10px;
    1591         }
    15921593        #buddypress form.standard-form .main-column div.action{
    15931594                position: relative;
    15941595                margin-bottom:1em;
    body.register #buddypress div.page ul { 
    16651666        #buddypress li div.item{
    16661667                margin-left: 45px;
    16671668        }
    1668         h1 a.bp-title-button {
    1669                 clear: left;
    1670                 float: left;
    1671                 margin: 10px 0 20px;
    1672         }
    16731669}
  • 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 e8e61f3..90f6023 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