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?
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | og-set-group-context-2.patch | 1.47 KB | marcp |
| #5 | og-set-group-context.patch | 968 bytes | marcp |
Comments
Comment #1
geerlingguy commentedCould 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...
Comment #2
marcp commentedTo 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
Comment #3
marcp commentedAs 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 callsog_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 exposeog_set_group_context()to other modules but not let it really set everything related to the group's context (ie.og_set_theme()andog_set_language(), which are both called in <code>og_init()).Comment #4
geerlingguy commentedI second #3 above :)
Comment #5
marcp commentedI 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()andog_set_language()calls fromog_init()intoog_set_group_context(). It only calls these functions whenog_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.
Comment #6
marcp commented@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.
Comment #7
geerlingguy commentedI 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
Comment #8
amitaibu@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.
Comment #9
marcp commented@Amitaibu - Let me know if this works -- it's hard to come up with good language for this! Also, I removed the TODOL comment.
Comment #10
geerlingguy commentedJust patched the latest OG release, and it works great.
Comment #11
amitaibuLooks good.
Comment #12
geerlingguy commentedHmm... 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
Comment #13
marcp commentedJust want to make sure this stays on the radar and gets committed before the next release.
Comment #14
amitaibucommitted, thanks.
Comment #15
amitaibuYikes, some CVS connection errors, I'll try again soon, if not I'll commit via my office computer.
Comment #16
amitaibuFixed, for real :)
Comment #18
muschpusch commentedHey 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????
Comment #19
magpie5212 commentedI can't seem to get this to work either.
Comment #20
marcp commented@muschpusch and @magpie5212 - #720160: How to set Group Context in Views? is a better issue for help in setting group context.