Closed (works as designed)
Project:
Organic Groups
Version:
master
Component:
og.module
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
29 May 2006 at 19:09 UTC
Updated:
1 Sep 2009 at 17:50 UTC
Jump to comment: Most recent file
Comments
Comment #1
gerhard killesreiter commentedfixing title
Comment #2
moshe weitzman commentedi need to give a way for modules to propose url schemes which should preserve url context. currently, this is hardcoded into og_theme()
Comment #3
moshe weitzman commentedthe view url is arbitrarily decided by the admin. any idea how og should determine the group context?
Comment #4
moshe weitzman commentedI could do some trick like set the group context based on the argument og nid in the view. until then, use an url for your view that looks like og/view// where x is the group nid. this url automatically gets proper context.
Comment #5
bejam commentedThat sounds like a pretty good Idea, I am using a fair number of views with ognid arg. Would be great to ensure context is kept current.
Comment #6
somebodysysop commentedCreated view. Used this url: og/view
View takes two arguments: 1 = group node id, 2 = node type
http://www.mysite.com/og/view/72 - takes me correctly to group 72 node.
http://www.mysite.com/og/view/72/event - returns me to group 72 node. I want it to take me to the view that lists node type: event for this group.
What am I doing wrong? Or, is there some way to modify og so that it will recognize the 2nd url format?
Comment #7
somebodysysop commentedIf this helps, I found the reason why og/view/72/page simply returns me to the group home page.
In og.module, function og_menu($may_cache), there is this code:
Any simple mod that will give me context, and thus group navigation menus, on any og/view/gid/whatever url?
Comment #8
nevets commentedHere is an expermental module that may help. This is a beta version and I am still testing but it seems to work and may help with views (I will be creating a project for this later). Create a file called og_tracker.module in a directory called og_tracker under the module directory and paste the code in below. After saving the file enable the og_tracker module.
How it works: It works simply by monitoring views of pages that are set as og groups and recording the information in a session variable and then on each page view using the session variable to set the last og group visited/seen.
Comment #9
moshe weitzman commentedthe second argument in your view should be node type.
Comment #10
somebodysysop commentedThanks a lot!
Anything I need to set in views or elsewhere?
Hope this does the trick!
Comment #11
somebodysysop commented"the second argument in your view should be node type."
My second argument *is* the node type:
http://www.mysite.com/og/view/72/event
This returns me to the node home page. I suspect it's because the og.module code is designed to redirect automatically.
Comment #12
moshe weitzman commentedthe word "Argument" has a particular meaning in Views and i'm not sure you are understanding it that way
Comment #13
somebodysysop commentedSeems like this would be sooooo much easier if you would simply show me what you mean. My understanding is that if I create a view with arguments and set the url to "og/views", then the arguments are passed along to the view as follows:
og/views/argument#1/argument#2
This is what I'm doing:
og/views/72/event
where: "72" = group node id (argument #1) and "event" = node type (argument #2)
What am I missing here?
Comment #14
somebodysysop commentedTo follow up on og_tracker, it appears to work as advertised. It keeps the context of the last group visited until you enter another group. Not sure right now what the ramifications of that are, but it sure solves two issues I had:
1. How to keep context in views, and;
2. How to keep context when you click on the following from og_forum Forum Page:
My discussions.
Active discussions.
Post new forum topic.
Bravo and thanks nevets!
Comment #15
moshe weitzman commentedi don't see an active todo here. reopen with some detaul if needed.
Comment #16
regx commentedog_tracker works great. I have added 2 patches to it so any form with group context automatically sets the group check box and collapses the group selection as well as a patch that automatically disables the module if og gets disabled. I would love to post my patches, but it looks like og_tracker does not have a project yet. Will og_tracker get a project page soon?
For now, I am attaching the entire module.
Comment #17
moshe weitzman commentedthe head and 5.0 versions of og have lots of views, including a tracker. you can see it at http://groups.drupal.org/tracker. what does this module do that can't be achieved with Views. note that i haven't inspected it closely. i'm hoping someone can save that step for me.
Comment #18
somebodysysop commentedIs the version of og_tracker just uploaded running on Drupal 5.x currently?
Comment #19
spyderpie commentedI need this functionality too, in Drupal 5. Unless there is another way to create a view for things like forums, or albums, or blogs, from only the group you are currently in.
I tried the attached module ... it does not work in Drupal 5.
spyderpie
Comment #20
jonhattanI've made the 'og_tracker' to work with drupal5 by just adding the .info file. I've renamed it to 'og_context_tracker' in order to make it's name less confusing than just 'tracker' that is not related at all with tracker module. I think it was a confusion for moshe on comment #17.
I've tested it on a calendar view[1] with "OG: posts in current group" filter in order to get a per group calendar view.
Without the context tracking, it shows the correct calendar on homepage but when clicking on next month, it looses the context and the view has no data(no events are shown). With og_context_tracker the view does still work when going outside the group page.
I think that promoting this module is not the way to go, but somehow integrating it in OG.
I've changed the status to active.
the form complains about .gz is not a valid attachment :/
You can get it at: http://faita.net/~jonhattan/og_context_tracker.tar.gz
[1] http://drupal.org/project/calendar
Comment #21
moshe weitzman commentedthat module looks extremely hackish. there is an $_SESSION[og_last'] already that keeps last group visited. anyway, this issue is now too dense to follow. i'm glad folks have found a context module that does something thats desired. closing.
Comment #22
leanazulyoro commentedHello, is there a proyect for this module? i'm quite interested in it, i would be very useful. it is useful now but it has it's limitations, i use it in order to have group's calendar with the calendar module, not the events module. but once a user enters a group, there is no aparent way but to logout or enter another group in order to actually get out of the group.
how can i unset group context? at least when i go back to the site frontpage. is the any function "unset_group_context()" or something like that?
Comment #23
gracearoha commentedi have the same question. when a user goes out of one group and into another or into the "public" section of the site and tries to add new content, the group audience box of the last group they visited is checked by default.
Also, i wonder is this module still working with og 5.5?
Comment #24
somebodysysop commentedI used the 4.7 version of og_tracker extensively. The biggest problem was always this. I found that using the OG $_SESSION[og_last'] http://drupal.org/comment/reply/66145/689630#comment-412173 is much easier and more reliable in the end. And, it's already built into OG.
I use it as sort of a last resort in my code for obtaining the current group context. When I'm sure of what the current group context is, I even set it so that it will always accurately reflect the last group visited.
Comment #25
leanazulyoro commentedi'd apretiate a little axplanation on how to implement that $_SESSION[og_last']. where should i put that? somewhre during the creation of the view? how did you used it?
Comment #26
somebodysysop commented$_SESSION[og_last'] is a session cookie. It is set by og module (and, you can set it yourself). It's purpose is to hold OG group information about either the current group you are in, or the last group visited. If you're module is trying to determine group context, but og_get_group_context() doesn't return anything, then you should see if anything is in $_SESSION[og_last']. That simple.
It does NOT set the group context itself. That's what the og_tracker.module does. But, as we've seen, always maintaining the group context of the last group visited can cause it's own problems.
This is only useful to you if you are writing your own module and needing to make sure you always have group context. If you are looking for a solution as an end-user of always maintaining group context, then og_tracker would be the choice.
I suggest looking at the OG module (og.module) to see how it's set: http://drupal.org/project/og. Next, look at my implementation of it in the OG User Roles module (og_user_roles.module): http://drupal.org/project/og_user_roles
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/og/og.modul...
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/og_user_rol...
Comment #27
leanazulyoro commentedso if i understand well, then we could use the function og_set_group_context passing as argument $_SESSION['og_last'] and that would set the context of the last visited group, am i right?
$group = $_SESSION['og_last'];
og_set_group_context($group);
something like that, don't know if the sintax is fine, but i hope i make mi point.
anyway if we could somehow do this (which i think is factible), we would get the last visited group context, but how can we pass it to the view?
Comment #28
somebodysysop commentedYour syntax is incorrect, but your logic is right.
How do you pass it to the view? Here's where it gets a little complicated. Generally speaking, in my "Arguments" section for the view, I use the OG:group nid argument with arg(1)
Assuming you don't have the gid available as arg(1) in your url, you would have to get it from either the group context (og_get_group_context()) or og_last session code, as discussed earlier, and pass it to the view. So, your argument handling code would be something like (I've never tried doing it this way):
Not sure if that should be $args[0] or $args[1], but hopefully you get the general approach.
Comment #29
leanazulyoro commentedhave you achived anything with this? i've tried (with my limited php skills) but had no luck.
the argument doesn't seem to pass, and even if it passes, is that gonna be enought for the context to be manteined?
i think that once in the page the function og_set_group_context should be called in order to re-set the group context.
Comment #30
leanazulyoro commentedActually, the $_SESSION['og_last'] doesn't seem to return any information about the last group, i desided to confirm that so i printed out this in the "header" (from the vies edit form) of the page (with php as the input format of course ):
this should print out the group nid and the title, am i right?, but it doesn't.
Comment #31
leanazulyoro commentedYou know what? i made it!!
i wrote as the url: $group/calendar and added a "Og: Group nid(s)" argument at the top of the argument list, above the calendar arguments, (of course, i changed de default to "display all values").
and that's it, we don't even need the "og: posted in current group" filter since the argument "Og: Group nid(s)" filters the content as well. no code for arguments, no function to set the context, no og_context_tracker.
the only cons i found, is that the roles defined by the module "og_user_roles" are lost, i know that because i used them to display the calendar block (among others): i gave the visibility of that block to a role asigned as the default for all groups subscribers (members), and when i go to the calendar, that block is hidden, so i think that's the reason (you may check a little more, maybe it's another thing).
Comment #32
leanazulyoro commentedunfortunably, as i test it, i find lots of bugs:
-the page that displays the month doesn't disply the fields i told to show in the view (title and date)
-the breadcrum gets messed up: the view name (calendar) duplicates and its links doesn't replace the $group for the desired argument.
-Now, i see some of the blocks i didn't see before, for example the calendar block.
:(
Comment #33
najibx commentedHi,
Refering to View's handbook, http://drupal.org/node/54455
I can use similar AND OR if I want to consider multiple og groups.
http://site.com/my_og_view/4,5,6 = nodes with OG: Group nid(s) 4, 5, AND 6
http://site.com/my_og_view/4+5+6 = nodes with OG: Group nid(s) 4, 5, OR 6
But in this case I want to use OG: Group name. So using argument handling code trick (for taxonomy) in that handbook will not work for OG.
how can we apply the same? TQ
Comment #34
andrenoronha commentedhow can I get the group context from within a og forum topic node?
my idea is to check if the current user is the group admin from whithin a group forum topic.
Comment #35
andrenoronha commentedi have got what i wanted. thanks