milesj / forum

[Deprecated] A CakePHP plugin for forum / bulletin board systems.
MIT License
131 stars 57 forks source link

Update ForumToolbarComponent.php #50

Closed dilab closed 10 years ago

dilab commented 10 years ago

It should not only check the Forum session. The moderator permission will never be updated.

Even for a non-login user, you have a Forum.lastVisit session value. If you only check the Forum session, the moderators' permission will not work correctly.

milesj commented 10 years ago

The point of that code is to only query the DB once on initial login. Uncommenting that line adds 2+ queries to each page.

dilab commented 10 years ago

Without uncommenting the line. Here is the problem: A moderator comes to the page, and when he logins, he will not be able to see the "Moderate" button.

Reason is because the session "Forum.lastVisit" is set before moderator logins.

milesj commented 10 years ago

Yes, that's a well known problem that occurs within any kind of application or software. It's the reason session regeneration/expiration exists, or the bootstrapping of applications when a user logs in. This kind of logic should not be done on every page.

If you really need this functionality, you're welcome to use your fork.

dilab commented 10 years ago

Thanks for verification.