If i want to just allow certain roles or certain users to have blogs I can give them permissions however the link "View recent blog entries" shows up on all user account pages even if they don't have permissions to post blog entries or haven't posted any blog entries yet.

I think it would be sensible to implement some sort or method for hiding this link either for Users that have no blog posts or don't have permission to post blog posts.

At the moment i find the Blog module very limited in functionality. It seems its all (every user) or nothing, this would be a very useful function to improve this module.

Comments

spreethi’s picture

Test cases for "View Recent Blog Entries"
1) Logged in as administrator, created blog entries, and check user account page for link "View recent blog entries". Administrator role has permission to post new blog entries, and this account has entries so the link shows.
2)Deleted all the blog entries for administrator, checked user account page. "View recent blog entries" is not visible as there are no entries.
3)Logged in as anonymous user with no permission to post blog entries."View recent blog entries" is not visible as the user has no permission.
Attached is patch and screen shot when no blog entries are posted for a user.

spreethi’s picture

Posting new patch-
Made minor change in the condition check for blog posts as the function returns bool.

Everett Zufelt’s picture

Project: Drupal core » Blog
Version: 7.8 » 8.x-2.x-dev
Component: blog.module » User interface

Feature requests are made against Drupal Core 8.x, since Blog is no longer part of Drupal Core I am moving this to the Blog module project queue.

spreethi’s picture

Status: Active » Needs review

Updating status to needs review in blog project.

Status: Needs review » Needs work

The last submitted patch, remove_users_blog_link_view_recent_blog_entries.patch, failed testing.

spreethi’s picture

Status: Needs work » Needs review
StatusFileSize
new753 bytes

Reattaching patch after cloning latest git project from Blog Module repository.

Status: Needs review » Needs work

The last submitted patch, remove_users_blog_view_recent_blog.patch, failed testing.

spreethi’s picture

Hi Everett,
I have a question on testbot results.
There were 6 failures reported twice on the same lines 188,191,192 (as shown below) and the issue is to remove the link when there are no posted blog entries for a user. So the test case will never work if it is assuming the link has to always be there.
$this->drupalGet('user/' . $user->uid);
$this->assertResponse(200);
$this->assertText(t('View recent blog entries'), t('View recent blog entries link was displayed'));

// Confirm the recent blog entries link goes to the user's blog page.
$this->clickLink('View recent blog entries');
$this->assertTitle(t("@name's blog | Drupal", array('@name' => format_username($user))), t('View recent blog entries link target was correct'));
So I am not sure how blog.test should be corrected to take care of this feature.
Thanks
Preethi

i.bajrai’s picture

Issue summary: View changes
uditrawat’s picture

#6 works for me, but instead applying that patch i implement that on my custom module.

mohitw’s picture

Title: remove users blog link "View recent blog entries" from user account page for users that havent posted any blog entires » Remove user's blog link "View recent blog entries" from user account page for users that have not posted any blog entries
nevergone’s picture

Status: Needs work » Closed (works as designed)

Outdated issue and works as designed.