Alright here is what I am seeing every time I try to post a forum topic using a regular user to log into the forums, before and after they make a group:

warning: reset() [function.reset]: Passed variable is not an array or object in /mnt/gs02/herd05/15572/domains/guildcry.com/html/modules/og_forum/og_forum.module on line 749.
warning: key() [function.key]: Passed variable is not an array or object in /mnt/gs02/herd05/15572/domains/guildcry.com/html/modules/og_forum/og_forum.module on line 750.
warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in /mnt/gs02/herd05/15572/domains/guildcry.com/html/modules/og_forum/og_forum.module on line 751.

The administrator however does not see this error and everything proceeds as usual.

Here are the 3 lines of code as per ogforum.module file:

(749) reset($the_rest->option);
(750) $option_key = key($the_rest->option);
(751) if (array_key_exists($option_key, $all_results)) {

Please help!

CommentFileSizeAuthor
#4 og_forum-255109.patch430 bytesjohn morahan

Comments

luf’s picture

I attempted to set the users to be able to "administer forums" and the error disappears when trying to post something BUT appears now when attempting to EDIT a previous post.

So;
if User Access Control = No Administer Forums, then Error appears
if User Access Control = Administer Forums, then no error when post - but error when EDIT

Now to add to it, here is the error I see when I hit EDIT - and since I turned off "administer forums" on the user:

warning: reset() [function.reset]: Passed variable is not an array or object in /mnt/gs02/herd05/15572/domains/guildcry.com/html/modules/og_forum/og_forum.module on line 712.
warning: key() [function.key]: Passed variable is not an array or object in /mnt/gs02/herd05/15572/domains/guildcry.com/html/modules/og_forum/og_forum.module on line 713.
warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in /mnt/gs02/herd05/15572/domains/guildcry.com/html/modules/og_forum/og_forum.module on line 714.

luf’s picture

Here is the other piece of code for the second error.

Both seem to come from the user_access

if (!user_access('administer forums')) {
foreach ($form['taxonomy'][$vid]['#options'] as $key => $the_rest) {
reset($the_rest->option);
$option_key = key($the_rest->option);
if (!array_key_exists($option_key, $all_results)) {
unset($form['taxonomy'][$vid]['#options'][$key]);

mnlund’s picture

The probem is the first item in the options array: - Please choose - This has to be unset for the ongoing code to function. I solved it by unsetting unset($form['taxonomy'][$vid]['#options']['']); It works.

The code will then be:

      if (!user_access('administer forums')) {
      	unset($form['taxonomy'][$vid]['#options']['']);
        foreach ($form['taxonomy'][$vid]['#options'] as $key => $the_rest) {
john morahan’s picture

Status: Active » Needs review
StatusFileSize
new430 bytes

Here's ramsalt's suggestion as a patch.
Seems to work for me.

rconstantine’s picture

Status: Needs review » Closed (duplicate)

Already fixed in our developer copy and posted in at least two other issues. Will be included in the next release.