+2
Perfe <3
smurfavr
6 posters
Allow only Administrators to delete a topic
smurfavr- Active Poster
- Posts : 1881
Reputation : 22
Language : Bulgarian
@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
Perfe <3- Forumember
- Posts : 49
Reputation : 1
Language : Bulgarian
Location : Haskovo, Bulgaria
This doesnt work in my forum, too! Please Fix it
skouliki- Manager
- Posts : 15311
Reputation : 1705
Language : English,Greek
Location : Greece
hello
you have to be patient when TheCrow log in he will see the post
you have to be patient when TheCrow log in he will see the post
smurfavr- Active Poster
- Posts : 1881
Reputation : 22
Language : Bulgarian
I have not done a double post.
psp
I marked him because he is the author of the topic. Anyone who knows what the problem is can help.
psp
I marked him because he is the author of the topic. Anyone who knows what the problem is can help.
Neptune-- Forumember
- Posts : 496
Reputation : 104
Language : French (10), English (8), CSS (5), HTML (4), Javascript (4)
Location : Scotland, UK
Hi
Can you post there the code you placed in your javascript management ?
Can you post there the code you placed in your javascript management ?
Perfe <3- Forumember
- Posts : 49
Reputation : 1
Language : Bulgarian
Location : Haskovo, Bulgaria
- 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- Manager
- Posts : 15311
Reputation : 1705
Language : English,Greek
Location : Greece
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-- Forumember
- Posts : 496
Reputation : 104
Language : French (10), English (8), CSS (5), HTML (4), Javascript (4)
Location : Scotland, UK
- 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- Forumember
- Posts : 49
Reputation : 1
Language : Bulgarian
Location : Haskovo, Bulgaria
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- Active Poster
- Posts : 1881
Reputation : 22
Language : Bulgarian
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-- Forumember
- Posts : 496
Reputation : 104
Language : French (10), English (8), CSS (5), HTML (4), Javascript (4)
Location : Scotland, UK
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)
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
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)
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- Active Poster
- Posts : 1881
Reputation : 22
Language : Bulgarian
@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
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
smurfavr- Active Poster
- Posts : 1881
Reputation : 22
Language : Bulgarian
Up
TheCrow- Manager
- Posts : 6916
Reputation : 795
Language : Greek, English
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- Manager
- Posts : 6916
Reputation : 795
Language : Greek, English
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.
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.
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- Active Poster
- Posts : 1881
Reputation : 22
Language : Bulgarian
TheCrow- Manager
- Posts : 6916
Reputation : 795
Language : Greek, English
Okay,
So after the 4th line of your code, after this:
press enter and paste this part:
This should give you this result after you select the delete option from the dropdown:
Regards,
TC.
So after the 4th line of your code, after this:
|
- 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:
Regards,
TC.
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- Active Poster
- Posts : 1881
Reputation : 22
Language : Bulgarian
Is that how the code should look?
I tried, but still a moderator can delete a post from the drop down.
- 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- Manager
- Posts : 6916
Reputation : 795
Language : Greek, English
Hello @smurfavr,
Yes, like that. Sorry, I forgot to remove the href correctly. Please replace the above code I sent you with this one:
This should fix your problem. Plus, you can change the text
to anything you like.
Regards,
TC.
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
|
Regards,
TC.
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- Active Poster
- Posts : 1881
Reputation : 22
Language : Bulgarian
@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- Manager
- Posts : 6916
Reputation : 795
Language : Greek, English
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- Active Poster
- Posts : 1881
Reputation : 22
Language : Bulgarian
Yes I am logged in with a moderator profile and the drop down menu still works as a moderator.
The code does not work on my forum.
The code doesn't work on my test forum either.
It would be best if you can hide the moderator rank drop-down menu.
The code does not work on my forum.
The code doesn't work on my test forum either.
It would be best if you can hide the moderator rank drop-down menu.
TheCrow- Manager
- Posts : 6916
Reputation : 795
Language : Greek, English
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- Active Poster
- Posts : 1881
Reputation : 22
Language : Bulgarian
Yes, clear the browser cache.
I wrote, you ls.
I wrote, you ls.
TheCrow- Manager
- Posts : 6916
Reputation : 795
Language : Greek, English
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- Active Poster
- Posts : 1881
Reputation : 22
Language : Bulgarian
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- Manager
- Posts : 6916
Reputation : 795
Language : Greek, English
Hello,
Do you have any other javascript that may interfere with this javascript?
Do you have any other javascript that may interfere with this javascript?
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- Active Poster
- Posts : 1881
Reputation : 22
Language : Bulgarian
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?
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- Manager
- Posts : 6916
Reputation : 795
Language : Greek, English
Hello again @smurfavr,
Please try and replace your code with this one:
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.
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.
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!