When the "Recent content" block is placed on the page (e.g. in the footer or in a side column), the block shows empty squares where users with the permissions to modify the content would see "edit" and "delete" links. See attached screenshot for an example.

Those squares are useless for anonymous users (and all users that don't have the according permissions) and look confusing. They also take up some important space.

It would be nice if the squares that are supposed to hold the links would not be shown for users that cannot act on the content (other than by viewing it).

Comments

tsi’s picture

Project: Dartik » Drupal core
Version: 7.x-1.1 » 8.x-dev
Component: User interface » node.module

Thanks for reporting, but this is not a Dartik's issue, the same will happen with Bartik or any other theme.
This is caused by theme_node_recent_block (from core's node.module) that outputs a table without checking if the cells have content in them.
I would argue that using a table is wrong for this list but that is a different story.

drupal_was_my_past’s picture

Priority: Normal » Minor
Status: Active » Needs review
StatusFileSize
new1.08 KB

Created a patch that only renders edit and delete cells if the user has the appropriate access.

pooja.sarvaiye’s picture

Status: Needs review » Reviewed & tested by the community

The patch code complies with Drupal coding standards.
The patch solves the issue by not showing the edit and delete cells, in case a user does not have permission to edit and delete.

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed. Thanks!

dries’s picture

Version: 8.x-dev » 7.x-dev
Status: Fixed » Patch (to be ported)

Moving to D7, actually.

avr’s picture

Status: Patch (to be ported) » Needs review
Issue tags: +Needs backport to D7
StatusFileSize
new1.06 KB

Rerolled for Drupal 7.

dcam’s picture

#6: drupal-1245446-6.patch queued for re-testing.

dcam’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new3.77 KB
new4.77 KB

I tested #6. It works to correct the issue described in the OP. Before and after screenshots are attached.

Before:

before.png

After:

after.png

Marking this as RTBC.

David_Rothstein’s picture

Title: The "recent content" section show useless empty squares for anonymous users » The "recent content" block show useless empty squares for non-administrative users
Version: 7.x-dev » 8.x-dev
Status: Reviewed & tested by the community » Needs work
StatusFileSize
new5.3 KB
new5.33 KB

This will actually make things worse in the case of a user who e.g. has permission to edit some content types but not others (see screenshots).

I think we need to add some 'colspan' logic here to fix it correctly?

Before patch:

recent-content-before.png

After patch:

recent-content-after.png

David_Rothstein’s picture

Priority: Minor » Normal
xjm’s picture

Component: node.module » node system
Issue summary: View changes

(Merging "node system" and "node.module" components for 8.x; disregard.)

dawehner’s picture

Version: 8.x-dev » 7.x-dev

Not a topic for d8 anymore given that it will be a view.

mimes’s picture

I'd agree with David_Rothstein. After testing, the patch does work for Drupal 7 in that it will hide unnecessary empty squares for anonymous users and those without permission to edit/delete content, but it also causes unsightly, irregular areas in the table if a user has permission to edit/delete some things but not others.
It would be nice if rows spanned the entire table/multiple columns with colspan.

  • Dries committed 609cdb8 on 8.3.x
    - Patch #1245446 by rocket_nova: the 'recent content' section show...

  • Dries committed 609cdb8 on 8.3.x
    - Patch #1245446 by rocket_nova: the 'recent content' section show...
aerozeppelin’s picture

Status: Needs work » Needs review
StatusFileSize
new1.61 KB
new2.18 KB
new3 KB

Updates to patch as per #13.

The last submitted patch, 16: test-only-fail-1245446-16.patch, failed testing.

  • Dries committed 609cdb8 on 8.4.x
    - Patch #1245446 by rocket_nova: the 'recent content' section show...

  • Dries committed 609cdb8 on 8.4.x
    - Patch #1245446 by rocket_nova: the 'recent content' section show...

  • Dries committed 609cdb8 on 9.1.x
    - Patch #1245446 by rocket_nova: the 'recent content' section show...

Status: Needs review » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.