Changeset 2698
- Timestamp:
- 02/12/2010 01:27:20 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-blogs.php
r2696 r2698 9 9 require ( BP_PLUGIN_DIR . '/bp-blogs/bp-blogs-classes.php' ); 10 10 require ( BP_PLUGIN_DIR . '/bp-blogs/bp-blogs-templatetags.php' ); 11 require ( BP_PLUGIN_DIR . '/bp-blogs/bp-blogs-widgets.php' ); 11 12 /* Include the sitewide blog posts widget if this is a multisite installation */ 13 if ( bp_core_is_multisite() ) 14 require ( BP_PLUGIN_DIR . '/bp-blogs/bp-blogs-widgets.php' ); 12 15 13 16 function bp_blogs_install() { … … 437 440 if ( (int)get_blog_option( $blog_id, 'blog_public' ) || !bp_core_is_multisite() ) { 438 441 /* Now re-record the post in the activity streams */ 439 $post_permalink = bp_post_get_permalink( $post, $blog_id );442 $post_permalink = get_permalink( $post_id ); 440 443 441 444 $activity_action = sprintf( __( '%s wrote a new blog post: %s', 'buddypress' ), bp_core_get_userlink( (int)$post->post_author ), '<a href="' . $post_permalink . '">' . $post->post_title . '</a>' ); … … 495 498 if ( (int)get_blog_option( $recorded_comment->blog_id, 'blog_public' ) || !bp_core_is_multisite() ) { 496 499 /* Record in activity streams */ 497 $comment_link = bp_post_get_permalink( $comment->post, $wpdb->blogid) . '#comment-' . $comment_id;500 $comment_link = get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment_id; 498 501 $activity_action = sprintf( __( '%s commented on the blog post %s', 'buddypress' ), bp_core_get_userlink( $user_id ), '<a href="' . $comment_link . '#comment-' . $comment->comment_ID . '">' . $comment->post->post_title . '</a>' ); 499 502 $activity_content = $comment->comment_content; -
trunk/bp-blogs/bp-blogs-widgets.php
r2576 r2698 1 1 <?php 2 2 3 /* Register widgets for blogs component */ 3 /*** 4 * The recent blogs widget is actually just the activity feed filtered on "new_blog_post". 5 * Why not make some of your own widgets using a filtered activity stream? 6 */ 7 4 8 function bp_blogs_register_widgets() { 5 add_action('widgets_init', create_function('', 'return register_widget("BP_Blogs_Recent_Posts_Widget");') ); 9 global $current_blog, $bp; 10 11 if ( bp_is_active( 'activity' ) && (int)$current_blog->blog_id == BP_ROOT_BLOG ) 12 add_action('widgets_init', create_function('', 'return register_widget("BP_Blogs_Recent_Posts_Widget");') ); 6 13 } 7 add_action( ' template_redirect', 'bp_blogs_register_widgets' );14 add_action( 'bp_register_widgets', 'bp_blogs_register_widgets' ); 8 15 9 16 class BP_Blogs_Recent_Posts_Widget extends WP_Widget { … … 26 33 $instance['max_posts'] = 10; ?> 27 34 28 <?php $posts = bp_blogs_get_latest_posts( null, $instance['max_posts'] ) ?> 29 <?php $counter = 0; ?> 35 <?php if ( bp_has_activities( 'action=new_blog_post&max=' . $instance['max_posts'] . '&per_page=' . $instance['max_posts'] ) ) : ?> 30 36 31 <?php if ( $posts ) : ?> 32 <div class="item-options" id="recent-posts-options"> 33 <?php _e("Site Wide", 'buddypress') ?> 34 </div> 35 <ul id="recent-posts" class="item-list"> 36 <?php foreach ( (array)$posts as $post ) : ?> 37 <ul id="blog-post-list" class="activity-list item-list"> 38 39 <?php while ( bp_activities() ) : bp_the_activity(); ?> 40 37 41 <li> 38 <div class="item-avatar"> 39 <a href="<?php echo bp_post_get_permalink( $post, $post->blog_id ) ?>" title="<?php echo apply_filters( 'the_title', $post->post_title ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $post->post_author, 'type' => 'thumb' ) ) ?></a> 40 </div> 42 <div class="activity-content" style="margin: 0"> 41 43 42 <div class="item"> 43 <h4 class="item-title"><a href="<?php echo bp_post_get_permalink( $post, $post->blog_id ) ?>" title="<?php echo apply_filters( 'the_title', $post->post_title ) ?>"><?php echo apply_filters( 'the_title', $post->post_title ) ?></a></h4> 44 <?php if ( !$counter ) : ?> 45 <div class="item-content"><?php echo bp_create_excerpt($post->post_content) ?></div> 44 <div class="activity-header"> 45 <?php bp_activity_action() ?> 46 </div> 47 48 <?php if ( bp_get_activity_content_body() ) : ?> 49 <div class="activity-inner"> 50 <?php bp_activity_content_body() ?> 51 </div> 46 52 <?php endif; ?> 47 <div class="item-meta"><em><?php printf( __( 'by %s from the blog <a href="%s">%s</a>', 'buddypress' ), bp_core_get_userlink( $post->post_author ), get_blog_option( $post->blog_id, 'siteurl' ), get_blog_option( $post->blog_id, 'blogname' ) ) ?></em></div> 53 48 54 </div> 49 55 </li> 50 <?php $counter++; ?> 51 <?php endforeach; ?> 56 57 <?php endwhile; ?> 58 52 59 </ul> 53 <?php else: ?> 54 <div class="widget-error"> 55 <?php _e('There are no recent blog posts, why not write one?', 'buddypress') ?> 60 61 <?php else : ?> 62 <div id="message" class="info"> 63 <p><?php _e( 'Sorry, there were no blog posts found. Why not write one?', 'buddypress' ) ?></p> 56 64 </div> 57 65 <?php endif; ?>
Note: See TracChangeset
for help on using the changeset viewer.