Is there code to to make "Edited By" not show for admin?
Sept 8, 2017 9:13:24 GMT -8
♥ ℒʊ√ ♥, Lynx, and 1 more like this
Post by Chris on Sept 8, 2017 9:13:24 GMT -8
You misunderstand Lynx , edit reason is incidental, that gets hidden if the edit is ultimately determined to also be hidden, what I am referring to is who made the edit (aka last person to edit the post). If the admin made the edit then only the admin and whoever else is included in the code can see the edit (whether or not it includes a reason). The posted code makes no effort to determine who made the edit and is instead making the decision based solely on who is viewing the edit (aka current_user) and both needs to be examined to determine visibility
Usage:
<!--/* Hide the last edit of specified users (place in GLOBAL HEADER) */-->
<!--/* Blind users can only see their own hidden edits and not the hidden edits of others in the list */-->
<script>
(function (users, blind) {
var viewer = pb.data("user");
users = users || [];
blind = blind || [];
function hideEdit() {
$.each(pb.data("proboards.post") || [], function (post_id, post_meta) {
var post = $('#post-' + post_id);
var edit_div = $('.edited_by', post);
var edited_by = $('.js-user-link', edit_div)
if (edited_by.length) {
/* if this is an edit by a user on the list */
if (blind.concat(users).indexOf(edited_by.data('id')) !== -1) {
/* If this is the post author or one who can see such edits then let it be */
if (viewer.id == post_meta.created_by || (blind.indexOf(edited_by.data('id')) != -1 && edited_by.data('id') == viewer.id) || users.indexOf(viewer.id) != -1) {
edit_div.attr('title', 'For your eyes only, others may not be able to see this edit')
.addClass('warning-bar warning-low')
} else {
edit_div.hide();
}
}
}
})
}
if (users.length || blind.length) {
hideEdit()
pb.events.on('afterSearch', hideEdit);
}else{ console.log('Error: no users have been added to the hide last edit code')}
})([1, 2, 65613], [180565, 209176]) /* user id of people whose edits will be hidden from everyone else */
/* blind users (e.g. [180565, 209176]) can only see their own edits and the edits of others not on the list */
</script>
Usage:
fill in the numeric id of the users who wish to have their last edits hidden from others. In the code above an example of [1,2,65613] is given with two other users added as blind ( [180565, 209176] ). Everybody in the first group can see all the edits but user 180565 and 209176 can only see their own edits along with any last edits that have not been hidden. The author of the post will always be able to see any edits since they have the need to be aware and possibly address any modifications which may misrepresent their original post.