Correct way to extend Bootstrap Modal - lock, unlock
Looks fine to me, except that you failed declare the e variable in the lock/unlock functions. So it's an automatic global, which isn't good.

With a little bit of cleanup:

(function ($) {
  var _original = $.fn.modal.Constructor.prototype.hide;

  function trigger(target, name, relatedTarget) {
    target.trigger($.Event(name, { relatedTarget: relatedTarget }));
  }

  $.extend($.fn.modal.Constructor.prototype, {
    hide: function (_relatedTarget) {
      if (this.isLocked) return;
      return _original.call(this, _relatedTarget);
    },

    lock: function (_relatedTarget) {
      this.isLocked = true;
      trigger(this.$element, 'lock.bs.modal', _relatedTarget);
    },

    unlock: function (_relatedTarget) {
      this.isLocked = false;
      trigger(this.$element, 'unlock.bs.modal', _relatedTarget);
    }
  });
})(jQuery);