Skipping Automatic Registration GUID lookup and de-duplicating logic in Bright Course Launchers

Bright goes out of its way to keep duplicate registrations at bay. But in the re-certification scenario, application code wants to have its way and suppress this logic.

Two pieces are required:

  1. don't use the {{{launchbutton}}} builtin, roll your own launchbutton
  2. remove the "dont_duplicate" API parameter from the calls to Bright server

Sounds worse than it is. Just remove the {{{launchbutton}}} tag and use raw HTML

<input type="button" value="Launch course" class="none" onclick="Bright.launch('bright-course-Intro2a41bf20b-4609-46f3-a4dd-6be37bdbbb69', null, {registration_guid: 'Intro2a41bf20b-4609-46f3-a4dd-6be37bdbbb69-36a6bd9134ae32eb48efcf8b1ecd1cdd', dontuse_registration_in_course_data: true});">

Note, the first argument to Bright.launch is the template ID, so you will need to specify one to

     $bright->expandShortcode('id' => 'bright-course-id-i-will-use-in-mylaunch-button');

Note the 'bright-course-' prefix is required.

Using a BrightPluggable javascript filter:

BrightPluggable.create_registration_data = function(...args) {
  let createArgs = args[0];
  let extras = args[1];

  delete createArgs.dont_duplicate;   // otherwise we might just get a "duplicate" anyways, so suppress this check
  return createArgs;
}

somewhere in your page....