original_string: public static function unblock_user(int $userid, int $usertounblockid) {
          global $DB;
  
          if ($blockeduser = $DB->get_record('message_users_blocked',
                  ['userid' => $userid, 'blockeduserid' => $usertounblockid])) {
              $DB->delete_records('message_users_blocked', ['id' => $blockeduser->id]);
  
              // Trigger event for unblocking a contact.
              $event = \core\event\message_user_unblocked::create(array(
                  'objectid' => $blockeduser->id,
                  'userid' => $userid,
                  'relateduserid' => $usertounblockid,
                  'context' => \context_user::instance($userid)
              ));
              $event->add_record_snapshot('message_users_blocked', $blockeduser);
              $event->trigger();
          }
      }
code: public static function unblock_user(int $userid, int $usertounblockid) {
          global $DB;
  
          if ($blockeduser = $DB->get_record('message_users_blocked',
                  ['userid' => $userid, 'blockeduserid' => $usertounblockid])) {
              $DB->delete_records('message_users_blocked', ['id' => $blockeduser->id]);
  
              // Trigger event for unblocking a contact.
              $event = \core\event\message_user_unblocked::create(array(
                  'objectid' => $blockeduser->id,
                  'userid' => $userid,
                  'relateduserid' => $usertounblockid,
                  'context' => \context_user::instance($userid)
              ));
              $event->add_record_snapshot('message_users_blocked', $blockeduser);
              $event->trigger();
          }
      }
code_tokens: public static function unblock_user ( int $ userid , int $ usertounblockid ) { global $ DB ; if ( $ blockeduser = $ DB -> get_record ( 'message_users_blocked' , [ 'userid' => $ userid , 'blockeduserid' => $ usertounblockid ] ) ) { $ DB -> delete_records ( 'message_users_blocked' , [ 'id' => $ blockeduser -> id ] ) ; // Trigger event for unblocking a contact. $ event = \ core \ event \ message_user_unblocked :: create ( array ( 'objectid' => $ blockeduser -> id , 'userid' => $ userid , 'relateduserid' => $ usertounblockid , 'context' => \ context_user :: instance ( $ userid ) ) ) ; $ event -> add_record_snapshot ( 'message_users_blocked' , $ blockeduser ) ; $ event -> trigger ( ) ; } }
docstring: Handles unblocking a user.
  
  @param int $userid The id of the user who is unblocking
  @param int $usertounblockid The id of the user being unblocked
docstring_tokens: Handles unblocking a user .