I'm guessing this is something to do with my environment but I've been unable to pin it down. I'm hoping for some clues. I'm using the og multiple block and it works perfectly except that it disappears to anonymous users. The block itself has no visibility limits placed on it and the block shows to all authenticated users whether in the group or not. Any suggestions as to what I might have missed?

Comments

presleyd created an issue. See original summary.

presleyd’s picture

This only seems to happen with OG 2.8. My sites on 2.7 do not have this issue and rolling back to 2.7 solved the problem on the affected ones.

However, testing on a clean site on simpletest.me does not have this issue so it's still a combination of things causing the problem.

rv0’s picture

hm I haven't upgraded to the new 2.8 yet. Seems some architectural changes were made to context handling, where og_menu relies on heavily.
Will have to test.

presleyd’s picture

I'd be happy to test it again whenever you get a chance to look. I'll just stay with OG 2.7 for now.

presleyd’s picture

Now that OG has a security update to 2.9, I'm concerned about not being able to update. Granted, the security update doesn't really affect my setup but the warning that I'm missing a security update drives me nuts!

The OG Menu: single and OG menu: double blocks do not appear for anonymous users but both appear fine for authenticated users. It appears that og_context returns nothing for anonymous users.

og_context has changed so that it now has 4 parameters

/**
 * Get or set group context using the menu system.
 *
 * @param $group_type
 *   The context to get by group type. Defaults to "node".
 * @param $group
 *   Optional; The group entity to set as the context.
 * @param $account
 *   Optional; The user entity we are getting context for. If empty, defaults
 *   to current user.
 * @param bool $check_access
 *   Determines if access to the group should be done. Defaults to TRUE.

If I set line 235 of og_menu.module to be

$context = og_context('node',NULL,NULL,FALSE);

Then the og_menus reappear on my pages, however they don't show up on views where I've set a php header that defines the context. When I dpm the og_context function it seems that something else is calling it and removing the context for that views page but I haven't backtraced it yet.

I could create a patch for this but this doesn't seem like a great solution.

rv0’s picture

Thanks for this feedback. I've been allocated some time to work on this. A fix will come soon.

rv0’s picture

Version: 7.x-3.0 » 7.x-3.x-dev
Component: Documentation » Miscellaneous
Status: Active » Postponed (maintainer needs more info)

I've not been able to reproduce this problem. In fact the latest dev seems to work just fine with OG 2.9 for me.
Yes, of course it will work if you ignore the access checks (the FALSE in og_context you posted above). However that's not a solution and doesn't touch the foundation of the problem..
I think you have a config issue in your project, not really related to OG Menu.

- check if you have added any permission/access specific fields on admin/config/group/fields
- check if context handling is configured ok on admin/config/group/context
- are you using the "Organic groups access control" module?

presleyd’s picture

Indeed, I didn't suggest that it would be the correct solution. It does speak to the fact that access checks are causing the disappearance though.

Field permissions is enabled but there are no permissions set on the og ref or og_content fields.
Context handling is configured for node, comment, and URL (content create)
OG access is enabled. I disabled it but it did not fix the problem.

I appreciate the suggestions. I'll try disabling other modules and see if I can find more and post it here.

presleyd’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

Content access was to blame. We had it setup to not allow the group content types to be seen by anonymous users. (We override the group page using Panels and make it into a dashboard for managing group content). However, I can see how you can't determine context when you don't have access to the content that the og_ref field points to... We'll have to rethink how we do this.

Thanks for taking the time to look at it.

presleyd’s picture

FYI for anyone else who comes looking for this. I can't think of a problem with turning off access check for og_context here. It is just running on hook_block_view and I want anonymous users to view the menu but NOT the group node itself. So I changed line 248:
from

$context = og_context();

to

$context = og_context('node',NULL,NULL,FALSE);
scotwith1t’s picture

We had a similar thing but it turned out it was just because the group in question was unpublished :)