Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/16/2009 09:38:39 AM (16 years ago)
Author:
apeatling
Message:

Added admin option to enable/disable activity comments on blog and forum threads. Moved the "View Thread" link into a more prominent position. Fixed some activity stream spacing issues.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-templatetags.php

    r2168 r2189  
    343343    }
    344344
    345     if ( !bp_is_activity_permalink() ) {
    346         if ( 'activity_comment' == $activities_template->activity->component_action )
    347             $meta = '</span> <span class="activity-header-meta"> &middot; <a href="' . $bp->root_domain . '/' . BP_ACTIVITY_SLUG . '/p/' . $activities_template->activity->item_id . '">' . __( 'View Thread', 'buddypress' ) . '</a>';
    348         else
    349             $meta = '</span> <span class="activity-header-meta"> &middot; <a href="' . $bp->root_domain . '/' . BP_ACTIVITY_SLUG . '/p/' . $activities_template->activity->id . '">' . __( 'View Thread', 'buddypress' ) . '</a>';
    350     }
    351 
    352345    /* Add the delete link if the user has permission on this item */
    353346    if ( ( $activities_template->activity->user_id == $bp->loggedin_user->id ) || $bp->is_item_admin || is_site_admin() )
     
    497490
    498491        return apply_filters( 'bp_get_activity_permalink_id', $bp->current_action );
     492    }
     493
     494function bp_activity_thread_permalink() {
     495    echo bp_get_activity_thread_permalink();
     496}
     497    function bp_get_activity_thread_permalink() {
     498        global $bp, $activities_template;
     499
     500        if ( 'new_blog_post' == bp_get_activity_action_name() || 'new_blog_comment' == bp_get_activity_action_name() || 'new_forum_topic' == bp_get_activity_action_name() || 'new_forum_post' == bp_get_activity_action_name() )
     501            $link = bp_activity_feed_item_link();
     502        else {
     503            if ( 'activity_comment' == bp_get_activity_action_name() )
     504                $link = $bp->root_domain . '/' . BP_ACTIVITY_SLUG . '/p/' . $activities_template->activity->item_id;
     505            else
     506                $link = $bp->root_domain . '/' . BP_ACTIVITY_SLUG . '/p/' . $activities_template->activity->id;
     507        }
     508
     509        return apply_filters( 'bp_get_activity_thread_permalink', $link );
    499510    }
    500511
     
    514525        ) );
    515526
    516         $mini_class = '';
     527        $class = '';
    517528        if ( in_array( $activities_template->activity->component_action, (array)$mini_activity_actions ) )
    518             $mini_class = ' mini';
    519 
    520         return apply_filters( 'bp_get_activity_css_class', $activities_template->activity->component_name . ' ' . $activities_template->activity->component_action . $mini_class );
     529            $class = ' mini';
     530
     531        if ( bp_activity_get_comment_count() && bp_activity_can_comment() )
     532            $class .= ' has-comments';
     533
     534        return apply_filters( 'bp_get_activity_css_class', $activities_template->activity->component_name . ' ' . $activities_template->activity->component_action . $class );
    521535    }
    522536
     
    616630    }
    617631
     632function bp_activity_can_comment() {
     633    global $bp;
     634
     635    if ( false === get_site_option( 'bp-disable-blogforum-comments' ) || (int)get_site_option( 'bp-disable-blogforum-comments' ) ) {
     636        if ( 'new_blog_post' == bp_get_activity_action_name() || 'new_blog_comment' == bp_get_activity_action_name() || 'new_forum_topic' == bp_get_activity_action_name() || 'new_forum_post' == bp_get_activity_action_name() )
     637            return false;
     638    }
     639
     640    if ( 'activity_comment' == bp_get_activity_action_name() )
     641        return false;
     642
     643    return true;
     644}
     645
    618646function bp_sitewide_activity_feed_link() {
    619647    echo bp_get_sitewide_activity_feed_link();
Note: See TracChangeset for help on using the changeset viewer.