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.
The forum of the forums
+2
Perfe <3
smurfavr
6 posters

    Allow only Administrators to delete a topic

    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    Solved Allow only Administrators to delete a topic

    Post by smurfavr 8/2/2020, 14:06

    @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
    Perfe <3
    Perfe <3
    Forumember


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

    Solved Re: Allow only Administrators to delete a topic

    Post by Perfe <3 8/2/2020, 14:42

    This doesnt work in my forum, too! Please Fix it Allow only Administrators to delete a topic 1f610
    skouliki
    skouliki
    Manager
    Manager


    Female Posts : 15311
    Reputation : 1705
    Language : English,Greek
    Location : Greece

    Solved Re: Allow only Administrators to delete a topic

    Post by skouliki 8/2/2020, 14:58

    hello

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

    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    Solved Re: Allow only Administrators to delete a topic

    Post by smurfavr 8/2/2020, 15:01

    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.
    Neptune-
    Neptune-
    Forumember


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

    Solved Re: Allow only Administrators to delete a topic

    Post by Neptune- 8/2/2020, 16:43

    Hi


    Can you post there the code you placed in your javascript management ?
    Perfe <3
    Perfe <3
    Forumember


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

    Solved Re: Allow only Administrators to delete a topic

    Post by Perfe <3 8/2/2020, 17:00

    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
      }
    });
    skouliki
    skouliki
    Manager
    Manager


    Female Posts : 15311
    Reputation : 1705
    Language : English,Greek
    Location : Greece

    Solved Re: Allow only Administrators to delete a topic

    Post by skouliki 8/2/2020, 17:05

    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 )

    Neptune-
    Neptune-
    Forumember


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

    Solved Re: Allow only Administrators to delete a topic

    Post by Neptune- 8/2/2020, 17:14

    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 !
    Perfe <3
    Perfe <3
    Forumember


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

    Solved Re: Allow only Administrators to delete a topic

    Post by Perfe <3 8/2/2020, 17:41

    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!
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    Solved Re: Allow only Administrators to delete a topic

    Post by smurfavr 8/2/2020, 17:57

    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
      }
    });
    Neptune-
    Neptune-
    Forumember


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

    Solved Re: Allow only Administrators to delete a topic

    Post by Neptune- 8/2/2020, 19:25

    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
              }
            });
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    Solved Re: Allow only Administrators to delete a topic

    Post by smurfavr 8/2/2020, 20:48

    @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

    Solved Re: Allow only Administrators to delete a topic

    Post by smurfavr 16/2/2020, 04:47

    Up
    TheCrow
    TheCrow
    Manager
    Manager


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

    Solved Re: Allow only Administrators to delete a topic

    Post by TheCrow 23/2/2020, 17:43

    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!
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    Solved Re: Allow only Administrators to delete a topic

    Post by smurfavr 26/2/2020, 02:40

    @TheCrow Yes phpbb2
    TheCrow
    TheCrow
    Manager
    Manager


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

    Solved Re: Allow only Administrators to delete a topic

    Post by TheCrow 26/2/2020, 03:48

    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!
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    Solved Re: Allow only Administrators to delete a topic

    Post by smurfavr 26/2/2020, 04:14

    TheCrow
    TheCrow
    Manager
    Manager


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

    Solved Re: Allow only Administrators to delete a topic

    Post by TheCrow 27/2/2020, 02:34

    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!
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    Solved Re: Allow only Administrators to delete a topic

    Post by smurfavr 27/2/2020, 03:37

    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.
    TheCrow
    TheCrow
    Manager
    Manager


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

    Solved Re: Allow only Administrators to delete a topic

    Post by TheCrow 27/2/2020, 14:27

    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!
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    Solved Re: Allow only Administrators to delete a topic

    Post by smurfavr 27/2/2020, 14:46

    @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
              }
            });
    TheCrow
    TheCrow
    Manager
    Manager


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

    Solved Re: Allow only Administrators to delete a topic

    Post by TheCrow 27/2/2020, 14:56

    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!
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    Solved Re: Allow only Administrators to delete a topic

    Post by smurfavr 27/2/2020, 16:08

    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.
    TheCrow
    TheCrow
    Manager
    Manager


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

    Solved Re: Allow only Administrators to delete a topic

    Post by TheCrow 27/2/2020, 17:49

    @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!
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    Solved Re: Allow only Administrators to delete a topic

    Post by smurfavr 27/2/2020, 19:01

    Yes, clear the browser cache.

    I wrote, you ls.
    TheCrow
    TheCrow
    Manager
    Manager


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

    Solved Re: Allow only Administrators to delete a topic

    Post by TheCrow 27/2/2020, 22:18

    @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!
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    Solved Re: Allow only Administrators to delete a topic

    Post by smurfavr 28/2/2020, 02:53

    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
              }
            });
    TheCrow
    TheCrow
    Manager
    Manager


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

    Solved Re: Allow only Administrators to delete a topic

    Post by TheCrow 28/2/2020, 05:09

    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!
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    Solved Re: Allow only Administrators to delete a topic

    Post by smurfavr 28/2/2020, 05:15

    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?
    TheCrow
    TheCrow
    Manager
    Manager


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

    Solved Re: Allow only Administrators to delete a topic

    Post by TheCrow 28/2/2020, 12:08

    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!

      Current date/time is 23/9/2024, 04:35