Closed (outdated)
Project:
Organic Groups
Version:
6.x-2.1
Component:
og.module
Priority:
Normal
Category:
Bug report
Assigned:
Issue tags:
Reporter:
Created:
17 Mar 2009 at 16:30 UTC
Updated:
27 Oct 2024 at 14:10 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
moshe weitzman commentedTechnically, you make the View display context aware, not the more link. If you use the Argument 'Organic groups: Groups' you get context set for free. If you use a filter 'Organic groups: Groups' you also get context set for free. See og_views_handler_argument_og_group_nid.inc and og_views_handler_filter_og_group_nid.inc.
Please reopen if needed.
Comment #3
adam_b commentedI think I'm having the same issue here. I've used the Argument 'Organic groups: Groups' as suggested, and I've set % in the page URL.
However:
- if I don't use a filter, I get no argument in the page URL
- if I use the filter 'Organic groups: Groups' as suggested, then I get the argument "all"
I've tried this with a couple of different node types, and have run up against the same problem each time. I've attached the exported view definition - any help gratefully received.
Comment #4
clemens.tolboomMy solution in the end was adding a php value as the more link. With stuff like og_get_context() to build the link myself.
Maybe the problem lies in views module not being able to enrich the more link with context? I dunno :(
Hope this helps a little :(
Comment #5
adam_b commentedI think the PHP link should work but I've had problems with it in a similar situation (see #582890). Any chance you could post your PHP code here so I could try it?
I think there's a fundamental bug with the OG Views module when it comes to passing the context - which shouldn't be a problem, since it's just a normal node ID :(
Comment #6
clemens.tolboomWhile trying to find the code I could not remember the exact solution. Trouble was with anonymous users having no og context mixed with this more link. But it is long time ago :(
As in #1 Moshe suggest I think we solved it by adding OG Context for the receiving view.
But that does not solve the anonymous user though.
When needing more help you can try to contact me on IRC ;)
Comment #7
adam_b commentedI don't think the problem has been fixed - I'm not employing this for anonymous users, but I'm still not getting the context passed on correctly.
But I fixed my PHP problem thanks - just hadn't turned on the PHP input filter module. Doh!
Comment #8
johnhanley commentedI'm experiencing the same kind of contextual problem with Views.
I have a Views page (with a defined path of "node/%/list"), which produces a list of "standard group posts". The view includes a Relationship of "Organic groups: Group node (post)" with "Require this relationship" unchecked. The first (and only) Views argument is "Organic groups: Groups". The page works as expected and displays the desired results, but the group context (when viewing the page as group admin) is lost and the "details" block does not display like the other default pages provided by OG. In other words the "details" block comes and goes depending on the current tab selected.
I've been playing with this for several hours and am stumped. I'm not sure if this is an actual bug or just a configuration problem, but any advice would be greatly appreciated.
Comment #9
ashokc commentedHas this issue been resolved? I have a block generated by a view, and the block has a 'more' link enabled. The access to the view is controlled by Group Membership & Members only (via og_views_extra module). All group members are able to see the block, but when they click on 'more' link, they get access denied. In order to debug this, I placed some prints in the file 'og_views_extra.module' and saw that after ' $group = og_get_group_context();' is executed, the value for $group is NULL. Any suggestions? Thanks, I am a newbie.
Comment #10
jvieille commentedMore generally, the group context is lost when activating a Views.
I tried setting 'Organic groups: Groups' as argument, but this does not help.
Comment #11
jvieille commentedNot only for "Views block more links".
Comment #12
amitaibu@jvieille,
Please try using the new argument from #711354: Add a "current group" default argument handler
Comment #13
jvieille commentedThis did not help.
As soon as the view is activated, the group context is lost.
http://drupal.org/node/711354#comment-2645564
Comment #14
amitaibu@jvieille,
What is your View, and where does it appear -- as a block in a group node (where OG can find a context)?
Comment #15
jvieille commentedI use OG Vocab that features a block called "Group categories" that shows up when a group is selected, allowing a taxonomy browsing inside the group.
When clicking on a term from this block, it displays in the content area the corresponding nodes for the terms of the current OG group.
The way the nodes are listed does not match my needs (the classical term display in Drupal, offering title, teaser and breadcrump).
To customize the term node list display, I noticed that the default disabled "taxonomy_term" views was called if I enable it.
The problem when using the taxonomy_term View is that group context is lost after hitting a term (it is correctly kept when the Views is disabled)
Applying the argument as indicated on this Views does not change anything.
The code of the OG_Vocal block is the following
Thank you very much for taking care
Comment #16
amitaibuI think you are mixing something here. The code that is responsible for the group context in og_vocab is:
This means that is the path isn't exactly
taxonomy/term/foo-- then a context won't be set. Maybe the View you enabled changed that path.Comment #17
jvieille commentedThe View I am using is the standard (disabled by default) taxonomy_term view
By some magic, it is called by OG_Vocab when I enable it (as this allows me to display change the layout, which is my primary concern)
Its arguments are:
the View path is
taxonomy/term/%All this seems to match the OG_Vocab block requirements
What can be wrong?
Thanks
Comment #18
jvieille commentedNo clue?
Why could the coded taxononmy display work with OG Vocab, but not the emulating view (which works for other purposes)
Thanks
Comment #19
jvieille commentedI think I am missing something.
I tried to create a view from scratch.
I only succeeded keeping the OG context by submitting explicitly the group node ID as an argument matching the current context, using the argument Organic groups: Groups
Whatever I do, the context is lost as son as the (page) view is displayed.
I tried the diffferent arguments and filters, with and without default settings as suggested, nothing works.
Comment #21
jvieille commented+1 - this is no way solved
I really have no idea what to do.
This might be specific to OG Vocab as the View is called by the OG Vocab block.
Comment #22
nbluto commentedThank you Moshe, this worked for me. I passed an argument to my target view (where my "more" link points to) that is group-group with a default argument of Node ID from URL and a validator as basic.
The Block display is also set with an argument of group-group with a default argument of NID from URL with a validator of Group Nodes and argument type NID with Action to take if argument does not validate as Display all values.
This works. I have my block view and when I click on the more link, I can see my page view and it passes the NID and stays in group context with all blocks displaying that belong to the group.
Thanks.
Comment #23
jvieille commentedI found a solution in the case of OG Vocab Group Category block
http://drupal.org/node/763308
Still the issue seems not solved for me because it seems that the context can only be captured and kept by a view if the group nid is in the url that calls the view.
Any OG group "default argument" setting is ineffective without this primary condition, while almost any setting works when the url explicitly hods the group node id.
Comment #24
Rosamunda commentedI´ve got a block that I want it to be shown inside each group, or group page.
It works, but not when the viewed page is created by a view (it does work in node view/edit pages).
I´m using this code inside "Show if the PHP code is true":
The page created by views is
og/polls/%.I just don´t know why this code doesn´t work with pages created by views that got the context actually...
Inside my view, I´ve got:
Any ideas?
Thanks!!
Rosamunda
Comment #25
maarudth commentedi found a solution to the situation where a page created by a view loses context.
in my case the context was not totaly lost - just the theme...
solution:
in og.module
line 565:
function og_determine_context() {
at the end of the if, eleif
chain added
else{
$node = node_load(arg(1));
}
that solved it for me.
anyone with more expirience in these matters - please confirm or condem this solution...
Comment #26
protoplasm commentedI've tried og relationships, arguments, and filters to solve this problem, but context does not seem to be passed. Also #25 did not work as well.
I don't think it is just a taxonomy term issue. I've tried using search as well and the page generated from either an exposed block page or a regular block in the context of a group only pulls the wildcard 'all' or '*' and gives nothing group specific. I even tried using a fixed entry with the group id as the argument. Still no luck. I've just started to look into this issue to develop a new feature so if anyone has found a solution, it would be very helpful.
Thanks.
Comment #27
protoplasm commentedApparently, the solution is related to the path of the page. In my case, I had to use % like this
http://xxxxx.com/xxxxxx/%/content/xxxxxxxalong with an organic groups argument and relationship. Everything has to be just right or it doesn't work. Got this to finally work with both taxonomy and search.Comment #28
pelicani commented#25 worked
our views are now displaying in the correct og context.
we pass an argument as a group - group and it is rendered in the group theme
but I'm confused...
did I build my view wrong so I need this hack?
or
can we put the modification committed to og.module?
peace,
michael
Comment #29
jvieille commentedAs I put in #23, there is no way for Views - as it is currently - to get context "automagically".
Any default argument setting does not work, the only way is to explicitly pass the group in the argument.
If #25 allows this (calling a view from a group context without passing the group in argument and not leaving this context), this is a great, welcome feature. I have no chance to test this right now, but I am still interested.
Comment #30
Grayside commentedThis issue could use a patch with a test, or at least a testing summary.
Comment #31
maarudth commentedi think the only reason the solution in #25 would not work is if the nid in the page url is not arg -1.
the solution would be to look for the numeric arg...
Comment #32
jody lynnThe hack in #25 is not at all recommended. This could incorrectly set a group context on a non node page. For example if you visit /user/6 it will set the group context for that user to that of node 6.
The problem is that it's too late to set the group context within the views argument handler with respect to setting a custom theme. I'm using a custom hook_init implementation like:
where I have a view at /foopath/% with an og argument.
Comment #33
lirantal commentedPlease see this patch which adds another method of detecting group context based on the url, much like prior attempts in the function call and there's no risk of loading a different group as mentioned by Jody since it uses since the loaded node is passed to og_determine_context_get_group() which checks this is indeed a group node type.
Comment #34
lirantal commentedActually, here's a fix to the former patch which is a safer method of just getting correctly the url segment.
Comment #35
lirantal commentedUgh, and now with a version that is actually viewable via drupal (no idea why no url encoding is taking place here for links...)
Comment #36
Grayside commentedComment #37
antarchi commented#27 worked for me, THANKS protoplasm!
Comment #38
soulfroys#1 worked for me! Thanks @Moshe!
Comment #39
Grayside commented@#35, The menu_get_object() function will include the node object if it is set via the path.
Working on the logic in
should help expand it's usage to cover the case you are trying for.
Comment #40
lahode commentedHi,
I'm not sure it's the purpose of this thread, but for info, I found a completely other way to have the group argument retrieved
I added to the view 2 relationships:
Then I added a "(OG group) OG group: Entity id" contextual filted and using the simple module http://drupal.org/project/views_arg_context, I configured "Provide default value: Type->Active Context / Namespace -> node / Attribute -> nid"
Finally I created a standard context on my group and that's all.
Hope it helps somebody
Comment #41
jvieille commented1) What do you mean by a "standard context "
2) I don't find "OG membership: OG membership from Node" nor "OG membership: OG group gid", only
"Organic groups: Group node (member)" and "Organic groups: Group node (post)"
Please clarify.
Thanks
Comment #42
lahode commentedSorry, I happened to see only now that it was a D6 post... ok forget about, my solution is for D7
Comment #43
wcDogg commentedI’m trying to solve this same issue. I know nothing about code. Looking around in the “native” OG Views, I tried stealing the argument in og_files. I’m part of the way there, but need a little more help. Here’s what I’ve got so far …
Default View > Arguments > Organic Groups: Groups
Default View > Filters
Block View > More Link = Yes (silly, but I note everything)
Page View > Path = group/%
This gives me a working More link – the Page View returns a list of nodes for the correct Group.
Since I’m no coder, I have no idea why this works – only that I felt safe using the PHP because it came with OG.
Some things I’m wondering about that may or may not belong here, but would appreciate knowing:
If you’re kind enough to answer any of these, for the love of Pete, please be specific because I’m slow on the uptake :)
Thanks in advance - Lisa
Comment #44
claudiu.cristeaThis version of Drupal is not supported anymore. If this is still an issue in the
8.x-1.xbranch, please open a new up-to-date ticket. Closing.