Attached is a patch... It seems the $al var is an object, not an array. If the $op is 'unpublish' or 'publish' you need to pick up the object.

I believe this is the same error this issue (http://drupal.org/node/338784) is getting too, though I haven't read through the code...

CommentFileSizeAuthor
authoring_aliases.d5.patch1.19 KBelvis2

Comments

elvis2’s picture

here is the error output:
Fatal error: Cannot use object of type stdClass as array -- /home/xxxx/public_html/sites/all/modules/authoring_aliases/authoring_aliases.module on line 199

neochief’s picture

Sorry, I have no way to test it right now under 5.x. Does it work for you? If it is, I can simply commit this patch. Please, confirm.

elvis2’s picture

Well, I see that the name change doesn't actually take place. The original user name (admin) is mapped within the auth alias settings but is not being carried over. I will try to check the code again this weekend, my guess is that the function authoring_aliases_comment() needs to be redone.

I am wondering why you are setting these:
$a1['uid'] = $alias['uid'];
$a1['name'] = $alias['name'];

within the if statement:
if ($alias['comments'])

Original code (not based on my patch)

function authoring_aliases_comment(&$a1, $op) {
  switch ($op) {
    case 'insert':
    case 'update':
    case 'publish':
      if ($a1['uid']) {
        $result = db_query('SELECT u.uid, u.name, a.comments FROM {authoring_aliases} a INNER JOIN {users} u ON a.uid_as = u.uid WHERE uid_from = %d', array($a1['uid']));
        $alias = db_fetch_array($result);
        
        if ($alias['comments']) {
          db_query("UPDATE {comments} SET uid = %d, name = '%s' WHERE cid = %d", $alias['uid'], $alias['name'], $a1['cid']);

          $a1['uid'] = $alias['uid'];
          $a1['name'] = $alias['name'];
        }
      }
    break;
  }
}

elvis2’s picture

Ok, I see where the problem is coming from... if you remove

    case 'publish':

The errors go away and authoring alias works as it was intended. Why would we need to check the publish case? The module is changing the name upon insert and update, and showing the alias name on node loads.