Hidden messages visible for Administrators only Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.
4 posters

    Hidden messages visible for Administrators only

    hazira
    hazira
    New Member


    Posts : 5
    Reputation : 1
    Language : English

    Solved Hidden messages visible for Administrators only

    Post by hazira November 18th 2021, 7:15 pm

    Hello everyone,

    I'm looking for a way to make the messages with "[ hide ]" tag visible for administrators only. In the best case scenario I would like to have this one and a "normal hide", which means, that the Users would be able to choose if they want their message to be seen only by the Admins or just like regular hidden messages (so only by the people that wrote in this exact topic).

    I've been loking for any help on this forum already, however I couldn't find a proper solution.

    My forum's version is ModernBB.


    Last edited by hazira on December 4th 2021, 6:51 pm; edited 1 time in total
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51553
    Reputation : 3519
    Language : English
    Location : United States

    Solved Re: Hidden messages visible for Administrators only

    Post by SLGray November 18th 2021, 7:19 pm

    Right now we do not have a default option for this.  Maybe someone with coding expertise can help with this topic.



    Hidden messages visible for Administrators only Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.
    tikky
    tikky
    Forumember


    Posts : 898
    Reputation : 157
    Language : 🇵🇹

    Solved Re: Hidden messages visible for Administrators only

    Post by tikky November 18th 2021, 8:12 pm

    Hello @hazira,

    You can use this script: "Only to staff". Should work
    hazira
    hazira
    New Member


    Posts : 5
    Reputation : 1
    Language : English

    Solved Re: Hidden messages visible for Administrators only

    Post by hazira November 18th 2021, 9:08 pm

    Hi, thanks for your replies!

    @pedxz Unfortunately your script doesn't work on my forum. Is there any chance that it is prepared for some other version? Or maybe I'm expected to do something more than pasting it in the Javascript codes management and enabling them?
    tikky
    tikky
    Forumember


    Posts : 898
    Reputation : 157
    Language : 🇵🇹

    Solved Re: Hidden messages visible for Administrators only

    Post by tikky November 19th 2021, 1:33 am

    hazira wrote:Is there any chance that it is prepared for some other version?
    Your forum is https://hashira.forumpolish.com right?
    hazira
    hazira
    New Member


    Posts : 5
    Reputation : 1
    Language : English

    Solved Re: Hidden messages visible for Administrators only

    Post by hazira November 19th 2021, 2:35 pm

    pedxz wrote:
    hazira wrote:Is there any chance that it is prepared for some other version?
    Your forum is https://hashira.forumpolish.com right?

    Yes.
    tikky
    tikky
    Forumember


    Posts : 898
    Reputation : 157
    Language : 🇵🇹

    Solved Re: Hidden messages visible for Administrators only

    Post by tikky November 19th 2021, 3:11 pm

    hazira wrote:
    pedxz wrote:
    hazira wrote:Is there any chance that it is prepared for some other version?
    Your forum is https://hashira.forumpolish.com right?

    Yes.
    Here:
    Code:
    (function($) {
        'use strict';
     
        $(function() {
     
            if (! /^\/t(\d+)(p\d+-|-).*$/i.test(location.pathname)) {
                return;
            }
     
            $('.post').each(function() {
                var $post = $(this);
                var config = {
                    link: $post.find('a[href^="/post?p="][href$="&mode=editpost"]'),
                    message: (_userdata.user_level ? $post.find('a[href^="/post?p="][href$="&mode=editpost"]').attr('href').split('p=')[1].split('&')[0] : $post.attr('class').split('--')[1]),
                    title: $post.find('.post-head a[href^="/t"]'),
                    content: $post.find('.postbody > .content').html()
                };
     
     
                if (/> only_admin/.test(config.title.text())) {
     
                    config.title
                        .html('This post is <b>only visible for moderation</b>.')
                    ;
     
                    $post
                        .attr('id', 'only_admin-' + config.message)
                        .css('opacity', '.5')
                        .find('.postbody > .content')
                        .html((_userdata.user_level ? config.content : '<span style="font-weight: 700; color: red;">[ You cannot see this message ]</span>'))
                    ;
                }
     
     
                if (_userdata.user_level !== 1 && _userdata.user_level !== 2) {
                    return;
                }
     
                if (!config.link.length) {
                    return;
                }
     
                $.get(config.link.attr('href'))
                    .done(function(context) {
     
                        var $textarea = $('#text_editor_textarea', context);
     
                        if (!$textarea.length) return;
                        if ($('#only_admin-' + config.message).length) return;
     
                        $('<button>', {
                                'class': 'button1 rep-button',
                                'role': 'button',
                                'title': 'Hide this post',
                                'text': 'Hide post'
                            })
                            .appendTo($post.find('.postbody > .content'))
                            .on('click', function(event) {
                                event.preventDefault();
                                $.post("/post", {
                                    p: config.message,
                                    mode: 'editpost',
                                    subject: '> only_admin',
                                    message: $textarea.val(),
                                    edit_reason: '',
                                    attach_sig: 0,
                                    notify: 0,
                                    post: 1
                                }).done(function() {
                                    location.reload(true);
                                }).fail(function() {
                                    alert('[Erro]: Something went wrong when editing the post');
                                });
     
                            });
                    });
            });
     
        });
    }(jQuery));

    skouliki and TonnyKamper like this post

    hazira
    hazira
    New Member


    Posts : 5
    Reputation : 1
    Language : English

    Solved Re: Hidden messages visible for Administrators only

    Post by hazira December 4th 2021, 3:41 pm

    Hello. Sorry for late reply.
    Unfortunately the solution which you sent doesn't work for us. We decided to change our mechanics a bit so we don't need this hide option anymore. However, if you have any idea about what could have gone wrong, we will be more than happy to try out any new code or provide more info that could help in case someone else would need it Smile
    Ape
    Ape
    Administrator
    Administrator


    Male Posts : 19212
    Reputation : 1998
    Language : fluent in dork / mumbojumbo & English haha

    Solved Re: Hidden messages visible for Administrators only

    Post by Ape December 4th 2021, 6:41 pm

    If you no longer need this please mark it as solved so the topic can be closed.

    Thank you.



    Hidden messages visible for Administrators only Left1212Hidden messages visible for Administrators only Center11Hidden messages visible for Administrators only Right112
    Hidden messages visible for Administrators only Ape_b110
    Hidden messages visible for Administrators only Ape1010
    hazira
    hazira
    New Member


    Posts : 5
    Reputation : 1
    Language : English

    Solved Re: Hidden messages visible for Administrators only

    Post by hazira December 4th 2021, 6:52 pm

    Ape wrote:If you no longer need this please mark it as solved so the topic can be closed.

    Thank you.

    Done.
    Ape
    Ape
    Administrator
    Administrator


    Male Posts : 19212
    Reputation : 1998
    Language : fluent in dork / mumbojumbo & English haha

    Solved Re: Hidden messages visible for Administrators only

    Post by Ape December 4th 2021, 6:54 pm

    Problem solved & topic archived.
    Please read our forum rules: ESF General Rules



    Hidden messages visible for Administrators only Left1212Hidden messages visible for Administrators only Center11Hidden messages visible for Administrators only Right112
    Hidden messages visible for Administrators only Ape_b110
    Hidden messages visible for Administrators only Ape1010