bizley/yii2-podium

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

truemirror opened this issue · 4 comments

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] => [] )

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

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

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

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)