Closed (fixed)
Project:
OG Forum
Version:
5.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
3 May 2007 at 16:24 UTC
Updated:
9 Jul 2007 at 19:02 UTC
makes links in the forum default to the "standard" format using ?gids[]=$gid
this automatically checks the audience select box to be part of that forum
also I removed the "Post a message to the forums" link when viewing the forums listing, I thought it was a better idea to first choose the forum you want to post it them click the link to post
...
function theme_og_forum_display($forums, $topics, $parents, $tid, $sortby, $forum_per_page) {
...
.
.
if (count($forums) || count($parents)) {
$output = '<div id="forum">';
$output .= '<ul>';
if (user_access('create forum topics') && !in_array($tid, variable_get('forum_containers', array())) && ($tid != 0)) {
og_forum_set_og_group_context_from_tid($tid);
- $output .= '<li>'. l(t('Post new forum topic.'), "node/add/forum/$tid") .'</li>';
+ //start
+ $gid = og_forum_gid_from_tid($tid);
+ //group forum link with group selected
+ if(!empty($gid)){
+ $output .= '<li>'. l(t('Post new forum topic.'), "node/add/forum/$tid", array() , "gids[]=$gid") .'</li>';
+ }
+ //normal forum
+ else {
+ $output .= '<li>'. l(t('Post new forum topic.'), "node/add/forum/$tid") .'</li>';
+ }
}
else if (user_access('create forum topics')) {
- $output .= '<li>'. l(t(
+ $output .= '<li>'. t('Select a forum below.') .'</li>';
+ //end code changes
}
else if ($user->uid) {
$output .= '<li>'. t('You are not allowed to post a new forum topic.') .'</li>';
}
else {
$output .= '<li>'. t('<a href="@login">Login</a> to post a new forum topic.', array('@login' => url('user/login', drupal_get_destination()))) .'</li>';
}
Comments
Comment #1
khorby commentedThis is an excellent idea! Will this be included in the next module update? I don't know where to copy the coding to, and I do want to try this out!
Comment #2
rconstantine commentedI added your patch. My original already had done the second part of what you did, so I just added the part for the path fix that you did.
Comment #3
rconstantine commentedI spoke too soon. The change breaks the drop down selector. I'll look at this a bit more, but it might not make it in.
Comment #4
rconstantine commented@markDrupal
I went ahead and uploaded with the change included but commented out in case you'd like to play with it.
The issue is that with the fix, the next page becomes: http://localhost/node/ognodeadd?type=forum&gids[]=55
whereas before it was: http://localhost/node/add/forum/70
So things that are checking for arg(1), arg(2) and arg(3) are no longer happy - primarily the hook_db_rewrite_sql. I'm not sure what other functionality might get screwed up if we change hook_db_rewrite_sql. Maybe everything would be fine. However, hook_db_rewrite_sql needs to accommodate both regular and group forums, so do you want to use a gigantic 'if'? Or use several more 'else' statements?
I just looked and there are several spots that use the arg's. So play around with this if you'd like. If you can work something out fairly quickly, I'll put it in for the official release.
Comment #5
markDrupal commentedI cannot reproduce your errors unfortunately. But I tried the CVS version with this code, and everything works great on my site.
The drop down taxonomy shows the site wide forums + group's (That I am a member of) forum
When you commented out that "$gids[] =" bit of code, now whenever I try to add a forum post that is in a group, the groups selector is unselected by default.
I removed the comment and I get links such as
node/add/forum/144?gids[]=174
I am confused why your having problems, it works fine for me.
Comment #6
rconstantine commentedWhich version of OG are you using? Maybe that's my problem. I've got the latest as of a day or two ago.
I have no idea what ognodeadd?type=forum&gids[]=55 is. I'll look through the OG code to see if I can find it. That's the only thing I can think of.
Comment #7
markDrupal commentedI have og version 3.1 from june 4th
Comment #8
rconstantine commentedOkay, I have OG 3.x from the 27th of June.
I'm scanning for that weird path... nothing. I don't see anything that would manipulate paths either. I'm not using pathauto or anything like that.
The search continues.
Comment #9
rconstantine commented@markDrupal, I just want to ask you for a clarification. Are you actually clicking on the "Post new forum topic" link, or just checking the link in the status bar? My link looks right in the status bar, but when I click it, that's when I get the strange URL. Does that sound like another module is screwing me up?
Comment #10
rconstantine commented@markDrupal. Could you check to see if the 3.x dev version screws this up for you too? I opened an issue over at OG. I'm sure now (having spent a bit of time) that og_forum is not to blame for my wacky URL. But I don't see any more likely suspects in my activated module list than OG itself.
I'll keep looking.
Comment #11
markDrupal commentedI dont know what to tell you, i tried the new OG module but still nothing different. looks the same to me
i even tried with and without clean URLs enabled. still no problems on my site
Comment #12
rconstantine commentedOkay, thanks for trying that out for me. I'll start turning off modules and see what does it.
Comment #13
rconstantine commentedOkay, I figured out the problem. It was the OG User Roles module changing the url. So for now, I'm going to do a check for the module's presence and if it's there, revert to the old way, otherwise, use your way. I'll upload the change soon.
Comment #14
markDrupal commentedA possible better fix for the long run would be to set the OG Audience select box automatically on submitting the forum post. There is no reason in my mind why a group forum post should not have the proper group selected automatically. On submitting the forum, we could do some sort of lookup on the forum, and if it is a group forum, check the og audience select box with the proper group.
I guess a question to ask is " can og_forum post be posted into multiple groups or no group?" I think most likely a group forum post should be attached to exactly 1 group.
Comment #15
rconstantine commentedRegarding the one group thing. I see cross-group posts all of the time at groups.drupal.org. Although I'm not a fan, I could see that people might want to post into forums of different groups. In fact, now that I think about it, I could see admins wanting to post notices to the forums of all groups, though I suppose that could be an additional module.
As for the audience checkboxes, we should at least set the default value to the current group if it isn't working that way already. And I agree that it should be checked against the forum selector at validation/submission. The user should also be alerted when the selected audience is changed/not used. I say not used because in the case that multiple forums are posted to, multiple audiences should be checked as well.
I'm having a brain fart and can't recall - is the current forum selector a multi-selector, or only single-select?
As for 'better long-term solution', was that in regards to the fix to get this to work with og_user_roles? I'm not sure I follow you. All I'm doing is ensuring that the arg(x) functions return the expected values for all of the functions that use arg(x). Setting the audience won't affect those functions at all. Are we talking about two different things? Let me know.
Also, I'd be interested in your opinions for the remaining open issues, most of which are feature requests. Post your responses in the respective issues. Thanks.
Comment #16
markDrupal commentedforum selection is a single select item. So you could only post a forum post into one forum. That would mean you should only be able to post to one group as well. I think this post and the previous post are off topic, sorry. I'll try opening a new feature request. I'll take a look at the other issues, but as of the current development releases, og_forums is looking to work good.
Comment #17
rconstantine commentedOff topic, right. To another post then. See ya over there.
Comment #18
rconstantine commented