I found this code for phpbb3 to hide messages, tested it and it worked in phpbb3.
However, I use PunBB, can you help me to change the variables here to work in PunBB?
Thanks
However, I use PunBB, can you help me to change the variables here to work in PunBB?
- Code:
"use strict";
$(function() {
var title = $('h2.topic-title');
var isAdmin = function() {
var level = _userdata["user_level"];
if (level === 1 || level === 2) return true;
};
title.each(function() {
if (this.textContent == ' > only_admin') {
$(this).children('a').text('This post is only visible for moderation.');
$(this).parents('.post').addClass('admin_only');
}
});
var admin_only = $('.post.admin_only');
if (isAdmin()) {
$('ul.profile-icons').prepend(
'<li><a href="#hide" class="hide-post">Hide post</a></li>'
);
if (admin_only.length) {
admin_only.css({
'opacity': '.5'
});
}
$('.hide-post').click(function() {
var post = $(this).parents('div.post').attr('id').split('p')[1],
content = $(this).parents('.postbody').find('.content').html();
$.post("/post", {
p: post,
mode: 'editpost',
subject: '> only_admin',
message: content,
edit_reason: '',
attach_sig: '0',
notify: "0",
post: 1
}).done(function() {
location.reload();
}).fail(function() {
alert('[Erro]: Something went wrong when editing the post');
});
});
} else {
if (admin_only.length) admin_only.remove();
};
});
Thanks