From another issue, I discovered using og_set_group_context() in the header of a View to set the context for a View to get the blocks, etc, for the proper group. But this isn't affecting the theme that is set for the group. Maybe it is too late in the process of loading the page for that? Is there a way around this?

Comments

geerlingguy’s picture

Category: support » bug

Could you possibly post how you get the blocks, at least, to show, using og_set_group_context() in the header? I'm trying to do this over at #720160: How to set Group Context in Views?.

I think that, if the theme isn't changing, but the blocks appear, this might actually be a bug report...

marcp’s picture

Title: set group context for View page theme » Group theme doesn't display Views that take group as argument
Version: 6.x-2.0 » 6.x-2.x-dev

To reproduce:

1. Install D6.16, CCK, Views, CTools
2. Enable Marvin theme
3. Create group content type and group post content type
4. Create a group
5. Set the group's theme to Marvin
6. Visit the group node - you see the Marvin theme
7. Visit og/users/GID where GID is the nid of the group node that you created - now you've got the Garland theme

marcp’s picture

Title: Group theme doesn't display Views that take group as argument » Group theme doesn't display on Views that take group as argument

As mentioned above, the default view og/users/GID that comes with og_views doesn't display the group's custom theme.

The underlying problem is that og_set_theme() doesn't ever get called in og_init() and og_views_handler_argument_og_uid_nid::query() only calls og_set_group_context().

I think the right way to fix this is for og_set_group_context() to set the group theme. I can't think of a good reason why we'd expose og_set_group_context() to other modules but not let it really set everything related to the group's context (ie. og_set_theme() and og_set_language(), which are both called in <code>og_init()).

geerlingguy’s picture

I second #3 above :)

marcp’s picture

Component: Og Views » og.module
Status: Active » Needs review
StatusFileSize
new968 bytes

I switched the component from OG Views to og.module because this is an issue that's fundamental to OG itself, and that's also where the attached patch applies.

The patch moves the og_set_theme() and og_set_language() calls from og_init() into og_set_group_context(). It only calls these functions when og_set_group_context() is called with an actual group node.

The result of this patch means that OG comes closer to doing what users or add-on modules would expect it to do in regards to setting context.

marcp’s picture

@geerlingguy and @drm - if either or both of you would test the patch we'd come closer to being able to mark this RTBC.

@amitaibu - is this issue on your radar? One of the duplicate issues was marked as critical. I didn't want to do that here, but this is base OG functionality that ought to work out-of-the-box. Right now, groups with custom themes have broken look-and-feel on some of their pages.

geerlingguy’s picture

I was planning on testing today, but will have to wait until tomorrow or Thursday, but I'll test on a few views that are in limbo right now :-D

amitaibu’s picture

Status: Needs review » Needs work

@marcp,

Patch looks good. Can you please add some comments in the PHPdocs of og_set_group_context() to explain the theme/ language are set as-well.

marcp’s picture

Status: Needs work » Needs review
StatusFileSize
new1.47 KB

@Amitaibu - Let me know if this works -- it's hard to come up with good language for this! Also, I removed the TODOL comment.

geerlingguy’s picture

Just patched the latest OG release, and it works great.

amitaibu’s picture

Status: Needs review » Reviewed & tested by the community

Looks good.

geerlingguy’s picture

Hmm... just noticed one other problem, though...

The group breadcrumb is not set to Home > [GROUP NAME] > [ETC] using set_group_context.

See: http://archstl.org/giving/online

marcp’s picture

Just want to make sure this stays on the radar and gets committed before the next release.

amitaibu’s picture

Title: Group theme doesn't display on Views that take group as argument » og_set_group_context() set group theme and language
Status: Reviewed & tested by the community » Fixed

committed, thanks.

amitaibu’s picture

Status: Fixed » Reviewed & tested by the community

Yikes, some CVS connection errors, I'll try again soon, if not I'll commit via my office computer.

amitaibu’s picture

Status: Reviewed & tested by the community » Fixed

Fixed, for real :)

Status: Fixed » Closed (fixed)

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

muschpusch’s picture

Hey i tried the above patch on 2.1 & downloaded the 6.x-dev both without results. I implemented og_set_group_context() in the header in views UI (php input type) and i tried hook_views_pre_render() What am i doing wrong????

magpie5212’s picture

I can't seem to get this to work either.

marcp’s picture

@muschpusch and @magpie5212 - #720160: How to set Group Context in Views? is a better issue for help in setting group context.