original_string: public static function updateRole($id, $role)
      {
          $activity = static::find()->where(['user_id' => $id])->limit(1)->one();
          if (empty($activity)) {
              Log::error('Cannot update user activity', $id, __METHOD__);
              return;
          }
          $activity->user_role = $role;
          if (!$activity->save()) {
              Log::error('Cannot update user activity', $id, __METHOD__);
              return;
          }
          Podium::getInstance()->podiumCache->delete('forum.lastactive');
      }
code: public static function updateRole($id, $role)
      {
          $activity = static::find()->where(['user_id' => $id])->limit(1)->one();
          if (empty($activity)) {
              Log::error('Cannot update user activity', $id, __METHOD__);
              return;
          }
          $activity->user_role = $role;
          if (!$activity->save()) {
              Log::error('Cannot update user activity', $id, __METHOD__);
              return;
          }
          Podium::getInstance()->podiumCache->delete('forum.lastactive');
      }
code_tokens: public static function updateRole ( $ id , $ role ) { $ activity = static :: find ( ) -> where ( [ 'user_id' => $ id ] ) -> limit ( 1 ) -> one ( ) ; if ( empty ( $ activity ) ) { Log :: error ( 'Cannot update user activity' , $ id , __METHOD__ ) ; return ; } $ activity -> user_role = $ role ; if ( ! $ activity -> save ( ) ) { Log :: error ( 'Cannot update user activity' , $ id , __METHOD__ ) ; return ; } Podium :: getInstance ( ) -> podiumCache -> delete ( 'forum.lastactive' ) ; }
docstring: Updates role after change.
  @param int $id
  @param int $role
docstring_tokens: Updates role after change .