# Bug with MetaMagik

**URL:** <https://kanboard.discourse.group/t/bug-with-metamagik/2756>\
**Category:** Plugins\
**Created:** [April 11, 2023, 10:54am UTC](https://kanboard.discourse.group/t/bug-with-metamagik/2756 "2023-04-11T10:54:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![John](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@John](https://kanboard.discourse.group/u/John)\
**Post date:** [April 11, 2023, 10:54am UTC](https://kanboard.discourse.group/t/bug-with-metamagik/2756/1 "2023-04-11T10:54:38Z")

</div>

Hi!

Since KB 1.2.27 (and still in KB 1.2.28), when someone create a new task, the _creator\_id_ value in the _tasks_ table stays at 0. I found that if I remove the MetaMagik plugin, then create a new task, the creator\_id is filled with the correct user ID.

I fixed it by replacing this code from the NewTaskCreationModel.php file

```auto
if ($this->userSession->isLogged() && !empty($values['creator_id'])) {
    $values['creator_id'] = $this->userSession->getId();
}

```

By this

```auto
        if ($this->userSession->isLogged()) {
            $values['creator_id'] = $this->userSession->getId();
        }

```

It works but I don’t know if this is the correct way to do it

Thanks!

---

<div class="post-metadata">

**Author:** ![creecros](https://yyz2.discourse-cdn.com/free1/user_avatar/kanboard.discourse.group/creecros/32/156_2.png) [@creecros](https://kanboard.discourse.group/u/creecros)\
**Post date:** [April 11, 2023, 11:29am UTC](https://kanboard.discourse.group/t/bug-with-metamagik/2756/2 "2023-04-11T11:29:27Z")

</div>

Best to make an issue report on github for this. I am unaware of bugs unless they get reported. Ill look into it.

---

<div class="post-metadata">

**Author:** ![creecros](https://yyz2.discourse-cdn.com/free1/user_avatar/kanboard.discourse.group/creecros/32/156_2.png) [@creecros](https://kanboard.discourse.group/u/creecros)\
**Post date:** [April 11, 2023, 1:21pm UTC](https://kanboard.discourse.group/t/bug-with-metamagik/2756/3 "2023-04-11T13:21:37Z")

</div>

ok, it was caused by this issue, which I thought i fixed, but my brain was apparently working backwards.

> <https://github.com/creecros/MetaMagik/issues/80>
>
> Please check line 97 in "NewTaskCreationModel.php", the creator will be overwrit…ten by the current logged in user, even if the column of creator in the csv template is filled .
> 
> \`\`\`
> if ($this-\>userSession-\>isLogged()) {
> $values\['creator\_id'\] = $this-\>userSession-\>getId();
> }
> \`\`\`
> 
> I also checked the original creation model in Kanboard repository, seems that it also has the same issue. (not sure)

it should have been:

```auto
if ($this->userSession->isLogged() && empty($values['creator_id'])) {
    $values['creator_id'] = $this->userSession->getId();
}

```

Fixed in Version 1.5.5:

> **[Release 1.5.5 · creecros/MetaMagik](https://github.com/creecros/MetaMagik/releases/tag/1.5.5)**
>
> Fix bad logic in NewTaskCreationModel.php causing the "Creator" field to remain empty.
> 
> Orignal issue #80
> 2639846

---

<div class="post-metadata">

**Author:** ![John](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@John](https://kanboard.discourse.group/u/John)\
**Post date:** [April 12, 2023, 7:36am UTC](https://kanboard.discourse.group/t/bug-with-metamagik/2756/4 "2023-04-12T07:36:36Z")

</div>

Thank you for the quick fix!
