Opened 14 years ago
Closed 13 years ago
#2429 closed defect (bug) (wontfix)
in main blog directory url for main blog is wrong if activity stream is on homepage
Reported by: | dwenaus | Owned by: | |
---|---|---|---|
Milestone: | 1.5 | Priority: | normal |
Severity: | Version: | ||
Component: | Core | Keywords: | |
Cc: |
Description
if the home page of the main blog is set to show the Activity Stream, then in the blog listings, the url of the main blog should go to the blog posts, not the main page (which is not a blog any more).
in the file bp-blogs-templatetags.php the function bp_get_blog_permalink() needs to be changed to check for this. my code is as follows:
if ( 'page' == get_option('show_on_front') && $permalink == bp_get_root_domain().'/' ) {
return get_permalink( get_option('page_for_posts') );
}
but I'm not sure if it should go after the if statement on line 225 or within it because I don't really understand what $blog_template is.
I tested my code only on directory based blogs, not sub domain blogs.
Change History (2)
#2
@
13 years ago
- Resolution set to wontfix
- Status changed from new to closed
DJPaul - I don't think it matters. dwenaus's problem, if I understand it, is that links from the blog directory point toward the homeurl of the blogs being listed, instead of the place where the individual blog posts live. It doesn't so much matter what *does* show on the front page, only that posts *don't*.
I am going to suggest wontfix for this, for the following reasons:
1) If we replace the href for the root blog (eg example.com/posts for example.com) then we should, for consistency's sake, do the same replacement for all blogs (since any blog can change the page that displays its posts). But this means that BP either needs to query each blog to see if 'page_for_posts' is set (bad idea), or keep track in its own tables of each blog's page_for_posts/show_on_front settings. That's a lot of extra code that we'll have to include (hooking into options being saved, expanding our tables, etc) for what is sort of an edge case.
2) More importantly: Pointing users directly to the Posts page potentially subverts the intent of the blog owner. Presumably the blog owner sets something other than Posts to the front page because it's not what she wants visitors to see when they first log in. Overriding this behavior in the blog directory seems intrusive to me.
There is a filter bp_get_blog_permalink that should allow site owners to make this fix quite easily. Just hook something like dwenaus's function (though I would use the new API function bp_is_root_blog( $blog_id ) instead of doing a string check against the root domain, but that's mostly an aesthetic choice) to bp_get_blog_permalink and filter it however you'd like.
Please reopen if I've misunderstood, or if you have pressing arguments in the other direction.
Now that any root component be assigned to the home page, I'm not sure how best to handle this sort of thing. Filter something in the components' root_slug?