After making the above upgrades I now (randomly) see this error on group pages and nodes belonging to groups

warning: Attempt to assign property of non-object in /var/www/html/epsrc_test/sites/all/modules/og_user_roles/og_user_roles.module on line 2420.

if (empty($gid)) {
$gid = 0; // This prevents us from getting error on non-group node/add
}else{
$_SESSION['og_last']->nid = $gid; <-- this is line 2420
$_SESSION['og_user_role'] = $gid;
}

Can anyone explain what it means and how to sort it?

Comments

michtoen’s picture

got something similiar: warning: Attempt to assign property of non-object in /var/www/htdocs/modules/og_user_roles/og_user_roles.module on line 2422.

somebodysysop’s picture

Assigned: Unassigned » somebodysysop
Status: Active » Needs review
StatusFileSize
new1.47 KB

Try the attached patch and see if the message goes away.

Utternonsense’s picture

I got errors when trying to patch the .module file but maybe that's me.

The point of the patch seems to be to remove $_SESSION['og_last']->nid = $gid; so i commented it out and it seems to have done the trick (for now).

somebodysysop’s picture

Status: Needs review » Fixed

Well, that's not exactly the point. It only uses it if it exists already. But, if it works, then fine. I'll commit to dev shortly.

bribiz’s picture

Just downloaded and installed 6.x-1.2 Had the same error. Used patch and it got rid of the warning regarding objects but the patch had errors. See Below:
(Update: Just realized this patch may be for 5.3.4. What needs to be done for 6.x-1.2?)

[mysys]# patch -p0 patching file og_user_roles.module
Hunk #1 FAILED at 1.
Hunk #2 succeeded at 2325 (offset 7 lines).
Hunk #3 succeeded at 2419 (offset -5 lines).
Hunk #4 FAILED at 2634.
2 out of 4 hunks FAILED -- saving rejects to file og_user_roles.module.rej
[mysys]# cat og_user_roles.module.rej
***************
*** 1,5 ****
<?php
- // $Id: og_user_roles.module,v 1.1.2.17 2008/11/24 18:14:04 somebodysysop Exp $

/**
* @file
--- 1,5 ----
<?php
+ // $Id: og_user_roles.module,v 3.1.1.2 2008/05/17 19:50:44 somebodysysop Exp $

/**
* @file
***************
*** 2627,2632 ****
$type = $_GET['type'];

if ($type) {
// Got this from node.module (node_access)
// No matter the type, this should return us the create permission.
$module = node_get_types('module', $type);
--- 2634,2641 ----
$type = $_GET['type'];

if ($type) {
+ // Convert the dashes in the URL back to underscores. http://drupal.org/node/349648
+ $type = str_replace('-', '_' , $type);
// Got this from node.module (node_access)
// No matter the type, this should return us the create permission.
$module = node_get_types('module', $type);

somebodysysop’s picture

This is a 5.x-3.4 issue, so that's what the patch is for. Will commit the change to .dev releases for both 5.x and 6.x.

somebodysysop’s picture

Modification commited to .dev branch in both 5.x and 6.x.

scottrigby’s picture

Version: 5.x-3.4 » 6.x-1.x-dev
Status: Fixed » Needs review
StatusFileSize
new1.12 KB

I'm attaching an updated patch for 6.x that deals with hunks 2 & 3 from the 5.x patch above.

Hunks 2 & 3 were not committed to the dev branch already it seems.

Hunk 1 may be in there already, but it's tough to tell because the same code repeats and the line numbers have changed since 5.x -- and the error went away without addressing it, so I left that out of this patch. Seems to work well for me :)

somebodysysop’s picture

$type = str_replace('-', '_' , $type);

This is already in og_user_roles_ognodeadd. Don't see the point in putting it in there twice.

scottrigby’s picture

Ah, thanks :)

But I also spoke too soon about it working for me. I saw I was able to click *edit* on group nodes appropriate to the context, but only now did I actually try *save* the node... and now I'm not able to :(

I get this warning message: "You do not have permission to edit or delete this content type (CONTENT_TYPE) in Group: GROUP_NAME (8)". I've looked through all the issues mentioned on the front page of the module. The one thing I'm doing is working in a local subdirectory... but this has not given me any warnings. Do you think it could be related? Or do you think maybe this patch isn't really working properly yet?

AntiNSA’s picture

warning: Attempt to assign property of non-object in /home/cyberfan/htdocs/modules/og_user_roles/og_user_roles.module on line 2422.

hmmm..... how can I fix this using D6???

somebodysysop’s picture

warning: Attempt to assign property of non-object in /home/cyberfan/htdocs/modules/og_user_roles/og_user_roles.module on line 2422.

Fix committed to .dev.

somebodysysop’s picture

I get this warning message: "You do not have permission to edit or delete this content type (CONTENT_TYPE) in Group: GROUP_NAME (8)"...Do you think it could be related?.

No. You first need to make sure that the user actually has the permission(s) to edit/delete nodes of that content type in that group.

If you still feel the user should be able to post, then you should open another issue with the relevant information. This issue will be closed very shortly.

somebodysysop’s picture

Status: Needs review » Fixed

Patch hunk #2 (non-object issue) committed to dev.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.