Closed (fixed)
Project:
Simple Access
Version:
7.x-2.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Dec 2010 at 22:35 UTC
Updated:
18 Jun 2014 at 01:50 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jerrac commentedI forgot to mention that I can edit things just fine as an admin.
Comment #2
ctpmp commentedI'm seeing this also trying to add content as a non-admin. The problematic code is:
The innerJoin method does not return an object that can be chained like this.
http://api.drupal.org/api/drupal/includes--database--select.inc/function...
Changing to this seems to work
Comment #3
Joe90 commentedIs the workaround by ctpmp above considered as the fix? If so it's not doing it for me? I am using Simple Access and forum Access on Drupal 7
I have the need for private forums and private blogs. No non-admin users can create a blog entry or forum post and get the error page as above:
[code]Fatal error: Call to a member function condition() on a non-object in /d7/sites/all/modules/simple_access/simple_access.module on line 657[/code]
Admin can create blog and forum posts OK (though strangely non of the boxes are ticked to do this in permissions for Admin!)
Tried ctpmp's fix but the errors persisted, complaining about last line in the fix.
Please help / advise.
Comment #4
idealworldweb commentedctpmp's fix is working for me, as I had the same problem on non-admin members with the correct permissions to edit pages. Thanks
Comment #5
kscott22 commentedI hate to mess with module code, but ctpmp's suggestion in #2 worked for me. Thanks!
Comment #6
anj commentedThe fix in #2 worked for me too. Here it is in patch form.
Comment #7
andresp commentedthis fix works for me too
Comment #8
drifter commentedThe proposed patch works for me, thanks!
Comment #9
anj commentedI just realised that this bug stops anyone from creating any content under D7. Upgrading to 'critical' and marking as 7.x-2.0-beta1 as I just re-tested against the patch against that release and it work as expected.
Comment #10
Anonymous (not verified) commentedadding patch because current doens't work in my drush make installation
Comment #11
simon_w108 commentedwhoah! this is still broken in the main version?!?
ctpmp's fix does work, but the penultimate line is wrong. correction below:
Comment #12
azinck commented#11 works. Trivial fix, let's get this committed!
Comment #13
kim.pepperThe problem is incorrect usage of ->innerJoin() It doesn't return a SelectQueryInterface
@see http://api.drupal.org/api/drupal/includes%21database%21select.inc/functi...
The following patch combines the fixes in #10 and #11
Comment #14
Jason Dean commented#13 works for me - thanks! (phew)
Comment #15
dianacastillo commentedCan you put this into the latest module please? or is it already there?
Comment #16
dianacastillo commentedI get this when an editor tries to create content as well:
Fatal error: Call to a member function condition() on a non-object in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\pn\sites\all\modules\simple_access\simple_access.module on line 637
Comment #17
dianacastillo commentedComment #18
dianacastillo commentedI'm confused, because in this patch you have something different than what is in the module now:
while ($group = $result->fetchAssoc(PDO::FETCH_ASSOC)) {
$groups[$group['gid']] = $group;
$groups[$group['gid']]['access'] = $default_access;
}
Comment #19
dianacastillo commentedI get these errors when I applied the patch
Notice: Undefined variable: roles in simple_access_group_select() (line 628 of C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\pn\sites\all\modules\simple_access\simple_access.module).
Warning: Invalid argument supplied for foreach() in DatabaseCondition->compile() (line 1854 of C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\pn\includes\database\query.inc).
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')) GROUP BY g.gid' at line 2: SELECT g.gid AS gid FROM {simple_access_groups} g INNER JOIN {simple_access_roles} r ON g.gid = r.gid WHERE (rid IN ()) GROUP BY g.gid; Array ( ) in simple_access_group_select() (line 630 of C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\pn\sites\all\modules\simple_access\simple_access.module).
Comment #20
dianacastillo commentedWhen I give the editor permissions to "Administer Content " in the permissions page , this error goes away (without applying the patch which doesnt work for me)
Comment #21
simon georges commentedClosing #1916384: non admin cannot add content as a duplicate of this one.
Comment #22
simon georges commentedClosing #1660162: I found a bug with Drupal 7 code. Unable to edit posts. as a duplicate of this one.
Comment #23
chertzog#13 Works for me.
Comment #24
gordon commentedThis still needs some work. I don't like how this fix has been done.
Comment #25
kim.pepper@gordon Can you please elaborate? You don't like the syntax? or the approach?
I believe the error was due to incorrect usage of the api. Happy to discuss alternate approaches. :-)
Kim
Comment #26
gordon commentedI understand, I am going to have a look at this tomorrow and clean up the code. Basically I would prefer to chain as much as possible and them access the query to add the joins.
Comment #27
dianacastillo commentedthis patch only created more problems for me.
Comment #28
gordon commentedI have done some tidy up on the patch so it is cleaner, but basically the same patch.
I am wondering if the innerJoin() issue should be raised as an issue, since it can't be chained.
Comment #29
gordon commentedI have committed this to dev.
@dianacastillo what were the problems which you were having with this patch?
Comment #30
gordon commentedComment #31
kim.peppergroupBy() returns a SelectQuery object, so you could just put the join at the end of that chain.
http://api.drupal.org/api/drupal/includes%21database%21select.inc/functi...
K
Comment #32
dianacastillo commentedI posted the errors I got with this patch previously #19 http://drupal.org/node/991956#comment-7062164
Comment #33
gordon commentedI am not sure what the problem is there because $roles can never be uninitilised.
$user->roles is always populated with a value, and it can never be empty either.
If you are still getting this issue, please raise another issue.
Comment #34
dianacastillo commentedHi, i have not tried the patch again because when I give the editor permissions to "Administer Content " in the permissions page , this error goes away . thanks