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.

Allow only Administrators to delete a topic

+2
Perfe <3
smurfavr
6 posters

Page 1 of 2 1, 2  Next

Go down

Solved Allow only Administrators to delete a topic

Post by smurfavr February 8th 2020, 8:06 am

@TheCrow I pasted the code as written, but the moderator can still delete topics. https://help.forumotion.com/t155267-allow-only-administrators-to-delete-a-topic

Allow only Administrators to delete a topic MsJck6N
smurfavr
smurfavr
Active Poster

Male Posts : 1881
Reputation : 22
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by Perfe <3 February 8th 2020, 8:42 am

This doesnt work in my forum, too! Please Fix it Allow only Administrators to delete a topic 1f610
Perfe <3
Perfe <3
Forumember

Male Posts : 49
Reputation : 1
Language : Bulgarian
Location : Haskovo, Bulgaria

https://.bg-bunker.bulgarianforum.net

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by skouliki February 8th 2020, 8:58 am

hello

you have to be patient when TheCrow log in he will see the post
skouliki
skouliki
Manager
Manager

Female Posts : 15391
Reputation : 1709
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by smurfavr February 8th 2020, 9:01 am

I have not done a double post. Cool

psp
I marked him because he is the author of the topic. Anyone who knows what the problem is can help.
smurfavr
smurfavr
Active Poster

Male Posts : 1881
Reputation : 22
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by Neptune- February 8th 2020, 10:43 am

Hi


Can you post there the code you placed in your javascript management ?
Neptune-
Neptune-
Forumember

Female Posts : 496
Reputation : 104
Language : French (10), English (8), CSS (5), HTML (4), Javascript (4)
Location : Scotland, UK

https://www.galaxie-series.net/

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by Perfe <3 February 8th 2020, 11:00 am

Code:
// A code by ©️TheCrow (2018) for Forumotion. Please do not remove these comments :
// http://help.forumotion.com/t155267-allow-only-administrators-to-delete-a-topic#1067499
$(document).ready(function () {
  if (!(_userdata.user_level == 1)) {
    $('a[href*="modcp?mode=delete"]').removeAttr('href').css("cursor","not-allowed");
    $('a img[alt="Delete this topic"]').attr("title","Only Administrators are allowed to delete a topic"); // For Mod-Tools deletion of the entire topic
    $('ul.profile-icons a[href*="mode=delete"]').removeAttr('href').attr('style','cursor:not-allowed!important');
    $('img.i_icon_delete').attr("title","Only Administrators are allowed to delete messages").css("cursor","not-allowed"); // For Messages
  }
});
Perfe <3
Perfe <3
Forumember

Male Posts : 49
Reputation : 1
Language : Bulgarian
Location : Haskovo, Bulgaria

https://.bg-bunker.bulgarianforum.net

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by skouliki February 8th 2020, 11:05 am

Perfe <3 wrote:
Code:
// A code by :copyright:️TheCrow (2018) for Forumotion. Please do not remove these comments :
// http://help.forumotion.com/t155267-allow-only-administrators-to-delete-a-topic#1067499
$(document).ready(function () {
  if (!(_userdata.user_level == 1)) {
    $('a[href*="modcp?mode=delete"]').removeAttr('href').css("cursor","not-allowed");
    $('a img[alt="Delete this topic"]').attr("title","Only Administrators are allowed to delete a topic"); // For Mod-Tools deletion of the entire topic
    $('ul.profile-icons a[href*="mode=delete"]').removeAttr('href').attr('style','cursor:not-allowed!important');
    $('img.i_icon_delete').attr("title","Only Administrators are allowed to delete messages").css("cursor","not-allowed"); // For Messages
  }
});

please do not hijack another member's post
the topic starter smurfavr must post his code (even if the code is the same as yours )
skouliki
skouliki
Manager
Manager

Female Posts : 15391
Reputation : 1709
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by Neptune- February 8th 2020, 11:14 am

Code:
$('a img[alt="Delete this topic"]')

I do not know any word of bulgarian but i know that "Delete this topic" doesn't sound bulgarian at all.

Please read again the tutorial !
Neptune-
Neptune-
Forumember

Female Posts : 496
Reputation : 104
Language : French (10), English (8), CSS (5), HTML (4), Javascript (4)
Location : Scotland, UK

https://www.galaxie-series.net/

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by Perfe <3 February 8th 2020, 11:41 am

skouliki wrote:
Perfe <3 wrote:
Code:
// A code by :copyright:️TheCrow (2018) for Forumotion. Please do not remove these comments :
// http://help.forumotion.com/t155267-allow-only-administrators-to-delete-a-topic#1067499
$(document).ready(function () {
  if (!(_userdata.user_level == 1)) {
    $('a[href*="modcp?mode=delete"]').removeAttr('href').css("cursor","not-allowed");
    $('a img[alt="Delete this topic"]').attr("title","Only Administrators are allowed to delete a topic"); // For Mod-Tools deletion of the entire topic
    $('ul.profile-icons a[href*="mode=delete"]').removeAttr('href').attr('style','cursor:not-allowed!important');
    $('img.i_icon_delete').attr("title","Only Administrators are allowed to delete messages").css("cursor","not-allowed"); // For Messages
  }
});

please do not hijack another member's post
the topic starter smurfavr must post his code (even if the code is the same as yours )

Its the same code!
Perfe <3
Perfe <3
Forumember

Male Posts : 49
Reputation : 1
Language : Bulgarian
Location : Haskovo, Bulgaria

https://.bg-bunker.bulgarianforum.net

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by smurfavr February 8th 2020, 11:57 am

Neptune- wrote:
Code:
$('a img[alt="Delete this topic"]')

I do not know any word of bulgarian but i know that "Delete this topic" doesn't sound bulgarian at all.

Please read again the tutorial !

@Neptune-
This is the code and the words are translated correctly in Bulgarian.
Code:
// A code by ©️TheCrow (2018) for Forumotion. Please do not remove these comments :
// http://help.forumotion.com/t155267-allow-only-administrators-to-delete-a-topic#1067499
$(document).ready(function () {
  if (!(_userdata.user_level == 1)) {
    $('a[href*="modcp?mode=delete"]').removeAttr('href').css("cursor","not-allowed");
    $('a img[alt="Изтрийте тази тема"]').attr("title","Само администраторите могат да изтрият тема"); // For Mod-Tools deletion of the entire topic
    $('ul.profile-icons a[href*="mode=delete"]').removeAttr('href').attr('style','cursor:not-allowed!important');
    $('img.i_icon_delete').attr("title","Само администраторите могат да изтриват съобщения").css("cursor","not-allowed"); // For Messages
  }
});
smurfavr
smurfavr
Active Poster

Male Posts : 1881
Reputation : 22
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by Neptune- February 8th 2020, 1:25 pm

I just tried your script after i switched my profile to bulgarian.

On hovering the "delete topic" icon, the cursor changed and the link was removed. Same for the "delete post" inside each post.

Script is working as it should.
Any conflict with other scripts ?
Maybe you should try to place it only on topics (rather than all pages like said in tutorial) !




Edit : Lot of strings still in english once i chose bulgarian on my profile (toolbar for example)

Allow only Administrators to delete a topic Bulgar10




Edit 2 :
In fact, even without translating the correct alt, it works. No way to delete the topic. With no translation the button will still display "Delete this topic" but button is no more clickable.




Edit 3 :

The code in the tutorial is suitable for phpBB3.

For phpBB2 you should use the following one
Code:
// A code by ©️TheCrow (2018) for Forumotion. Please do not remove these comments :
        // http://help.forumotion.com/t155267-allow-only-administrators-to-delete-a-topic#1067499
        $(document).ready(function () {
          if (!(_userdata.user_level == 1)) {
            $('a[href*="modcp?mode=delete"]').removeAttr('href').css("cursor","not-allowed");
            $('a img[alt="Delete this topic"]').attr("title","Only Administrators are allowed to delete a topic"); // For Mod-Tools deletion of the entire topic
            $('td.post-options a[href*="mode=delete"]').removeAttr('href').attr('style','cursor:not-allowed!important');
            $('img.i_icon_delete').attr("title","Only Administrators are allowed to delete messages").css("cursor","not-allowed"); // For Messages
          }
        });
Neptune-
Neptune-
Forumember

Female Posts : 496
Reputation : 104
Language : French (10), English (8), CSS (5), HTML (4), Javascript (4)
Location : Scotland, UK

https://www.galaxie-series.net/

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by smurfavr February 8th 2020, 2:48 pm

@Neptune-
After your code revision, it now works and the delete button cannot be used by a moderator.
There is another problem from the drop down menu there is an option to delete a post and from there still a moderator can delete a post.
I noted In the topics
Allow only Administrators to delete a topic GNM088P
smurfavr
smurfavr
Active Poster

Male Posts : 1881
Reputation : 22
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by smurfavr February 15th 2020, 10:47 pm

Up
smurfavr
smurfavr
Active Poster

Male Posts : 1881
Reputation : 22
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by TheCrow February 23rd 2020, 11:43 am

Hello @smurfavr,

First of all, I am deeply sorry for not getting to you sooner on this matter.
So just to be clear, your forum version is #phpbb2 right?

Regards,
TC.


Allow only Administrators to delete a topic Thecro10
Forum of the Forums

Forumotion Rules | Tips & Tricks |
FAQ | Did you forget your password?



*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
TheCrow
TheCrow
Manager
Manager

Male Posts : 6916
Reputation : 795
Language : Greek, English

https://www.inforumgr.com

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by smurfavr February 25th 2020, 8:40 pm

@TheCrow Yes phpbb2
smurfavr
smurfavr
Active Poster

Male Posts : 1881
Reputation : 22
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by TheCrow February 25th 2020, 9:48 pm

Hello again,

I need the url link of the page where you click yes/no and a screenshot if you can where you press right click (on the yes button) > inspect element.

Regards,
TC.


Allow only Administrators to delete a topic Thecro10
Forum of the Forums

Forumotion Rules | Tips & Tricks |
FAQ | Did you forget your password?



*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
TheCrow
TheCrow
Manager
Manager

Male Posts : 6916
Reputation : 795
Language : Greek, English

https://www.inforumgr.com

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by smurfavr February 25th 2020, 10:14 pm

smurfavr
smurfavr
Active Poster

Male Posts : 1881
Reputation : 22
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by TheCrow February 26th 2020, 8:34 pm

Okay,

So after the 4th line of your code, after this:
Code:
if (!(_userdata.user_level == 1)) {
press enter and paste this part:
Code:
if (/modcp?mode=delete/.test(window.location.href)) {
  $('input.mainoption[name="confirm"]').remove();
  $('<span style="display:block;text-align:center;color:red;font-weight:700;font-size:16px">Sorry but only Administrators are allowed to delete topics.</span>').insertAfter('input.liteoption[name="cancel"]');
}

This should give you this result after you select the delete option from the dropdown:
Allow only Administrators to delete a topic Screen21

Regards,
TC.


Allow only Administrators to delete a topic Thecro10
Forum of the Forums

Forumotion Rules | Tips & Tricks |
FAQ | Did you forget your password?



*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
TheCrow
TheCrow
Manager
Manager

Male Posts : 6916
Reputation : 795
Language : Greek, English

https://www.inforumgr.com

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by smurfavr February 26th 2020, 9:37 pm

Is that how the code should look?
Code:
// A code by ©️TheCrow (2018) for Forumotion. Please do not remove these comments :
        // http://help.forumotion.com/t155267-allow-only-administrators-to-delete-a-topic#1067499
        $(document).ready(function () {
          if (!(_userdata.user_level == 1)) {
            if (/modcp?mode=delete/.test(window.location.href)) {
  $('input.mainoption[name="confirm"]').remove();
  $('<span style="display:block;text-align:center;color:red;font-weight:700;font-size:16px">Sorry but only Administrators are allowed to delete topics.</span>').insertAfter('input.liteoption[name="cancel"]');
}
            $('a[href*="modcp?mode=delete"]').removeAttr('href').css("cursor","not-allowed");
            $('a img[alt="Delete this topic"]').attr("title","Only Administrators are allowed to delete a topic"); // For Mod-Tools deletion of the entire topic
            $('td.post-options a[href*="mode=delete"]').removeAttr('href').attr('style','cursor:not-allowed!important');
            $('img.i_icon_delete').attr("title","Only Administrators are allowed to delete messages").css("cursor","not-allowed"); // For Messages
          }
        });

I tried, but still a moderator can delete a post from the drop down.
smurfavr
smurfavr
Active Poster

Male Posts : 1881
Reputation : 22
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by TheCrow February 27th 2020, 8:27 am

Hello @smurfavr,

Yes, like that. Sorry, I forgot to remove the href correctly. Please replace the above code I sent you with this one:
Code:
if (/mode=delete/.test(window.location.href)) {
  $('input.mainoption').remove();
  $('<span style="display:block;text-align:center;color:red;font-weight:700;font-size:16px">Sorry but only Administrators are allowed to delete topics.</span>').insertAfter('input.liteoption');
}

This should fix your problem. Plus, you can change the text
Code:
Sorry but only Administrators are allowed to delete topics.
to anything you like.

Regards,
TC.


Allow only Administrators to delete a topic Thecro10
Forum of the Forums

Forumotion Rules | Tips & Tricks |
FAQ | Did you forget your password?



*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
TheCrow
TheCrow
Manager
Manager

Male Posts : 6916
Reputation : 795
Language : Greek, English

https://www.inforumgr.com

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by smurfavr February 27th 2020, 8:46 am

@TheCrow I pasted the code but no change.

Code:
// A code by :copyright:️TheCrow (2018) for Forumotion. Please do not remove these comments :
        // http://help.forumotion.com/t155267-allow-only-administrators-to-delete-a-topic#1067499
        $(document).ready(function () {
          if (!(_userdata.user_level == 1)) {
            if (/mode=delete/.test(window.location.href)) {
  $('input.mainoption').remove();
  $('<span style="display:block;text-align:center;color:red;font-weight:700;font-size:16px">Sorry but only Administrators are allowed to delete topics.</span>').insertAfter('input.liteoption');
}
            $('a[href*="modcp?mode=delete"]').removeAttr('href').css("cursor","not-allowed");
            $('a img[alt="Delete this topic"]').attr("title","Only Administrators are allowed to delete a topic"); // For Mod-Tools deletion of the entire topic
            $('td.post-options a[href*="mode=delete"]').removeAttr('href').attr('style','cursor:not-allowed!important');
            $('img.i_icon_delete').attr("title","Only Administrators are allowed to delete messages").css("cursor","not-allowed"); // For Messages
          }
        });
smurfavr
smurfavr
Active Poster

Male Posts : 1881
Reputation : 22
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by TheCrow February 27th 2020, 8:56 am

This happens only to Moderators. Not to Administrators.

This works fine to #phpbb2 version forum.


Allow only Administrators to delete a topic Thecro10
Forum of the Forums

Forumotion Rules | Tips & Tricks |
FAQ | Did you forget your password?



*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
TheCrow
TheCrow
Manager
Manager

Male Posts : 6916
Reputation : 795
Language : Greek, English

https://www.inforumgr.com

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by smurfavr February 27th 2020, 10:08 am

Yes I am logged in with a moderator profile and the drop down menu still works as a moderator.


Allow only Administrators to delete a topic 1838074058
The code does not work on my forum.
The code doesn't work on my test forum either.

Allow only Administrators to delete a topic 1838074058
It would be best if you can hide the moderator rank drop-down menu.
smurfavr
smurfavr
Active Poster

Male Posts : 1881
Reputation : 22
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by TheCrow February 27th 2020, 11:49 am

@smurfavr,

Have you cleared your browser cache?

To my test forum which is #phpbb2 works just fine.
Allow only Administrators to delete a topic Screen22

If this is not working to you, please send me via PM the username and password of a test account with moderator rights to your test forum to give it a look and let you know my result.

Regards,
TC.


Allow only Administrators to delete a topic Thecro10
Forum of the Forums

Forumotion Rules | Tips & Tricks |
FAQ | Did you forget your password?



*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
TheCrow
TheCrow
Manager
Manager

Male Posts : 6916
Reputation : 795
Language : Greek, English

https://www.inforumgr.com

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by smurfavr February 27th 2020, 1:01 pm

Yes, clear the browser cache.

I wrote, you ls.
smurfavr
smurfavr
Active Poster

Male Posts : 1881
Reputation : 22
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by TheCrow February 27th 2020, 4:18 pm

@smurfavr,

Can you please post the exact code you are using?

Regards,
TC.


Allow only Administrators to delete a topic Thecro10
Forum of the Forums

Forumotion Rules | Tips & Tricks |
FAQ | Did you forget your password?



*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
TheCrow
TheCrow
Manager
Manager

Male Posts : 6916
Reputation : 795
Language : Greek, English

https://www.inforumgr.com

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by smurfavr February 27th 2020, 8:53 pm

This
Code:
// A code by ©️TheCrow (2018) for Forumotion. Please do not remove these comments :
        // http://help.forumotion.com/t155267-allow-only-administrators-to-delete-a-topic#1067499
        $(document).ready(function () {
          if (!(_userdata.user_level == 1)) {
            if (/mode=delete/.test(window.location.href)) {
  $('input.mainoption').remove();
  $('<span style="display:block;text-align:center;color:red;font-weight:700;font-size:16px">Sorry but only Administrators are allowed to delete topics.</span>').insertAfter('input.liteoption');
}
            $('a[href*="modcp?mode=delete"]').removeAttr('href').css("cursor","not-allowed");
            $('a img[alt="Delete this topic"]').attr("title","Only Administrators are allowed to delete a topic"); // For Mod-Tools deletion of the entire topic
            $('td.post-options a[href*="mode=delete"]').removeAttr('href').attr('style','cursor:not-allowed!important');
            $('img.i_icon_delete').attr("title","Only Administrators are allowed to delete messages").css("cursor","not-allowed"); // For Messages
          }
        });
smurfavr
smurfavr
Active Poster

Male Posts : 1881
Reputation : 22
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by TheCrow February 27th 2020, 11:09 pm

Hello,

Do you have any other javascript that may interfere with this javascript?


Allow only Administrators to delete a topic Thecro10
Forum of the Forums

Forumotion Rules | Tips & Tricks |
FAQ | Did you forget your password?



*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
TheCrow
TheCrow
Manager
Manager

Male Posts : 6916
Reputation : 795
Language : Greek, English

https://www.inforumgr.com

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by smurfavr February 27th 2020, 11:15 pm

I have a total of 20 Java scripts but I don't know if any of them interfere.

PSP
In my test forum I stopped all the java script and left only your code but it still doesn't work.

Can it interfere with some of the CSS code?
smurfavr
smurfavr
Active Poster

Male Posts : 1881
Reputation : 22
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Allow only Administrators to delete a topic

Post by TheCrow February 28th 2020, 6:08 am

Hello again @smurfavr,

Please try and replace your code with this one:
Code:
// A code by ©️TheCrow (2018) for Forumotion. Please do not remove these comments :
        // http://help.forumotion.com/t155267-allow-only-administrators-to-delete-a-topic#1067499
        $(document).ready(function () {
          if (!(_userdata.user_level == 1)) {
            $(function(){
              if (/mode=delete/.test(window.location.href)) {
                $('input.mainoption').remove();
                $('<span style="display:block;text-align:center;color:red;font-weight:700;font-size:16px">Sorry but only Administrators are allowed to delete topics.</span>').insertAfter('input.liteoption');
              }
            });
            $('a[href*="modcp?mode=delete"]').removeAttr('href').css("cursor","not-allowed");
            $('a img[alt="Delete this topic"]').attr("title","Only Administrators are allowed to delete a topic"); // For Mod-Tools deletion of the entire topic
            $('td.post-options a[href*="mode=delete"]').removeAttr('href').attr('style','cursor:not-allowed!important');
            $('img.i_icon_delete').attr("title","Only Administrators are allowed to delete messages").css("cursor","not-allowed"); // For Messages
          }
        });

What I did, is that I inserted a function just to make sure it reaches the url stage for this. Please try it and let me know.

Regards,
TC.


Allow only Administrators to delete a topic Thecro10
Forum of the Forums

Forumotion Rules | Tips & Tricks |
FAQ | Did you forget your password?



*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
TheCrow
TheCrow
Manager
Manager

Male Posts : 6916
Reputation : 795
Language : Greek, English

https://www.inforumgr.com

Back to top Go down

Page 1 of 2 1, 2  Next

Back to top

- Similar topics

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