milesj / forum

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

admin panel is never shown #17

Closed rightawayai closed 11 years ago

rightawayai commented 12 years ago

I have integrated this plugin with my existing cakephp 1.3 application,

there's only single user with user_id and /forum/users/profile/2 shows it as administrator but when I do /admin/forum it gets redirected to my main application

I followed all the installation steps correctly

I am using WAMP server version 2.2

earlier login issues got fixed with 2.3 version of the forum

ceeram commented 12 years ago

Do you have admin routing enabled?

Edit: seems as the Session doesnt have the correct value for "Forum.isAdmin" Make sure you have $this->Session->delete('Forum'); in your login action, and have Auth->autoRedirect = false in your Users/AppController

milesj commented 12 years ago

The verifyAdmin() method either redirects to the last page you were on, or the login page. Seems like something else is going on?

https://github.com/milesj/cake-forum/blob/master/controllers/components/toolbar.php#L278

Can you debug the session and make sure Forum.isAdmin is true?

milesj commented 12 years ago

Is this still relevant?

milesj commented 12 years ago

Going to close this. If the problem persists, I would debug around a bit as no one else can reproduce this.

Gevie commented 11 years ago

Had the same issue as 100marks (EasyPHP 5.3.9) on Forum v3.2.0 RC3

The issue was here: https://github.com/milesj/cake-forum/blob/master/Controller/Component/ForumToolbarComponent.php#L76

The following change fixed my issue (!==, not !=) if ($user_id && $this->Controller->Auth->user($this->config['userMap']['status']) !== $this->config['statusMap']['banned']) {

Hope this helps anybody else with this rare problem.

milesj commented 11 years ago

!== seems like it would cause more problems, simply because '1' would not equal 1.

Gevie commented 11 years ago

I agree, I should probably specify this is a localhost change for me only, I expect != will work on production and it's likely an issue with my EasyPHP 5.3.9

Despite $this->config['userMap']['status'] being '1' and $this->config['statusMap']['banned'] being '2', the above condition would not pass because it believed they were both equal, that is why !== seemed to work oddly.

For now I have made a hack to check if it's localhost then use !== otherwise use != (dirty hack :|), unless you have any other ideas Miles? PS kudos on an awesome plugin.

milesj commented 11 years ago

I'll look into it a bit further, quite an unusual scenario.

milesj commented 11 years ago

I switched the logic around, can you try this?

https://github.com/milesj/cake-forum/commit/a2bd68eca960baf39e78988ef879957eeb801815

milesj commented 11 years ago

Is this still an issue?