sensei icon indicating copy to clipboard operation
sensei copied to clipboard

Admin user adding modules to a teacher course through the "legacy ways" don't fix the module slug

Open renatho opened this issue 4 years ago • 1 comments

If an admin user tries to add modules through legacy ways (course meta box, or wp-admin/edit-tags.php?taxonomy=module) to a teacher course, it doesn't add the teacher prefix to the slug, which can cause some future issues.

Steps to Reproduce

  1. Log-in as admin.
  2. Create a teacher.
  3. Create a course and remove the blocks.
  4. Add the teacher to the course.
  5. Save, and refresh the page.
  6. Add some new modules through the meta box.
  7. Save the course.
  8. Notice that the modules don't appear with the teacher name (it means it doesn't have the correct slug - with the teacher ID as prefix).

What I Expected

To have the correct slug.

What Happened Instead

The slug is as an admin module.

Sensei LMS version

3.8.1

Context / Source

p1614946201006700-slack-C6GGX896G

Issue related to https://github.com/Automattic/sensei/issues/3813

Some methods for reference:

  • Sensei_Core_Modules::add_new_module_term
  • Sensei_Course_Structure::save_module

renatho avatar Mar 05 '21 22:03 renatho

I created it as Low priority since it has not a clear bug that can be caused through this. And if we refactor the architecture of the modules, we can close this.

renatho avatar Mar 05 '21 22:03 renatho