Local Plugin tasks are not showing up

Local Plugin tasks are not showing up

by Dainis Abols -
Number of replies: 1

Hello, it seems I'm having the same issue as in this old thread: https://moodle.org/mod/forum/discuss.php?d=269372

I have made a local plugin. It is installed and shows up under plugins as well as created its initial tables etc, but the task is not appearing in task list.

I have made tasks before on activity plugins and they where working fine, but this is my first time making a local plugin. I have basic structure ready:

classes/task/unlocklesson_task.php

```
class unlocklesson_task extends scheduled_task {
    public function get_name()
    {
        return get_string('unlocklesson_task', 'local_pluginname');
    }

    public function execute()
    {
        // TODO
    }
}
```

db/tasks.php

```

$tasks = [
    // Lesson unlock task
    [
        'classname' => 'pluginname\task\unlocklesson_task', // Tried with local_pluginname as well
        'blocking'  => 0,
        'minute'    => '0',
        'hour'      => '0',
        'day'       => '*',
        'month'     => '*',
        'dayofweek' => '*',
    ],
];
```

But no matter what I change (reinstall, version bumps, cache clears, name changes) the task does not appear under other tasks. Any idea why?

PS: Using Moodle 3.9

Average of ratings: -
In reply to Dainis Abols

Re: Local Plugin tasks are not showing up

by Dainis Abols -
Found the solution. The error was in namespaces. Strangely, did not give any error at all
Average of ratings: Useful (1)