Support Forum

Access denied – you do not have permission

DA Dave
Dave
Member

I have one user, which is a moderator, reporting this issue and I can repeat it when logged in as that user. It does not happen when logged in as an admin from my personal experience and no one else has reported the problem.

Whenever the user attempts to reply to a topic the “post saved” modal appears then as the page reloads to show the post with the new reply the following error is displayed:

Access denied – you do not have permission

Warning: Cannot modify header information – headers already sent by (output started at /problem-with-post-edit-buttonome/XXXXXX/public_html/wp-content/plugins/simple-press/sp-api/sp-api-primitives.php:59) in /problem-with-post-edit-buttonome/XXXXXX/public_html/wp-includes/pluggable.php on line 1173

Here are the relevant error log entries:

November 10, 2014 3:52 am | spaErrWarning | 1 | phpfile: /simple-press/sp-api/sp-api-plugins.php

line: 758

function: fread

Warning | fread(): Length parameter must be greater than 0

November 10, 2014 3:52 am | spaErrWarning | 1 | phpfile: /simple-press/sp-api/sp-api-plugins.php

line: 588

function: fread

Warning | fread(): Length parameter must be greater than 0

November 10, 2014 4:13 am | spaErrNotice | 2 | phpfile: /simple-press/sp-startup/admin/spa-admin-framework.php

line: 401

function: spa_check_warnings

Notice | Undefined index: active

November 10, 2014 3:54 am | spaErrNotice | 3 | phpfile: rtsock/public_html/wp-content/sp-resources/forum-plugins/admin-bar/library/sp-admin-bar-components.php

line: 15

function: sp_admin_bar_do_new_post_list

Notice | Undefined property: spUser::$sfadminbar

November 5, 2014 9:34 pm | spaErrNotice | 1 | phpfile: /simple-press/forum/profile/forms/sp-form-profile.php

line: 109

function: include_once

Notice | Undefined property: spUser::$location

20 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

Let’s start by doing something obvious! 

Go to the forum admin > Toolbox > Housekeeping and click on the task to ‘Reset Auths Cache’ in case all this is just the one user with scrambled permissions. Get your moderator to see if that shifts anything.

None of the entries there in the log are actual errors as you can see and for at least ine of them I can not locate the line of code being referenced. What version of SP is this?

However – one of those entries is a little worrying. Can you go to the forum admin > Options > Global Settings and turn OFF the two options in the ‘CSS/JS Combined Caching’ section. Let’s leave them off until we sort the user issue.

Finally – after the cache reset can you also clear the error log so we can see what gets reported when your moderator gives it a try.

DA Dave
Dave
Member

That didn’t work. Something interesting is that the user can create a new topic, just not reply to one created by someone else.

Edit – forgot to add error log information:
November 10, 2014 4:59 am | spaErrNotice | 1 | phpfile: /simple-press/sp-startup/admin/spa-admin-framework.php
line: 401
function: spa_check_warnings
Notice | Undefined index: active
November 10, 2014 4:59 am | spaErrNotice | 30 | phpfile: /simple-press/sp-api/sp-api-auths.php
line: 32
function: sp_get_auth
Notice | Undefined offset: 18

YS Yellow Swordfish
Yellow Swordfish
Member

And what was in the log after you cleared it and tried with the user account again?

DA Dave
Dave
Member

We must have crossed paths as I was editing my previous post to add the errors. :)

YS Yellow Swordfish
Yellow Swordfish
Member

Sorry – and the other question I asked as well… what version please?

DA Dave
Dave
Member

Wow, I’m really screwing up today. Sorry to waste your time because I’m overlooking questions!

Simple:Press
Version: 5.5.2
Build: 12017

WordPress
Version: 4.0

YS Yellow Swordfish
Yellow Swordfish
Member

I am struggling with the option of your moderator not being able to reply and I doubt the notices you are seeing in the error log have any bearing on this but let’s see about getting rid of them to test what happens. So…

Can you please go to the forum admin > themes > mobile tablet theme. There appears to be some confusion over whether you have a theme selected for tablets or not. If you DO have it enabled, could you select a different theme – save it and then reselect the one you want and update again. Also click on the update button in the top section just to refresh the data.

Next – forum admin > permissions and select the permission set your moderator’s access is assigned to (may be more than one) and (a) ensure the options are set correctly and (b) change something and update… (c) change ot back again and update. Again – this is just to ensure the data is refreshed.

And let’s see if those entries disappear. You will need to clear the error log before testing.

DA Dave
Dave
Member

Table theme was not enabled, but I’ve enabled it and selected a theme.
User is only a member of the Moderators group, which has been updated.
Error log cleared and error persists.

November 10, 2014 9:02 am | spaErrNotice | 14 | phpfile: /simple-press/sp-api/sp-api-auths.php
line: 32
function: sp_get_auth
Notice | Undefined offset: 18

YS Yellow Swordfish
Yellow Swordfish
Member

While still unconvinced that this notice has anything to do with your moderator’s problems I am keen to try and track it down so it is a good place to start.

Can you do something for me please…

Go to the forum admin > toolbox > data inspector and turn on the option to show ‘spGlobals’ in the Control Data section. 

Now run a front-end forum page – any view should do. Do NOT be alarmed at the display. You are the only user who will be getting to see all of this!

Way, way down the dump of values you will find an array called ‘auths-map’. Can you tell me what is displayed at index position 18 please?

Then below the auths-map list there is an ‘auths’ section for each individual permission. perhaops you cou;d also tell me what it shows for position 18.

Then you may want to turn the inspection of spGlobals off again!

DA Dave
Dave
Member

Yellow Swordfish said
Way, way down the dump of values you will find an array called ‘auths-map’. Can you tell me what is displayed at index position 18 please?
Then below the auths-map list there is an ‘auths’ section for each individual permission. perhaops you cou;d also tell me what it shows for position 18.

FYI, the user does show as a Moderator under [forum_moderators] => Array
Under [auths] => Array
[18] = [auth_id] => 18
[auth_name] => delete_any_post
[auth_desc] => Can delete any post
[active] => 1
[ignored] => 0
[enabling] => 0
[admin_negate] => 0
[auth_cat] => 5
[warning] =>

Under [auths_map] => Array position 18 is [delete_any_post] => 18

MP Mr Papa
Mr Papa
Member

not sure where andy was going with his question, so will leave that to him…  I do agree though that the notice is unlikely unrelated… those seem to come from ajax type requests where things may not be set up (though we cannot replicate on call)…

for the moderator user in question, if you go to their profile (you as admin can do this), and go to profile – permissions and look at the forum in question, what do you see?

YS Yellow Swordfish
Yellow Swordfish
Member

I have to say I am somewhat stumped on this one. But first…:

@mr-papa – I was asking about the auth 18 index value simply because it repeatedly appears in the SP error log as an undefined offset. No – I do not think this is responsible for the issue with the moderator user but it does seem odd to find that it is, actually, defined.

OK – can we just recap here to make sure I have everything correct.

You have one user (only) who happens to be a moderator who is unable to reply to any posts. Upon submitting a post reply from the editor, it starts to save and then stops with an ‘Access denied – you do not have permission’ message and, I assume, a blank screen. This result can be verified on a different PC thus suggesting it is not a local PC or browser issue.

Is that accurate? 

Perhaps another data dump is required here so I can take a long look at what is getting passed. Using the Data Inspector again, could you turn on the control data for ‘spThisUser’ and then log in AS the moderator user with the problem. It is their data we need to look at.

Now – you are not going to want to display this in the public forums here. It is also somewhat lengthy so what I would really prefer if possible is if you could copy and paste the content to a text file and then email it to me as an attachment. I will send you a PM with an email address to use if that is OK.

Maybe I can spot something specific. I can at least check the data against all the access denied points.

DA Dave
Dave
Member

Yellow Swordfish said
You have one user (only) who happens to be a moderator who is unable to reply to any posts. Upon submitting a post reply from the editor, it starts to save and then stops with an ‘Access denied – you do not have permission’ message and, I assume, a blank screen. This result can be verified on a different PC thus suggesting it is not a local PC or browser issue?
Is that accurate?

Absolutely!

Perhaps another data dump is required here so I can take a long look at what is getting passed. Using the Data Inspector again, could you turn on the control data for ‘spThisUser’ and then log in AS the moderator user with the problem. It is their data we need to look at.

There was no data displayed when the page rendered (logged in as person in question in a separate browser).

I’ll reply to your PM with login credentials for both admin and user.