Skip to:

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4570 closed enhancement (fixed)

Track latest post for sites to improve the Sites directory

Reported by: djpaul's profile DJPaul Owned by:
Milestone: 1.7 Priority: normal
Severity: normal Version:
Component: Blogs Keywords:


To improve the Sites directory for multisite BP, I'm suggesting for each sites that we record the latest post's title, content, and featured image to a site meta record. We can then display this information on the Sites directory templates.

Pre-1.7, the Sites / Groups / Members templates in BP-Default have been almost identical, and I think the Sites templates are by far the worse. If for each site we show an excerpt of the latest article and a picture, it makes the directory much more useful to people trying to find new content on the network.

Change History (9)

#1 @DJPaul
12 years ago

I'm thinking that this meta is updated by each site to avoid switch_to_blog. We could use data from the activity component in lieu of building something new, but that creates a hard requirement between the Sites and Activity components.

#2 @DJPaul
12 years ago

Or the data could be stored in the blogs meta tables (we don't use these anywhere in core just yet).

#3 @boonebgorges
12 years ago

blogmeta seems like the right place for this kind of data. Agreed that it shouldn't be dependent on Activity (it will mean duplicating some recent post stuff that already appears in new_blog_post activity items, but this isn't too big a deal). Just a matter of writing the functions that hook into publish_post (or maybe the {status}_to_{status} hooks, to avoid problems with scheduled posts and other goodies like that) and record the content.

#4 @DJPaul
12 years ago

  • Milestone changed from Awaiting Review to 1.7

#5 @DJPaul
12 years ago

I found some long-forgotten (for me, anyway) function that does something similar already; bp_get_blog_latest_post()

The underlying database query is in need of overhaul -- as is most of the Blogs component, really -- but for now I've extended the query to get the data I needed (featured images, specifically) and added some template functions for that, the title, and the post body.

I'm going to commit and close this ticket because, in a way, we already *do* track latest posts; just not very well. Perhaps overhauling the Blogs component will be something I might do for 1.8, unless I get any more time in 1.7 for incremental improvements.

Last edited 12 years ago by DJPaul (previous) (diff)

#6 @djpaul
12 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [6372]) Extend the functionality of the latest post tracking in the Blogs component by creating template functions for a post's title and content, as well as fetching any post thumbnail. Fixes #4570

#7 @djpaul
12 years ago

(In [6376]) Add template function to return ID of the site in the Blogs template loop. See #4570

#8 @djpaul
12 years ago

(In [6377]) Add bp_blog_latest_post_permalink() to return the latest post's permalink in the blogs loop. See #4570

#9 @djpaul
12 years ago

(In [6380]) Add blogs template helper function to find out if the site's current post has a featured image or not. See #4570, r6372

This avoids creating a variable in global scope in the template part, and makes things simpler for people building templates.

Note: See TracTickets for help on using tickets.