header에 이 코드를 적용해 보았습니다.
document.addEventListener("DOMContentLoaded", function() {
setTimeout(() => {
let userTrustLevel = parseInt(Discourse.User.current().trust_level);
if (userTrustLevel < 4) {
document.querySelectorAll(".pin-topic, .unpin-topic").forEach(button => {
button.style.pointerEvents = "none";
button.style.opacity = "0.5";
button.title = "You don't have permission to pin topics";
});
}
}, 1000); complet
});
그리고 CSS에는 다음과 같이 설정했습니다.
.d-header-icons .pin-topic,
.d-header-icons .unpin-topic,
.controls .pin-topic,
.controls .unpin-topic {
display: none !important;
}
하지만 신뢰도(trust level)가 1 또는 0인 일반 사용자는 고정(pin) 버튼을 보고 클릭할 수 있습니다.
Automatically unpin topics when the user reaches the bottom by default. 이 옵션은 꺼져 있습니다.
Automatically unpin topics when the user reaches the bottom. 이 옵션도 꺼져 있습니다.


