original_string: public static function unpublish($publication) {
          global $DB;
          // Unpublish the publication by web service.
          api::unregister_courses($publication->hubcourseid);
  
          // Delete the publication from the database.
          $DB->delete_records('course_published', array('id' => $publication->id));
  
          // Add confirmation message.
          $course = get_course($publication->courseid);
          $context = \context_course::instance($course->id);
          $publication->courseshortname = format_string($course->shortname, true, ['context' => $context]);
          $publication->hubname = 'Moodle.net';
          \core\notification::add(get_string('courseunpublished', 'hub', $publication), \core\output\notification::NOTIFY_SUCCESS);
      }
code: public static function unpublish($publication) {
          global $DB;
          // Unpublish the publication by web service.
          api::unregister_courses($publication->hubcourseid);
  
          // Delete the publication from the database.
          $DB->delete_records('course_published', array('id' => $publication->id));
  
          // Add confirmation message.
          $course = get_course($publication->courseid);
          $context = \context_course::instance($course->id);
          $publication->courseshortname = format_string($course->shortname, true, ['context' => $context]);
          $publication->hubname = 'Moodle.net';
          \core\notification::add(get_string('courseunpublished', 'hub', $publication), \core\output\notification::NOTIFY_SUCCESS);
      }
code_tokens: public static function unpublish ( $ publication ) { global $ DB ; // Unpublish the publication by web service. api :: unregister_courses ( $ publication -> hubcourseid ) ; // Delete the publication from the database. $ DB -> delete_records ( 'course_published' , array ( 'id' => $ publication -> id ) ) ; // Add confirmation message. $ course = get_course ( $ publication -> courseid ) ; $ context = \ context_course :: instance ( $ course -> id ) ; $ publication -> courseshortname = format_string ( $ course -> shortname , true , [ 'context' => $ context ] ) ; $ publication -> hubname = 'Moodle.net' ; \ core \ notification :: add ( get_string ( 'courseunpublished' , 'hub' , $ publication ) , \ core \ output \ notification :: NOTIFY_SUCCESS ) ; }
docstring: Unpublish a course
  
  @param stdClass $publication
docstring_tokens: Unpublish a course