Closed (fixed)
Project:
OG User Roles
Version:
5.x-2.7
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
21 Nov 2007 at 17:46 UTC
Updated:
24 Jan 2008 at 20:31 UTC
Jump to comment: Most recent file
The og_user_roles_gid_from_tid function should return 0 when called as otherwise a node_load error occurs when viewing a forum page.
Simply adding "return 0;" to the code fixes this problem.
function og_user_roles_gid_from_tid($tid = 0) {
// Modification as per: http://drupal.org/node/172923
if (module_exists('og_forum')) {
$sql = "SELECT nid FROM {og_term} WHERE tid = %d";
$gid = db_result(db_query($sql, $tid));
return $gid;
}
return 0;
}I'd produce a patch file, but this really doesn't need it.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | og_user_roles.module.5.x-2.7.patch | 3.52 KB | somebodysysop |
| #1 | og_user_roles.module.5.x-2.7.patch | 2.31 KB | somebodysysop |
Comments
Comment #1
somebodysysop commentedThanks for the note.
There is another small change necessitated by this change. Here is a patch. See if it resolves the issue for you without creating another one.
Apply this patch against clean download of OGR 5.x-2.6 release.
Also, note that this patch also contains this modification: http://drupal.org/node/192747
Comment #2
Crimson commentedThis seems like it's the same problem and the patch doesn't fix the problem because I do have og_forum installed. It's a little odd.
Here's my backtrace for the error. It all stems from the same problem, node_load having no arguments.
If you need anything else, just ask.
Edit: Backtrace file removed, not needed anymore.
Comment #3
Crimson commentedSome more follow up to my problem. And a solution.
I have some forums that aren't group forums and they are isolated by themselves so they aren't in the og_term table that the function og_user_roles_gid_from_tid looks for.
So all I have done is make the return a little smarter to handle situations like this. I don't know if return 0 is the smartest thing. Shouldn't we skip the node_load and the subsequent variable $custom_theme if it's 0 anyways?
Anyways, here's what I did to og_user_roles_gid_from_tid
This will also take care of the problem of not having og_forum installed too.
Edit:
Alright, I've taken it upon myself to tell it not to node_load if $gid is 0. So here's the code for that.
Comment #4
somebodysysop commentedThank you for this code! It resolved this issue for me: http://drupal.org/node/199983
Patch is attached. Please apply to clean download of OGR Release 2.6.
Again, thanks!
Comment #5
somebodysysop commentedPatch code now included in latest OGR release.
Comment #6
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.