admin edit not possible? (Bugs)

by Nico Hoffmann @, Saturday, June 01, 2019, 15:04 (82 days ago)

Hello,

i have some "sticky" threads, i.e. they remain always on the top. Now, one thread has become irrelevant for being always on the top, and i tried to remove the sticy-feature by login as admin and unchecking the checkbox.

After klicking OK I got the message "Der Eintrag kann nicht bearbeitet werden! Entweder es besteht keine Berechtigung, der Bearbeitungszeitraum ist abgelaufen, der Thread ist gesperrt oder der Eintrag hat bereits Antworten."
Indeed, the thread is rather old and has follow ups. But this should not prevent edits by admin?

Any hints?

Nico Hoffmann

P.S.: the thread was started before update from 2.3.5 to 2.4.20.

Avatar

admin edit not possible?

by Auge ⌂ @, Saturday, June 01, 2019, 16:49 (82 days ago) @ Nico Hoffmann

Hello

i have some "sticky" threads, …. Now, one thread has become irrelevant for being always on the top, and i tried to remove the sticy-feature by login as admin and unchecking the checkbox.

After klicking OK I got the message "Der Eintrag kann nicht bearbeitet werden! Entweder es besteht keine Berechtigung, der Bearbeitungszeitraum ist abgelaufen, der Thread ist gesperrt oder der Eintrag hat bereits Antworten."

I tried to reproduce the reported bug but I can't. I am able to unstick and stick threads here in this forum and also in my own forum (both running version 2.4.20).

Indeed, the thread is rather old and has follow ups. But this should not prevent edits by admin?

No it shouldn't. The message is caused by a check for the user type and will also appear if you only want to edit the text of the posting. In the line #1255 of the posting.inc.php the script calls the function to check the authorisation to edit. The function get_edit_authorization itself checks the user type beginning with line 1688 and checks for an admin or mod in line #1690. Administrators and moderators are able to edit an entry at every time. In every other case the time and the reply restriction take effect.

    if($_SESSION[$settings['session_prefix'].'user_type'] > 0) // admin or mod
     {
      $authorization['edit'] = true;
      $authorization['delete'] = true;
     }

So my question is, why you get not detected as an administrator (or moderator).

P.S.: the thread was started before update from 2.3.5 to 2.4.20.

I am not aware of any change, related to the stick-thread-feature, that could cause this problem.

Tschö, Auge

--
Trenne niemals Müll, denn er hat nur eine Silbe!

admin edit not possible?

by Nico Hoffmann @, Sunday, June 02, 2019, 08:38 (81 days ago) @ Auge

I am not aware of any change, related to the stick-thread-feature, that could cause this problem.


I solved the porblem. I was caused by a modification in posting.inc.tpl, which I inserted some time ago, see https://mylittleforum.net/forum/index.php?id=6027. As I remember, there were never any problems with it.
I added that modification also in 2.4.20. Now, I removed it for testing. Obviously, with my modification the problem is present and without the modification there is no problem with sticky threads. So far, I didn't investigations, why the problem apears in the recent version.

Sorry for any inconveniences.

Nico

Avatar

admin edit not possible?

by Auge ⌂ @, Sunday, June 02, 2019, 10:07 (81 days ago) @ Nico Hoffmann

Hello

I am not aware of any change, related to the stick-thread-feature, that could cause this problem.


I solved the porblem. I was caused by a modification in posting.inc.tpl, which I inserted some time ago, see https://mylittleforum.net/forum/index.php?id=6027. As I remember, there were never any problems with it.

I can't see the correlation between your changes for making it possible for users to insert tags and the sticky feature. You made the input field accessible to registered users and changed the checks when checking and saving the data. So far, so unremarkable.

I added that modification also in 2.4.20. Now, I removed it for testing. Obviously, with my modification the problem is present and without the modification there is no problem with sticky threads. So far, I didn't investigations, why the problem apears in the recent version.

As said before, I see no obvious reason for the fail in your code. Are there further changes in the posting.inc.php?

Sorry for any inconveniences.

There is none at this point.

Tschö, Auge

--
Trenne niemals Müll, denn er hat nur eine Silbe!

admin edit not possible?

by Nico Hoffmann @, Friday, June 07, 2019, 21:18 (76 days ago) @ Auge

As said before, I see no obvious reason for the fail in your code. Are there further changes in the posting.inc.php?

F.Y.I.: I found the reason. It was a typo in posting.inc.php. I modified to

if (isset($_POST['tags']) && isset($_SESSION[$settings['session_prefix'] . 'user_type']) && ($_SESSION[$settings['session_prefix'] . 'user_type'] = 0)) {

instead

if (isset($_POST['tags']) && isset($_SESSION[$settings['session_prefix'] . 'user_type']) && ($_SESSION[$settings['session_prefix'] . 'user_type'] >= 0)) {

Note the missing '>' in the above expression.

Now, I have both: admin edit AND tags for simple users :-)

N.

Avatar

admin edit not possible?

by Micha ⌂, Saturday, June 08, 2019, 07:47 (75 days ago) @ Nico Hoffmann

Hi,

this, is not the original source, because there is an error

if (isset($_POST['tags']) && isset($_SESSION[$settings['session_prefix'] . 'user_type']) && ($_SESSION[$settings['session_prefix'] . 'user_type'] = 0)) {
--------------------------------------------------------------------------------------------------------------------------------------------------^

Now, I have both: admin edit AND tags for simple users :-)

In your case, the simple modification

if (isset($_POST['tags'])) {

is needed.

/Micha

--
applied-geodesy.org - OpenSource Least-Squares Adjustment Software for Geodetic Sciences

RSS Feed of thread
powered by my little forum