Problem/Motivation

After I applied this patch menu block is correctly shown on both group page and pages of nodes (of a specific bundle) related to the group.
I placed this block on the sidebar first region of my theme. So far so good.

But at this stage the block will be loaded on any page of my website where I have the sidebar first region. Obviously the block is "empty", there is no menu inside. This because, to make the block correctly working on any group page, I needed to leave empty "visibility" configuration. I don't know if I'm doing something wrong with this module...

Steps to reproduce

- install module
- create a group menu type and enable it on the group you need
- create a menu content and add two links: one that linking the group page and the other one linking a node created in that group
- place the group menu type block on a region, selecting the value "Group from URL"; do not configure visibility
- look at the group page: the menu block should be correctly shown. Click on the other link: the menu block should be correctly show too.
- look at any other page that prints that region and you should see the block rendered inside of it but with no menu loaded.

Proposed resolution

Add a `blockAccess` protected function in the `GroupMenuBlock` class, allowing results only if the `menu instance` is !== NULL. Or something like that.

Remaining tasks

n/a

User interface changes

n/a

API changes

n/a

Data model changes

n/a

Comments

g0blin79 created an issue. See original summary.

g0blin79’s picture

This simple patch works for me.

As proposed I added a simple blockAccess logic.

g0blin79’s picture

StatusFileSize
new1.09 KB

Sorry I made a mistake...this is the right patch.

heddn’s picture

Status: Active » Closed (duplicate)

This seems like a regression to #3170013: Group Menu not visible on Node pages that should be fixed over there. Closing duplicate.

chrissnyder’s picture

Category: Feature request » Bug report
Status: Closed (duplicate) » Needs review
StatusFileSize
new709 bytes

I ran into a very similar issue. It seems like the block renders even if there is no group menu to display. The attached patch corrects the issue by returning an empty array as documented in the block API if we are not able to determine which menu to display.

  • heddn committed f168bc6 on 8.x-1.x authored by chrissnyder
    Issue #3178459 by g0blin79, chrissnyder, heddn: Group content menu block...
heddn’s picture

Status: Needs review » Fixed

Thanks for your contributions and good explanation of what is happening.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.