I started with a few patches-

the 5.x patch here: http://drupal.org/node/109573 although I do need to check against the latest post in that thread.

Then the multiple forums per group patch as found here: http://drupal.org/node/68295

Then I extended the context patch found here: http://drupal.org/node/73570

I added the ability to use BOTH regular forums and OG FORUMS. Of course, there are conditions. Whoever manages the regular forum should not add containers or forums to the OG Forums via the regular forum manager; containers and forums for OG Forums should be added via the OG Forum manager in each group. The reason is that although it will be in the correct place, it becomes disassociated with the group context.

The 'Forum topic' type content should be excluded from the audience feature. This was hiding some posts sometimes and not posting correctly at other times. To make sure that posts are put into the right spot, I've disabled the link to 'add a new forum topic' unless the user is actually in a forum. Otherwise, the text now reads 'select a forum below'.

/forum and /og_forum directories can be used interchangeably with correct operation (so far as my testing shows). If one browses to either www.yoursite.com/forum, it will function the same as www.yoursite.com/og_forum. Users should see only those forums they have permission to see on this page. In other words, they should only see the site forums, and only the og_forums to which they are subscribed and in which is_active is set.

Also, the group context should be correctly set whether one browses to forum/12 or og_forum/12.

One problem remains: if the user doesn't have permission to view the group forum (he isn't subscribed or is_active is 0) he can still enter forum/12 directly and see it. I think I've figured out which lines are the problem.

I'll see if I can get this problem out of the way soon. Meanwhile, if anybody else can test this, that would be great.

BTW: Sorry these are whole files, not patches. I'm not yet setup to do that.

Comments

rconstantine’s picture

StatusFileSize
new1.33 KB

The install file. I can't remember if I changed anything...

rconstantine’s picture

StatusFileSize
new145 bytes

The info file. Should be new to 5.x, right?

rconstantine’s picture

StatusFileSize
new26.45 KB

Checked against latest 5.x patch. Only change is removal of dependency checks. (I assume that's taken care of via Drupal core and the info file now)

rconstantine’s picture

Sorry for the multiple post in a row. This is the last for tonight unless I fix the remaining issues.

An update on what is still broken:

1) If a group's forum container is at og_forum/12, then an unauthorized user can see part of the page without a listing of forums inside if they enter the address directly into their browser. The group context is set correctly and the user is asked (in the group block) to subscribe.
2) If a group has a forum at og_forum/13, then an unauthorized user can see the forum and all of the posts. The context is still set correctly and the subscribe link is still presented in the group block.
3) The user can post to the group because I've overridden the forum selection dropdown in cases where the forum belongs to a group. I've added a note on the form about this.

Any ideas how to fix this would be appreciated. Maybe I just need to check the group context and fire off drupal_access_denied() if the user shouldn't be in that context. I'll give it a try.

Meanwhile, everything else should be working should you want to test it.

rconstantine’s picture

StatusFileSize
new26.86 KB

Took care of the issues named above. Turns out it wasn't hard. Attached is the final(?) version so long as you guys don't find anything else wrong with it.

Users should be able to get to general forums and their subscribed groups, but should get a drupal 403 page otherwise.

darren oh’s picture

Status: Needs review » Closed (fixed)

I made a release for Drupal 5 yesterday. It sounds like you may have fixed some things better than I did, but please check. Please open a separate new issue for each problem you find.

rconstantine’s picture

StatusFileSize
new27.23 KB

Darren - your patch was good. There were only a couple of lines different, but no change in functionality - at least so far as the areas you changed are concerned. I think the only line I noticed that you had and I didn't was

'type' => MENU_NORMAL_ITEM,

for the

'path' => 'admin/og/og_forum',

menu item. Oh, and your info file was cleaner than mine. I used your changes to the functions you changed and deleted the dependency checking like you did. As for other issues, I'm not sure whether they are 5.x upgrade issues or other patch issues, but I think there have already been issues opened (under 5.x.1.2?) regarding what I found.

To tell you the truth, I didn't really apply your patch and test it before adding the extra features, so I'm not a good candidate for identifying 5.x-only issues. However, if other people post issues that my update addresses, I'll comment, as I already did here: http://drupal.org/node/121632. If you'd like, I can create an issue for each feature I added and reference this thread as the solution. Would you like me to do that? Anything I can do to help. Cheers.

p.s. I forgot to change the TODO at the top, so I've removed the finished TODOs and added two more.

rconstantine’s picture

Version: 5.x-1.0 » 5.x-1.2
StatusFileSize
new27.14 KB

In fixing the issues outlined in #4, above, I forgot to make allowances for user-> ==1

Seriously, this is my last update today!!! I feel like an idiot!!!

darren oh’s picture

It's too difficult to figure out what changes fix what issues when you lump them all together. Please specify the changes you are suggesting for each issue you opened or learn how to make patches.

darren oh’s picture

Status: Closed (fixed) » Closed (duplicate)
joshua_cohen’s picture

rconstantine,

Thank you for your hard work on this module! I have not tested yet, but your improvements sound great.

Thanks,

Josh

janosch’s picture

I'd like to thank you as well, i am testing as much as i can, and I have only found one error so far. When i try to create the forums for groups allready made, it will not make them.

Thanks alot.
Rasmus.

darren oh’s picture

I would appreciate more help testing the official version now that we have one.

joshua_cohen’s picture

Does the official version have all of rconstantine's changes applied?

Thanks,

Josh

darren oh’s picture

He mixed too many changes together for me to be sure, but it addresses all the issues that have been reported.

rconstantine’s picture

janosch> are you saying that when you go here: admin/og/og_forum that pressing this button doesn't create forums for previously existing groups? Or did you not know about this button?

rconstantine’s picture

janosh> I just confirmed the button works, so maybe you didn't see it? If there is still a problem, let me know.

all> I'm sorry I am unable to separate out individual patches for each bug or feature request. The work is too intertwined and dependent on each other. Still, I'll try to roll a patch file and then perhaps comment as to what addresses what. Will that make everyone happy?

janosch’s picture

Hi RCconstantine.

Yes that was the button i referred to.
It does not create forums for existing groups on my site.

janosch’s picture

It just says:
0 groups had forums created
The settings has been applied.

rconstantine’s picture

StatusFileSize
new30.76 KB

Darren> This post has attached a proper patch file. The next post will have an explanation file which highlights what was changed in each function that was changed. I hope this satisfies your needs. Let me know if you need anything else. Next time I'll do smaller bites so things aren't so difficult. Thanks for your patience.

janosch> I haven't been able to duplicate your problem. Email me your configuration and I'll try to see if you have modules conflicting or something. You are running 5.1 and what else?

rconstantine’s picture

Status: Closed (duplicate) » Needs review
StatusFileSize
new4.27 KB

here's the explanation file

Luckily’s picture

Title: Updated to 5.x, now compatible with regular forums & more » Don't wanna beat up by bad guys? Here’s the way how to kick back!
Project: OG Forum » Email Newsletters
Version: 5.x-1.2 » master
Assigned: Unassigned »
Category: task » feature

I know many of you may have the same experience as mine that when you play MMO games, you got yourselves beat up by some bad guys. You wanna fight them back. But their levels are much higher than you, or they’ve got much better weapon and equipment. So what should you do? Go to www.gamegoldrush.com then you are gonna find a way to kick their ass back. Do whatever you wanna do, and be the person you always wanna be, is the most exciting part of games. I hope you guys all have fun with your game playing, just like what I am doing right now.

webchick’s picture

Title: Don't wanna beat up by bad guys? Here’s the way how to kick back! » Updated to 5.x, now compatible with regular forums & more
Project: Email Newsletters » OG Forum
Version: master » 5.x-1.2
Assigned: » webchick
Category: feature » task

Resetting properties.

janosch’s picture

I must have messed up the items in og_term and term_data. I removed everything in og_term, and the respective data in term_data. I then tried again and everything worked fine

Thanks for the help so far ;)

svkworld’s picture

There is a problem with this patch. After a form topic is created, if you edit the post it will make it orphan. Meaning, it will not list in the group form anymore, not sure where it goes!!!

svkworld’s picture

Version: 5.x-1.2 » 5.x-1.3

If I set the context in forum module that fixes it. For now, I am using 5.x-1.3 with my hack to core forum module.

rconstantine’s picture

svkworld>are you referring to the patch at #20, above? I'm unable to duplicate the problem. I can create posts in either site-wide forums or og-specific forums and then edit and re-save them without them becoming orphans. Or are you referring to the official releases? What hack did you make? I tried several time to get forum posts to disappear from the group forums after editing them, but couldn't. I'd like to help. Can you give me more info? Feel free to email me.

svkworld’s picture

I took the one at your message #8. Every thing works fine until the forum topic is edited. Once it is edited, it looks like it doesnt care about forum context. It is strange it is happenning to me only. For now I've taken the main version and hacked the core forum module for context/theme issue as that seems to be the only problem with the main version -- 5.x-1.3. Thanks.

darren oh’s picture

Assigned: webchick » darren oh
Status: Needs review » Fixed

I reduced the patch to its essential differences from the official version. I will split it into separate issues later if no one else does. I can't commit the whole thing at once because the official code is working and problems are still being reported with this patch. Changes to the official version will be made one piece at a time, so if something breaks we'll know why. I'm setting this issue as fixed because we have an official Drupal 5 version that works with regular forums.

darren oh’s picture

StatusFileSize
new24.45 KB

Forgot to attach the simplified patch.

rconstantine’s picture

Darren> FYI, your patch was against version 1.11.2.7 which you haven't released. Four HUNKS fail against version 1.11.2.6. I'll apply the patch manually and let you know what I find. Thanks for your willingness to work on this.

A few comments about the official release:
I just did a thorough check of the functionality and found several issues. Most have been officially added to the issue queue, but the biggest is that you say the official version WORKS with regular forums, but it doesn't at all. Would you like me to post to the issue queue regarding what doesn't work exactly? The official release DOES work so far as multiple forums in an OG is concerned, except for some context and some permission issues.

Again, sorry this has been a hassle for you. Are you sure you couldn't just apply the patch you made to your 1.11.2.7 and release it as 5.x-1.4? If you did, I'd be willing to make (smaller) patches to fix any outstanding issues that are brought up again. I understand why you'd rather break what I've done into pieces - one for each problem it addresses - but several of these solutions are intertwined, are they not? Was there anything in the patch that you saw was taking away from the recent patches you made, functionally speaking? I'm under the impression that all of the patches you've made are still in effect, even if not exactly the same. Oh, except for the 'audience select' mentioned elsewhere. Anyway, you are the guy in charge of this, so whatever you decide we pretty much have to live with. Thanks for your work on this.

darren oh’s picture

Regular forums used to disappear completely when og_forums was enabled. That's why I say the official version now works with regular forums. I would be happy to see coherent feature requests with patches showing exactly what needs to be changed to achieve the following features:

  1. Hiding group forums from non-members. At the moment, access to individual topics is restricted but access to the forums is not.
  2. Only displaying forums for the current group in the forum selection list.
darren oh’s picture

I turned two existing issues into the needed feature requests. If no one else does so, I will tease out the parts of Ryan's patch that apply to each issue.

Ryan, I'm sure your patch will end up saving me a lot of time. It just takes longer to get around to seeing what a big patch does. I applied a number of smaller patches to create the official releases, and I need to make sure they don't conflict. The purpose of the unreleased version in CVS was to reduce the number of non-essential differences between your code and the official version.

rconstantine’s picture

Darren> Yours is definitely a cleaner patch. With the empty line additions and subtractions taken out, it's much smaller. I imagine your latest CVS version has been run through the 'coder' module to check for coding standards compliance. That was another big source of patch bloat on my part - correcting preexisting coding standards mistakes. That by itself should probably be a patch.

Now that we know the proper version of og_forum.module to apply your patch to is in CVS, users can find it. I'll probably have time this weekend to start looking at small versions of patches for specific issues, such as those you've named, but feel free to beat me to it. Meanwhile, I'll post responses to the issues and see if I can at least tell you which parts of the code apply to that issue - although I did do some of that in the text file at #21 above. Cheers.

sanduhrs’s picture

subscribing.

janosch’s picture

I’ve been trying alot now to get og_forum to work properly, but had no luck.

It seems to work correct when I am logged in as admin/user1.

But when I log in as a normal user. And try to see the forum in a group the user is member of.
It just says “Select a forum below” and then it doesn’t show “general discussion” which it should.
I don’t see the group forum under the regular forum, like I do as an admin (there I see all group forums)

Now I see the issue when adding a forum post by using “add content” too, so can you guys maybe tell me how I remove the option to make a forum post under “add content”?

Thank you
Rasmus Porsager.

janosch’s picture

Status: Fixed » Active

forgot to change status.

darren oh’s picture

Status: Active » Closed (fixed)

Please, this issue is closed. See if there are similar open issues or create one yourself.

darren oh’s picture

StatusFileSize
new10.48 KB

rconstantine kindly assigned some portions of his patch in two separate issues. The remaining portions have not yet been assigned to any issue.

nielsh’s picture

I tried out the patches as given in this thread and it didn't work for me. Some code review made me aware of the function og_forum_db_rewrite_sql, where the filtering of forums should take place. This is the code fragment I found

$return['where'] = 't.tid NOT IN (
SELECT x . tid FROM (
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid != 1
) x
WHERE x.tid NOT IN (
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid = 2
)
)
AND t.tid NOT IN (
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid = 2
WHERE ogu.is_active = 0
)';
if ($restrict2) {
$og_nid = og_forum_gid_from_tid(arg(3));

if ($og_nid && !$og_vocab) {
$og_vocab = TRUE;
//Same as above, except without removing is_active == 0 forums since we are looking for a particular node.
//Need to put the join in here since we need to match ogt.nid
$return['join'] = "LEFT JOIN {og_term} ogt ON $primary_table.tid = ogt.tid";
$return['where'] = "t.tid NOT IN (
SELECT x.tid FROM(
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid != 1
) x
WHERE x.tid NOT IN (
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid = 2
)
)
AND ogt.nid = $og_nid";
}
}

The ogu.uid = 2 seemed strange to me, so I changed that to $user->uid and it now seems to work for me.

$return['where'] = 't.tid NOT IN (
SELECT x . tid FROM (
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid != 1
) x
WHERE x.tid NOT IN (
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid = ' . $user->uid . '
)
)
AND t.tid NOT IN (
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid = '. $user->uid . '
WHERE ogu.is_active = 0
)';
if ($restrict2) {
$og_nid = og_forum_gid_from_tid(arg(3));

if ($og_nid && !$og_vocab) {
$og_vocab = TRUE;
//Same as above, except without removing is_active == 0 forums since we are looking for a particular node.
//Need to put the join in here since we need to match ogt.nid
$return['join'] = "LEFT JOIN {og_term} ogt ON $primary_table.tid = ogt.tid";
$return['where'] = "t.tid NOT IN (
SELECT x.tid FROM(
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid != 1
) x
WHERE x.tid NOT IN (
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid = ' . $user->uid . '
)
)
AND ogt.nid = $og_nid";
}
}

nielsh’s picture

I tried out the patches as given in this thread and it didn't work for me. Some code review made me aware of the function og_forum_db_rewrite_sql, where the filtering of forums should take place. This is the code fragment I found

$return['where'] = 't.tid NOT IN (
SELECT x . tid FROM (
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid != 1
) x
WHERE x.tid NOT IN (
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid = 2
)
)
AND t.tid NOT IN (
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid = 2
WHERE ogu.is_active = 0
)';
if ($restrict2) {
$og_nid = og_forum_gid_from_tid(arg(3));

if ($og_nid && !$og_vocab) {
$og_vocab = TRUE;
//Same as above, except without removing is_active == 0 forums since we are looking for a particular node.
//Need to put the join in here since we need to match ogt.nid
$return['join'] = "LEFT JOIN {og_term} ogt ON $primary_table.tid = ogt.tid";
$return['where'] = "t.tid NOT IN (
SELECT x.tid FROM(
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid != 1
) x
WHERE x.tid NOT IN (
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid = 2
)
)
AND ogt.nid = $og_nid";
}
}

The ogu.uid = 2 seemed strange to me, so I changed that to $user->uid and it now seems to work for me.

$return['where'] = 't.tid NOT IN (
SELECT x . tid FROM (
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid != 1
) x
WHERE x.tid NOT IN (
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid = ' . $user->uid . '
)
)
AND t.tid NOT IN (
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid = '. $user->uid . '
WHERE ogu.is_active = 0
)';
if ($restrict2) {
$og_nid = og_forum_gid_from_tid(arg(3));

if ($og_nid && !$og_vocab) {
$og_vocab = TRUE;
//Same as above, except without removing is_active == 0 forums since we are looking for a particular node.
//Need to put the join in here since we need to match ogt.nid
$return['join'] = "LEFT JOIN {og_term} ogt ON $primary_table.tid = ogt.tid";
$return['where'] = "t.tid NOT IN (
SELECT x.tid FROM(
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid != 1
) x
WHERE x.tid NOT IN (
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid = ' . $user->uid . '
)
)
AND ogt.nid = $og_nid";
}
}

nielsh’s picture

I tried out the patches as given in this thread and it didn't work for me. Some code review made me aware of the function og_forum_db_rewrite_sql, where the filtering of forums should take place. This is the code fragment I found

$return['where'] = 't.tid NOT IN (
SELECT x . tid FROM (
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid != 1
) x
WHERE x.tid NOT IN (
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid = 2
)
)
AND t.tid NOT IN (
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid = 2
WHERE ogu.is_active = 0
)';
if ($restrict2) {
$og_nid = og_forum_gid_from_tid(arg(3));

if ($og_nid && !$og_vocab) {
$og_vocab = TRUE;
//Same as above, except without removing is_active == 0 forums since we are looking for a particular node.
//Need to put the join in here since we need to match ogt.nid
$return['join'] = "LEFT JOIN {og_term} ogt ON $primary_table.tid = ogt.tid";
$return['where'] = "t.tid NOT IN (
SELECT x.tid FROM(
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid != 1
) x
WHERE x.tid NOT IN (
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid = 2
)
)
AND ogt.nid = $og_nid";
}
}

The ogu.uid = 2 seemed strange to me, so I changed that to $user->uid and it now seems to work for me.

$return['where'] = 't.tid NOT IN (
SELECT x . tid FROM (
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid != 1
) x
WHERE x.tid NOT IN (
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid = ' . $user->uid . '
)
)
AND t.tid NOT IN (
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid = '. $user->uid . '
WHERE ogu.is_active = 0
)';
if ($restrict2) {
$og_nid = og_forum_gid_from_tid(arg(3));

if ($og_nid && !$og_vocab) {
$og_vocab = TRUE;
//Same as above, except without removing is_active == 0 forums since we are looking for a particular node.
//Need to put the join in here since we need to match ogt.nid
$return['join'] = "LEFT JOIN {og_term} ogt ON $primary_table.tid = ogt.tid";
$return['where'] = "t.tid NOT IN (
SELECT x.tid FROM(
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid != 1
) x
WHERE x.tid NOT IN (
SELECT ogt.tid FROM {og_term} ogt
INNER JOIN {og_uid} ogu
ON ogt.nid = ogu.nid AND ogu.uid = ' . $user->uid . '
)
)
AND ogt.nid = $og_nid";
}
}

nielsh’s picture

Excuse me for the three posts. One would have sufficed, the server was very unresponsive. I can't remove my own comments, otherwise I would have done so.

rconstantine’s picture

actually, they should all be $user->uid. the second release of the 2.x branch will not only have this corrected, but will have a comment in the function definition explaining each step of the statement.