I am using Advanced Forums and I have installed og_forum 6.x-2.0. Then I created a few groups and the corresponding forums have been created under the main container. But I am not able to create new topics under these forums. When I click on New Topic, the Forums drop down is not populated. Since it is a required field, I am not able to proceed.

I have attached an image of my og_forum settings and also an image which shows the forums comping up blank.

I am able to successfully create topics in non OG Forum forums. Even there none of the OG Forums come up in the drop down.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

Anybody using Advanced Forums right now who can spare a little time to investigate this problem further ?

optidel’s picture

With my rudimentary PHP skills, I was able to some debugging.

In the file og_forum.module between lines 416 and 424, they are rewriting the taxonomy query to specifically exclude all the OG forums. I am not sure why. I commented those lines and everything worked fine.

Also in the function og_forum_form_alter, they are getting the group context. Once the group context is set, you cannot create a topic in any forum other than in that group. Again I am not sure why. So I commented the following lines 863 and 904 and it worked fine.

paulbooker, if some one point out why these codes were put in the first place it would be great. Otherwise please look into committing these changes.

optidel’s picture

Category: support » bug
Priority: Normal » Critical

I am changing this to a critical bug as no one is able to use this module without it.

Anonymous’s picture

Priority: Critical » Normal

As this is not a issue with OG Forum explicitly i would like to keep priority = normal .

Thanks, Paul

optidel’s picture

This is a problem only within og_forum. All the code changes I made were only within og_forum.

I also did some more digging in CVS and it seems to be related to #462808: Option to hide organic forums on main display and select list. The code for that issue was supposed to have been rolled back but it was not and hence the problem.

un11imig’s picture

I have the same issue. No way to create new forum topics.

sockah’s picture

Subscribing. I'm having the same issue as well. Any workarounds for this?

netrom’s picture

Subscribing

geshan’s picture

I have the same issue the forms are not in the list, it just shows -please choose- and does not let me create a topic. This really needs to be fixed.

geshan’s picture

this is a critical issue please solve this.

freddyseubert’s picture

subscribing. this really is critical. same problem even without advanced forums...

matsta’s picture

subscribing. Running og 2.0 and og_forum 2.2 without advanced forum and cannot select different forums when posting new topic.

freddyseubert’s picture

i had to deactivate and deinstall all group-related modules for tracking down another bug - after reinstalling all modules, the dropdown-menu was populated again. so i can't say why this bug occured, but simply trying to deinstall and reinstall the modules "og", "og_forum" and "forum" might work... even if this is probably the first thing you want to try, perhaps you forgot to do so (like me) ;)

matsta’s picture

Thanks Freddy, however what about og content, users and configuration, did this mean you had to completely setup og again from the start?

Uninstalling means removing all db tables and starting again. This is not really an option for me.

matsta’s picture

OK, you are right freddy, although I only needed to uninstall and reinstall og_forum. I already had content and config all setup for og, but didn't need to touch that. I am now only seeing the forums related to the group that I am editing which is great, but I can get to all forums via each group.

Cheers.

ldekay’s picture

I have the same problem... no forums available under . Unfortunately matsta's fix didn't do any good whatsoever. In fact, I went even further and uninstalled both OG Forum and Forum modules.

Of course we lost all forum containers, topics, and topic posts. So after rebuilding and resetting everything under Forums, Taxonomy, Content Types, Organic Group Forums and OG Content Types...

    IT STILL DID NOT WORK!

Seems like the problem surfaced when the last core update (6.15) was installed, but that may just be serendipity. Meanwhile OG Forums are completely useless. Any idea when this might get fixed???

Breakerandi’s picture

subscibe, exactly the same problem..

pepeelfrances’s picture

same problem if I use the url /forum, if I'm already in node/XX/og/forum it's ok I can chose the forum. It's with private forums. (Og forum 6.x-2.2 , Drupal 6.16, and OG 6.x-2.0). I'm not using Advanced forum.

ferrallc’s picture

This appears to be the same problem as I posted at: http://drupal.org/node/751094 but since I am not using Advanced Forum I did not realize it.

This is a critical bug.

Shalrath’s picture

Same issue here as well, when I was building a development site a few months back. After implementing OG_forum, I attempted to move certain threads into og_forum containers, whereupon I ran into this same bug. Interestingly enough, after moving the threads back to their original containers - they were still unable to take new comments.

Hope this gets fixed soon.

realityloop’s picture

Priority: Normal » Critical

Ok, I thought I'd describe what is happening in my case hoping it would shed more light on the issue:

With 6.x-2.2 2009-Dec-17
Disabling and uninstalling og_forum then re-enabling it fixes the dropdown menu, but results in the following error when trying to create a forum.

    * warning: reset() [function.reset]: Passed variable is not an array or object in /home/sites/intranet/web/sites/all/modules/og_forum/og_forum.module on line 863.
    * warning: next() [function.next]: Passed variable is not an array or object in /home/sites/intranet/web/sites/all/modules/og_forum/og_forum.module on line 865.
    * warning: key() [function.key]: Passed variable is not an array or object in /home/sites/intranet/web/sites/all/modules/og_forum/og_forum.module on line 867.

These lines appear to be taxonomy related:

         elseif (arg(1) == 'add' && !arg(3)) { 
863        $first = reset($all_results);
           if ($first == 0) {
865          next($all_results);
           }
867        $term = key($all_results);
           $form['taxonomy'][$vid]['#default_value'] = array($term);
         }

I can create a new Forum topic in my group, but the Forum tab is now missing from my groups.

If I Click the "Update old groups" button at /admin/og/og_forum the error above goes away and the Forums tab appears again in my groups, but I then have no options in the Forums dropdown of the topic creation form.

With 6.x-2.x-dev 2010-Mar-20
I get the following errors after uninstall and re-enable of the module:

    * warning: array_keys() [function.array-keys]: The first argument should be an array in /home/sites/intranet/web/sites/all/modules/og_forum/og_forum.module on line 442.
    * warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/sites/intranet/web/sites/all/modules/og_forum/og_forum.module on line 442.
    * warning: reset() [function.reset]: Passed variable is not an array or object in /home/sites/intranet/web/sites/all/modules/og_forum/og_forum.module on line 865.
    * warning: next() [function.next]: Passed variable is not an array or object in /home/sites/intranet/web/sites/all/modules/og_forum/og_forum.module on line 867.
    * warning: key() [function.key]: Passed variable is not an array or object in /home/sites/intranet/web/sites/all/modules/og_forum/og_forum.module on line 869.

Forums menu is working, Forums tab is missing from Group page.

After clicking the "Update old groups" button at /admin/og/og_forum the Forums tab appears again in my groups, but I then have no options in the Forums dropdown of the topic creation form and get the following error when trying to create a topic:

    * warning: array_keys() [function.array-keys]: The first argument should be an array in /home/sites/intranet/web/sites/all/modules/og_forum/og_forum.module on line 442.
    * warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/sites/intranet/web/sites/all/modules/og_forum/og_forum.module on line 442.

I've confimed this both with and without Advanced Forum enabled so am marking as critical again.

Anonymous’s picture

Version: 6.x-2.0 » 6.x-2.x-dev
Assigned: Unassigned »
FileSize
310 bytes

Would you please try the patch ..

If you would like me to take a look at any additional problems would you submit your bug report in the following format :

User-Agent:
Build Identifier:

Description:
..

Reproducible: Always | Sometimes

Other OG / Forum related modules installed
..

Steps to reproduce:

1.
2.
..

Expected Results:
..

Actual Results:
..

Proposed solution:
..

Patch

Feel free to be verbose & attach all relevant screenshots

Best,
Paul Booker
Appcoast

boabjohn’s picture

I have applied the patch to 2.x-dev. Got no confirmation that it worked, but am now able to access private forums through the drop-down selector (ref: http://drupal.org/node/580452) and I can now create new topics.

What turned the tide was a quick inspection of the term_data table: here I found that the terms for the container and default forum (General Discussion) had been given vid value of 0 instead of the proper Forum vid. Manually setting the vid value popped the container and forum back into the group and into the drop down list.

From here, selecting to add a new topic works from both the link in the main forum area (which carries a GID value) or from the general link in the sidebar (with no GID).

Hope that helps. Thanks for the patch Paul, and thanks to others for continuing to barrack for this to be fixed up in the next release.

mpotter’s picture

I am having this same problem with 6.x-2.x-dev and the above patch did not fix anything for me.

I have a mix of normal Forums and OG Forums. I have a single OG Group. When I am logged into a user that is a member of that group and go to a *normal* Forum, when I click Add Topic, the Forum dropdown list is empty. If I go into the OG Forum that I'm a member of and click Add Topic, then the Forum dropdown only has the OG Forum listed and none of the non-OG forums.

If I log in with a user who is not a member of any OG groups and go to a normal Forum and click Add Topic, the Forums list is again empty.

I have tried uninstalling and reinstalling OG Forums without any luck. This seems to be the same issue that a lot of other people are reporting here. It's completely critical to OG Forums to fix this. I cannot add OG and OG Forums to my site if it's going to break my existing non-OG forums.

I checked my term_data table and I do not have any entries with a vid of zero, so that doesn't seem to be related to my problem.

mpotter’s picture

More info on this. After disabling OG Forums, then uninstalling, then re-enabling, I can then go to the OG Forum settings and click "Update old groups". At this point, all menus will show up in the Forums dropdown when I create a new post. However, a few minutes later, the Forums dropdown will be empty again. I'm still trying to determine exactly when this happens. It seemed to happen after I manually create a menu link that points to the OG Forum (like forums/mygroup/myforum) but that doesn't make any sense to me, so I'm still trying to get a reliable set of steps to reproduce the issue.

mpotter’s picture

OK, I have confirmed this procedure and it is *really* odd. I'm no Drupal expert, but I just don't see why this causes OG Forum to fail. But maybe somebody else can test it to confirm or deny this.

1) On a clean Drupal installation, install Forums and Organic Groups
2) Create at least one normal Forum and Container. Mine is called "Test".
3) Create one Organic Group. Mine is called "My Group". You'll need to create a content type to act as the Group content as per the normal OG module setup.
4) Now install OG Forums. Go to admin/og/og_forum and click the "Update old groups" button. This should create a forum for your "My Group" group.
5) Go to your normal "Test" forum and verify that when you click "Add Topic" the Forums dropdown is correct and fully populated.
6) Next, create a new menu item to point to your OG Forum. Go to admin/build/menu-customize/navigation/add and enter the path:
forums/my-group/general-discussion (assuming you used my names above...adjust to fit your site) and the menu link name "My Forum". Click Save.
7) Now go back to the normal "Test" forum and click "Add Topic". You should see the Forums dropdown is empty.

First I thought maybe the act of adding a menu link was clearing a cache or something like that. But I repeated this procedure many times replacing step (6) with various alternatives, such as clearing caches, and didn't find anything else that would force the problem to occur.

Once the problem occurs, I cannot find any way to reset it except by disabling OG Forum and then uninstalling it. So something is getting set in the database.

Looking at the OG Forums code, my best best is in og_forum_form_alter where you are trying to get the group context. If the group context is empty, you try to get it from the node itself. But what happens in og_forum_set_og_group_context_from_tid if the current forum node is not part of a Group? If you are editing a forum that is not part of the group, then you should be restoring the full group dropdown list and I'm not sure I see in the code where you are doing that.

I have no idea why creating a menu item pointing to a forum is causing this side effect, but maybe it will spark an idea in somebody else so we can track this down and get it fixed.

mpotter’s picture

Sorry to post so much, but when doing some debugging I learned a bit more.

The fundamental issue here is with the group_context. You cannot just rely upon this value. The group_context can be set even if the user is posting within a non OG Forum. You should *always* be taking the $gid from the current forum being posted to, or from the node being edited when editing an existing post. This is a very basic issue of making OG Forums work with normal non-OG forums.

The act of making a menu that points to an OG Forum seems to set the group_context and that is what triggers the failing of the drop-down Forums list. In og_forum_form_alter you always restrict the Forums drop-down list to the current group context if it is set regardless of what forum the user is posting to or editing.

I'm not sure when I'll have time to come up with some alternate code for og_forum_form_alter...it's going to need a fair amount of work and I'll need to take time to better understand what it is doing. Here's hoping paulbooker understands this code a bit better and can come up with a fix. I'm also not sure where else in OG Forums it might be assuming that the group_context really represents the proper context based upon the forum being used.

Hope this helps.

KaaRoy’s picture

I had this problem, but now it works.

Apparently, it started when I reinstalled the OG Forum module. It has inherited the group specific forums that did not work. I have deleted the group specific forums, and recreated them with the pushbutton. Now the pulldown is populated with one item.

KaaRoy’s picture

However, I still have this when trying to create a topic:

warning: array_keys() [function.array-keys]: The first argument should be an array in /var/www/html/titulia/test/republic/sites/all/modules/og_forum/og_forum.module on line 439.
warning: in_array() [function.in-array]: Wrong datatype for second argument in /var/www/html/titulia/test/republic/sites/all/modules/og_forum/og_forum.module on line 439.

Anyone any idea on this one?

Anonymous’s picture

Assigned: » Unassigned
IKN’s picture

Hi, Thank you for this great module. Unfortunately, after working on this for a couple of weeks, I cannot find a way _not_ to get this error. I have applied the patch.



My methodology is simply to install and enable OG and then OG Forums. I have uninstalled, reinstalled, patched. Can't beat it.


If I can be of help testing, please let me know.

Best wishes,

David

robbertnl’s picture

Subscribing, same issue. patch doesn;t work for me

Drake’s picture

Same here.
I'm using the og_forum-6.x-2.2 and advanced_forum-6.x-2.0-alpha2

I add the patch #22 to the og_forum (add $all_results = array(); between line 851 and 852 )
but this didn't help.

I still cannot choose any group forum where the posting should be posted!

I have uninstalled og_forums but this didn't change anything....

A help woudl be appreciated

magibird’s picture

I have the same problem as well using Advanced Forum 6.x-1.1, OG Forum 6.x-2.x-dev , and Organic groups 6.x-2.1. I started with og_forum-6.x.2.2 but switched to 6.x.2.x.dev to see if the problem was fixed. Same problem with both. I have also tried uninstalling and reinstalling multiple times with no change in results.

robbertnl’s picture

I am using OG Forum 6.x-1.4 (http://ftp.drupal.org/files/projects/og_forum-6.x-1.4.tar.gz) now and i am able to create new topics.
So i will stick to 1.4 till the 2.x branch is fixed.

Drake’s picture

I can confirm this:
the OG Forum 6.x-1.4 functions and it's possible to create a posting in the Groupforum.

but why 6.x-1.4 version is OK and 2.x doesn't function?

PS: the Forum tab is missing in Groups using 6.x-1.4 version :(

archer007’s picture

Version: 6.x-2.x-dev » 6.x-2.2

I have the same issue, not using Advanced Forums at all. This is a showstopper bug, I recommend fixing ASAP. Why did the module maintainer abandon it?

archer007’s picture

Version: 6.x-2.2 » 6.x-2.x-dev
hack’s picture

I have (had) the same problem with the OG Forum. But i realized i could create topics if i logged in as a user which is member of the group of the forum.
But when i logged in as admin (id 1) i couldn't.
So it works if i am member of the group but not if i am logged in as admin :(

jvieille’s picture

Erased this post, seems a different issue posted here
http://drupal.org/node/857508

jvieille’s picture

Erased this post, seems a different issue posted here
http://drupal.org/node/857508

Drake’s picture

Are any news to this issue? or should we stay with OG Forum 6.x-1.4

perarnet’s picture

Has anyone been able to use the og_forum 6.x-2.2 module without this bug showing up?

jeffschuler’s picture

I'm concerned that a number of different issues are being voiced here, and that that's inhibiting progress on all of them.

Varying ways of creating a forum post result in different URLs, some of which OG Forum handles differently. Here are some ways of getting to the Create Forum topic page, and resultant URLs (some with example gids/nids) for those pages:

  • using the Content Management > Create content > Forum topic menu item (node/add/forum/0)
  • using the Create forum topic from within a particular group (node/add/forum?gids[]=46)
  • from top-level /forum page (node/add/forum/0)
  • from the Group forum page, navigated to from the top-level (/forum) forum page (node/add/forum/34?gids[]=30)

The options in the Forums drop-down that OG Forum provides depend on not only on the status of the user posting (Administer forums permission? Member of what groups?) but also on group context and URL.

Might I request that those here still experiencing their problem can be specific not only about whether they're using the Advanced Forums module, but also about the context/link from which they're posting a forum topic?

pro.methean’s picture

Version: 6.x-2.x-dev » 6.x-2.2

Drupal 6.19
Organic groups 6.x-2.1
OG forum 6.x-2.2
Advanced Forum 6.x-1.1
Forum Access 6.x-1.3 installed but disabled as I found (presumably unrelated) problems with this.

Mix of regular and group forums.

* using the Content Management > Create content > Forum topic menu item (node/add/forum/0)
* from top-level /forum page (node/add/forum/0)

Both of these have the same results, the forums pop-up is populated with only the part of the taxonomy of the non-OG forums.

* using the Create forum topic from within a particular group (node/add/forum?gids[]=46)
* from the Group forum page, navigated to from the top-level (/forum) forum page (node/add/forum/34?gids[]=30)

node/add/forum/150?gids[]=448
node/add/forum?gids[]=444

In either of these last two cases, if the user is a member of the group the forums field seems to be populated with taxonomy of the group forums, works as expected. If the user is not a member, we are not going to be see the first case ("using the Create forum topic from within a particular group").

But in the case of a public group forum ("make public" from "Manage group forums"), non-members can select new topic from the group forum's page. With non-members of a Group trying to post to a public group forum, we get the problem where you can't set the forum and it just says "-Please Choose-" as NO PART OF THE FORUM TAXONOMY has been added to this menu.

As a result, the so called Public forum is publicly readable and you can comment on the threads but you can't start a new one.

pro.methean’s picture

After spelunking through Devel output, was able to determine a possible fix by simply commenting out lines starting line 443 (of 6.x-2.2) og_forum_db_rewrite_sql:

      /* $return['join'] = "LEFT JOIN {og_term} ogt ON t.tid = ogt.tid";
      $return['where'] = "ogt.nid IS NULL";
      if ($og_forum_container = variable_get('forum_default_container', FALSE)) {
        $return['where'] .= " AND t.tid != $og_forum_container";
      }
      $return['distinct'] = TRUE; */

I've tried a few permutations and have not seen where not having this code breaks anything. Anyone see bugs or side effects come out of this?

FYI - I am using forum_default_container == false.

pro.methean’s picture

Okay so found this patch (not accepted and has issues) here: http://drupal.org/node/580452

Seems that code is intended to work on forum visibility, and may not adapt well when the autovisibility is used.

Deleting the code as I proposed isn't appropriate to continuing that autovisibility functionality.

We need to look at the SQL and see if we can come up with something that does the right thing in these cases.

- Pro

robcarr’s picture

Just commented out as at #46 - brings back to life the Vocabularies > Forums list. The correct forum containers are shown for the relevant OG.

This is clearly a short term palliative and need to look into this a little more, but gives me some breathing space. Thanks @pro.methean.

BTW - not using Advanced Forum

baff’s picture

benjamin_dk’s picture

subscribing

bobju’s picture

subscribing

sashi_gangaraju’s picture

To Create new topics- These are the following steps that I followed.

Step 1: Open your database ( may be using phpMyAdmin, etc) .. look for the table "term_data". I this table search for "name of your forum". Copy the vid number. ( if you have installed advanced_forums .. the vid is mostly 0 )
Step 2: Open the table "vocabulary". Search for the module "forums" and edit the entry. Paste the vid that you have copied from step 1 to the vid field of this entry.
Step 3: Open the table "vocabulary_node_types" look for the type "forum" and edit the entry. Paste the vid again that you have copied from step 1 to the vid field of this entry.

Now you will be able to create new topics. I encountered this problem especially after installing the advanced_forum module.

Good Luck,
Sashi G

csavio’s picture

FileSize
580 bytes

As mentioned in #46 the problem seems to lie in the og_forum_db_rewrite_sql. Specifically in the where clause on line 444 (of 6.x-2.2).

$return['where'] = "ogt.nid IS NULL";

This will never be true. Therefore the query is always returning an empty set of results when attempting to post in a public forum when you fall into that condition. Any forum other than your own group's will display the problem described here.

This should instead be the following

// Either the forum is unconfigured or public.
$return['where'] = "ogt.public IS NULL OR ogt.public >  " . PRIVATE_BY_GROUP_OWNER;

This would match what is used for the arg(0) forum where rewrite on line 429. The term nid should never be NULL being an indexed primary key which can not be NULL.

DESCRIBE og_term;

+--------+------------------+------+-----+---------+-------+
| Field  | Type             | Null | Key | Default | Extra |
+--------+------------------+------+-----+---------+-------+
| tid    | int(10) unsigned | NO   | PRI | 0       |       |
| nid    | int(10) unsigned | NO   | PRI | 0       |       |
| public | int(10) unsigned | NO   |     | 0       |       |
+--------+------------------+------+-----+---------+-------+

Attaching a patch for review. This is working for me currently and will be going into a production environment soon.

- Chris

baff’s picture

Status: Active » Needs review

I can't find it at the moment, but I have read that AF and OG Forum are not compatible

baff’s picture

csavio’s picture

As mentioned previously this issue is not due to Advanced Forum and occurs whether you have that AF installed or not.

cpotter’s picture

subscribing (using Advanced Forum)

thePanz’s picture

Version: 6.x-2.2 » 6.x-2.x-dev
FileSize
3.39 KB

I rewrite the csavio patch at #53 : the code you provided isn't correct cause you check a

ogt.public IS NULL

instead of

ogt.nid IS NULL

Following your edits I rewrite the query using a new function, I didn't check deep the "variable_get('forum_default_container', FALSE)" settings.

I'm currently using this code in a beta website without errors. Feel free to test my patch and give a review!

Cheers

scottrigby’s picture

Title: Not able to create new topics » Non-members unable to create new topics
Priority: Critical » Normal
Status: Needs review » Reviewed & tested by the community

@thePanz: #58 works well here. Marking RTBC - respectfully, since there's been so much back & forth on this issue. anyone else who finds a problem can set it back to 'needs work'.

Clarifying title - as i understand this is only an issue for non-members, not for members of the group.

Changing priority back to normal per paulbooker's replies above. This issue, while important, does not render the entire system unusable (and on contributed projects, it's up to the maintainer to set priority).

pumpkinkid’s picture

I disagree, I feel that it is very crucial for this bug to be fixed... however, it may be important to point out that I am having this problem with users who DO belong to the group...

I skimmed through most of the reports, and it seems that with me, I have some groups where the drop down works as expected, and most (newer ones) not working....

scottrigby’s picture

Just to clarify (not to add unnecessary back & forth), I changed priority to help not hinder this issue. Setting priority in line with the maintainer's wishes is not to suggest this isn't subjectively "critical" for your site (or even mine, where i feel it is too), but that defining "critical" in the d.o issue queue means something different. See under 'Priority' at "How to make an issue report" http://drupal.org/node/45111 - and "Priority levels of issues" http://drupal.org/node/45111 - The best way to this issue is to help test the patch, and provide feedback, or propose a new approach or new patch.

pumpkinkid’s picture

I understand, hence why I did not move it back to critical as others might do... :-) Just saying that I find it crucial as to me the module is causing more harm than good at this point.

pumpkinkid’s picture

Interestingly enough... I already had a patch on og_forum that needed to be reversed in order to let the patch in #58 apply...

This patch seems to have corrected the issue, however, (not having looked at both patches mind you) it may be necessary to find similarities between #694690: OG forum warning: array_keys() [function.array-keys]: The first argument should be an array (I applied patch on #2) and #651672: Non-members unable to create new topics...

baff’s picture

#58 patch seems to work for me

thePanz’s picture

Will this patch be committed?
I can help as a co-maintainer to keep this module update if module admin allow me to do it! :)

csavio’s picture

FileSize
558 bytes

ogt.nid cannot be null according to the schema. That was the problem with the query and specifically why it needed to change. ogt.nid IS NULL returns nothing every time. The only thing that gets evaluated there is the "OR" portion of the query in what either of us has written.

ogt.public cannot be NULL either so you were correct that is a mistake in my previous patch. Checking either for a NULL state would never change anything.

I think that the following is the only thing that would likely be important to check in that section of the query rewrite. I'm not sure changing that whole rewrite is necessary to solve anyone's issues, though.

<?php
-      $return['where'] = "ogt.nid IS NULL";
+      $return['where'] = "ogt.public >  " . PRIVATE_BY_GROUP_OWNER;
php?>
thePanz’s picture

FileSize
3.37 KB

@csavio: I understand your edits, and I think that the same assumptions are valid also (in some lines before your edits) for the line

 $return['where'] = "ogt.public IS NULL OR ogt.public > " . PRIVATE_BY_GROUP_OWNER;

Applying your edits results in code duplication where the same SQL is created in both code branches. My patch apply a simplification of the code using a function for SQL creation.
Following your assumption that gid.nid can't be NULL I've attached my new patch with your edits.

Regards

csavio’s picture

Thanks thePanz. I'll apply your patch and test it out. Also, you might try contacting paulbooker via the contact form if you want to help maintain the module. I don't think he's looking at the forum posts here, but does seem to be active.

http://drupal.org/user/25892/contact

csavio’s picture

Looks good thePanz. I see now you just took the repeated code and moved it to a function. You didn't really change the functionality there. Got it.

thePanz’s picture

Yep! :) I think that my code is more clear now.. what do you think?

csavio’s picture

Yeah, looks good. Simplifies it a bit and resolves the issue discussed here. Perfect.

Anonymous’s picture

Should get to this over the weekend

Best,
Paul Booker
Appcoast

Anonymous’s picture

Assigned: Unassigned »
Anonymous’s picture

Refreshing my memory ..

This is working as expected. (replying to #24)

Anonymous’s picture

Still going through the issue queue ..

If anyone would like to clarify the problem / their problem further would you please submit your bug report in the following format :

User-Agent:
Build Identifier:

Server:
PHP Version:

Description:
..

Reproducible: Always | Sometimes

Configuration of Group details @ admin/og/og , Group access configuration @ og/og_access and Group Forums @ admin/og/og_forum (Attach screenshots)

Other OG / Forum related modules installed (Disable if possible)
..

Steps to reproduce:

1.
2.
..

Expected Results:
..

Actual Results:
..

Proposed solution:
..

Patch

Feel free to be verbose & attach all relevant screenshots

Best,
Paul Booker
Appcoast

Anonymous’s picture

Brilliant , i have observed this.

"But in the case of a public group forum ("make public" from "Manage group forums"), non-members can select new topic from the group forum's page. With non-members of a Group trying to post to a public group forum, we get the problem where you can't set the forum and it just says "-Please Choose-" as NO PART OF THE FORUM TAXONOMY has been added to this menu. "

(reply to comment 45)

Anonymous’s picture

The latest patch looks *very* promising

I have a problem right now with making the post (see attachment)

I'll investigate some more this evening hopefully we will have this issue resolved by the end of the week

csavio’s picture

Thanks for looking into this paulbooker. Much appreciated.

Anonymous’s picture

I'm going to commit the work to the development branch as i can see the changes are moving things in the right direction and the code looks correct to my mind although i seem to have a problem seeing the default forum on the add forum page (group context) and can only see -Please choose- (did see it working for a time). Just had a thought it may be that where the above was working i was looking at a group forum that existed in it's own container, more recent groups have there forum in a single container .

Thanks for everyone efforts here.

Best,
Paul Booker
Appcoast

csavio’s picture

Great, thanks Paul.

I was investigating something similar to what you saw on the add forum screen. I think we should just return for those with administration privileges in the second part of the rewrite SQL. If we don't the where clause is limiting administrators from seeing anything in the forum taxonomy that is not public as well. That would change thePanz's patch to look more like this:

<?php
    elseif (arg(0) == 'node' && arg(1) == 'add' && arg(2) == 'forum') {
      if (user_access('administer forums') || (!module_exists('og_access') || variable_get('forum_all_public', 0))) { 
        return array();
      }
      if (isset($_GET['gids']) && is_array($_GET['gids']) && isset($_GET['gids'][0]) && is_numeric($_GET['gids'][0])) {
?>
Anonymous’s picture

This is one area of the module that i don't seem to have a good understanding of. Here goes ..

Does anyone understand why on the /node/add/forum page og_forum_db_rewrite_sql() would want to receive the following $query ..

SELECT t.* FROM  {term_node} r INNER JOIN {term_data} t ON r.tid = t.tid INNER JOIN {vocabulary} v ON t.vid = v.vid  WHERE r.vid = %d ORDER BY v.weight, t.weight, t.name 

from the taxonomy module ..

function taxonomy_node_get_terms_by_vocabulary($node, $vid, $key = 'tid') {
  $result = db_query(db_rewrite_sql('SELECT t.tid, t.* FROM {term_data} t INNER JOIN {term_node} r ON r.tid = t.tid WHERE t.vid = %d AND r.vid = %d ORDER BY weight', 't', 'tid'), $vid, $node->vid);
  $terms = array();
  while ($term = db_fetch_object($result)) {
    $terms[$term->$key] = $term;
  }
  return $terms;
}

what would the vid (node ID) be ?

Best, Paul

Anonymous’s picture

.. it's actually the group ID, investigating a little more ..

Anonymous’s picture

Having the below ..

$return['where'] = "ogt.public IS NULL OR ogt.public > " . PRIVATE_BY_GROUP_OWNER;

.. within og_forum_get_sql() seems to get things working not sure why at the moment which worries me a little. Can anyone pull all this together?

Best, Paul

MiniMax’s picture

subscribing (using Advanced Forum)

StephenRobinson’s picture

subscribe

StephenRobinson’s picture

subscribe

tjmoyer’s picture

I've been working on this issue for a while now, but didn't realize for a while that it was directly related to og_forum. I had users that weren't part of the group that couldn't post to the public forum. In forum.module I could see that $node->tid was not being set (so there was no entry being placed in the forum table for the new topic), and that taxonomy_get_tree() was only showing non-og forums in it's listing (see my related post: http://drupal.org/node/361275#comment-3813160).

After reading this thread I discovered that og_forum adds an sql rewrite for forum nodes being edited, but not those being created. Thank you paulbooker in posting #83. I have created a patch which adds a WHERE clause for public og_forums as well as non-og forums.

Original:

    if (arg(0) == 'node' && arg(1) == 'add' && arg(2) == 'forum') {
          if (isset($_GET['gids']) && is_array($_GET['gids']) && isset($_GET['gids'][0]) && is_numeric($_GET['gids'][0])) {
            if (in_array($_GET['gids'][0], array_keys($user->og_groups))) {
              return;
            }
          }
      $return['join'] = "LEFT JOIN {og_term} ogt ON t.tid = ogt.tid";
      $return['where'] = "ogt.public IS NULL";

becomes:

    if (arg(0) == 'node' && arg(1) == 'add' && arg(2) == 'forum') {
          if (isset($_GET['gids']) && is_array($_GET['gids']) && isset($_GET['gids'][0]) && is_numeric($_GET['gids'][0])) {
            if (in_array($_GET['gids'][0], array_keys($user->og_groups))) {
              return;
            }
          }
      $return['join'] = "LEFT JOIN {og_term} ogt ON t.tid = ogt.tid";
      // Filter down to unconfigured or public forum, not just unconfigured,
      // or non-group members won't be able to post to public forums
      $return['where'] = "ogt.public IS NULL OR ogt.public > " . PRIVATE_BY_GROUP_OWNER;
ñull’s picture

subscribing

BeaPower’s picture

any news?

Drake’s picture

Could someone confirm that og_forum 6.x-2.2 or 6.x-2.x-dev would work properly with advanced_forum ?
If not, what patches needs to be added?

What versions of og_forum and advanced_forum are compatible?

capellic’s picture

I installed the DEV version (November 17, 2010) and it didn't work -- same problem with group forums working OK, but not public. Then, per your suggestion in #83, I changed line 454 from:

$return['where'] = "ogt.public > " . PRIVATE_BY_GROUP_OWNER;

to:

$return['where'] = "ogt.public IS NULL OR ogt.public > " . PRIVATE_BY_GROUP_OWNER;

This works for me and I didn't have to reinstall the module or make any changes to the config or data. It just worked! I am not able to post to the public and group forums and I am seeing the appropriate forums listed in the "Forums" select field.

HOWEVER, when I go to view the topic list for the public forum I just posted to, I don't see the discussion listed. (It works fine for the group forum which makes me believe that OG Forum is inappropriately asserting itself in the site-wide context?) When I view the list of forums from the /forum path, I see all the forums I am a part of and I see that the topic count, post count and the last post information (date and username) are all correct.... so the data *is* there. Any ideas of why I don't see the list of topics in the public forums?

UPDATE

Now I am straight-up baffled. In trying to figure out the above issue of not seeing any topics in the public forum list, I uninstalled OG Forum. Everything was working perfectly. Then I re-installed it -- things were working fine -- ability to post was unencumbered as expected because I hadn't yet clicked on "update old groups" (admin/og/og_forum) to associate the forum to the group. Once I did, I thought I had a big problem as all of the topics in the group forum had disappeared. But what I realized is that new containers and forums were being produced on the fly and they anybody could access any group forum -- even if they weren't members.

I decided to remove all existing forums and containers and then click on "update old groups" again. I tested posting to several -- all works as expected. Then I added a public container and public group -- all worked there, too.

Conclusion

Based on my experience with new code with existing containers and forums:

1. The dev code from November 17 works so long as you patch it with the code from #83.
2. You need to wipe all of your forums and containers and start over. I'm sure there is a better way of doing this, but since I am still in dev mode, it wasn't a problem. I'm sure I could have spent a bit more time to investigate the data - I'm betting that there was a mismatched tid or nid somewhere. Which leads me to believe that if new installs simply do my first step, they won't run into any of the problems -- so an upgrade path is still needed here.

I also tested adding a new group to be sure that there weren't any problems there as some people (including myself) seem to witness a ghost in the machine where new groups don't work but old do.

pro.methean’s picture

Was able to take comment #91 and apply to og_forum_resurrection as shown here: #1168000: Non group member posting into a public forum - taxonomy failure.

See also related issue: #1168010: Forum topic sometimes created as private even though created in public forum which matches #91's however.

Thanks Capellic!

thePanz’s picture

@pro.methan: Great work, I'll try to commit your patches ASAP and add you as a co-maintainer of OG Forum Resurrection module! Welcome on board!

pro.methean’s picture

I am concluding my patch for #1168010: Forum topic sometimes created as private even though created in public forum does not work, some discussion over there. Still working on it.

vegantriathlete’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Closed (won't fix)