bizley / yii2-podium

Yii 2 forum module project
Apache License 2.0
167 stars 59 forks source link

Error while iterating over moderators forums (missing precheck for forum presence) #131

Open truemirror opened 6 years ago

truemirror commented 6 years ago

moderator haven't moderator's panel in thread and when anybody want to see his profile - error error log : "'yii\base\ErrorException' with message 'Trying to get property of non-object' in /home/www/site.com/vendor/bizley/podium/src/views/members/view.php:109" dump of $model->mods : 0 => bizley\podium\models\Mod#1 ( [yii\db\BaseActiveRecord:_attributes] => [ 'id' => 14 'user_id' => 29 'forum_id' => 27 ] [yii\db\BaseActiveRecord:_oldAttributes] => [ 'id' => 14 'user_id' => 29 'forum_id' => 27 ] [yii\db\BaseActiveRecord:_related] => [] [yii\base\Model:_errors] => null [yii\base\Model:_validators] => null [yii\base\Model:_scenario] => 'default' [yii\base\Component:_events] => [] [yii\base\Component:_behaviors] => [] )

bizley commented 6 years ago

Have you by any chance deleted manually forum entry with the ID 27 in your database?

bizley commented 6 years ago

But nevertheless there should be additional check for existance of this.

truemirror commented 6 years ago

Have you by any chance deleted manually forum entry with the ID 27 in your database

forum entry with the ID 27 exist in database. Same error with any existing forum entries and with any users who has moderator role

truemirror commented 6 years ago

when in yii2-podium/src/models/Thread.php line 249 if (in_array($userId, $this->forum->getMods())) { change to if (User::can(Rbac::ROLE_MODERATOR)) { moderator's panel present, for each moderator in all threads (like Admin)