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.

Hidden messages visible for Administrators only

4 posters

Go down

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
hazira
hazira
New Member

Posts : 5
Reputation : 1
Language : English

https://hashira.forumpolish.com

Back to top Go down

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.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51556
Reputation : 3524
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

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
tikky
tikky
Forumember

Posts : 923
Reputation : 160
Language : 🇵🇹

https://www.forumotion.com/create-forum/modernbb

Back to top Go down

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?
hazira
hazira
New Member

Posts : 5
Reputation : 1
Language : English

https://hashira.forumpolish.com

Back to top Go down

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?
tikky
tikky
Forumember

Posts : 923
Reputation : 160
Language : 🇵🇹

https://www.forumotion.com/create-forum/modernbb

Back to top Go down

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.
hazira
hazira
New Member

Posts : 5
Reputation : 1
Language : English

https://hashira.forumpolish.com

Back to top Go down

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));
tikky
tikky
Forumember

Posts : 923
Reputation : 160
Language : 🇵🇹

https://www.forumotion.com/create-forum/modernbb

skouliki and TonnyKamper like this post

Back to top Go down

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
hazira
hazira
New Member

Posts : 5
Reputation : 1
Language : English

https://hashira.forumpolish.com

Back to top Go down

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
Ape
Ape
Administrator
Administrator

Male Posts : 19438
Reputation : 2010
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

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.
hazira
hazira
New Member

Posts : 5
Reputation : 1
Language : English

https://hashira.forumpolish.com

Back to top Go down

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
Ape
Ape
Administrator
Administrator

Male Posts : 19438
Reputation : 2010
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum