Advertisement:

Author Topic: Undeletable  (Read 7833 times)

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
Undeletable
« on: May 08, 2011, 12:59:02 PM »
Link to Mod

This mod allows set topics, personal messages and members as "undeletable" (short for protect from (accidental) deletion).

Once marked as "undeletable" it will be impossible to delete any of them with the usual tools provided by SMF, the only way is to remove the attribute and let them return "deletable".

The mod provides separated permission for each action:
  • set topic "undeletable"
  • set topic "deletable"
  • set member "undeletable"/"deletable"
  • set personal messages "undeletable"/"deletable"

For topics a new button is present at the end of each page, next to the usual moderation tools (Move, Remove, etc.).
For personal messages a button is present next the delete button.
For members a checkbox can be found in the Account Settings (or "Account Related Settings" for SMF 1.1.x) page of each member's profile.

For SMF 1.1.x users
If you want to completely remove any trace of the mod, please use the uninstall script provided at the mod's page. Before using this script, please uninstall the main package, delete it from the server and then upload the uninstall package and run it.

Change log
  • 0.1.3:
    • version update (1.1.14 and 2.0)
    • Added Dutch and Portuguese translations (thanks to Yoshi2889 and Joomlamz respectively)
    • Added UTF8 translations too...hope they work
  • 0.1.2: initial release
« Last Edit: July 03, 2011, 08:47:22 AM by emanuele »


Take a peek at what I'm doing! ;D



Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

MarkLeevE

  • Guest
Re: Undeletable
« Reply #1 on: May 08, 2011, 02:16:36 PM »
I've been waiting for so long for a mod like this. Thank you mate.. . :)

Offline ACAMS

  • Full Member
  • ***
  • Posts: 607
  • HEY, watch this....here, hold my beer
    • gametechmods.com
Re: Undeletable
« Reply #2 on: May 08, 2011, 09:20:41 PM »
Can I emulate this to RC3?

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
Re: Undeletable
« Reply #3 on: May 09, 2011, 03:59:17 AM »
It should work with RC4 (since I started developing it with that version), but I removed the option from the installer. Regarding RC3 I've never tried and I really don't know (and don't want to know :P).


Take a peek at what I'm doing! ;D



Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline ACAMS

  • Full Member
  • ***
  • Posts: 607
  • HEY, watch this....here, hold my beer
    • gametechmods.com
Re: Undeletable
« Reply #4 on: May 09, 2011, 10:15:26 AM »
Well it had too many errors and I am not gonna mess up my whole forum updating to RC5, so I guess I will have to do without this until a solid 2.0 is released.

Offline NanoSector

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 10,500
  • Gender: Male
  • VC321xb47@aperture:~#
    • Yoshi2889 on GitHub
Re: Undeletable
« Reply #5 on: May 09, 2011, 10:39:14 AM »
Very nice mod!

Dutch translation:
Code: [Select]
<file name="$themedir/languages/Modifications.dutch.php">
<operation>
<search position="end"><![CDATA[?>]]></search>
<add><![CDATA[
$txt['permissionname_pm_undel'] = 'Sta niet-verwijderbaar maken van een persoonlijk bericht toe';
$txt['permissionhelp_pm_undel'] = 'Door deze permissie aan te zetten sta je toe een persoonlijk bericht niet-verwijderbaar te maken.';

$txt['permissionname_member_undel'] = 'Sta niet-verwijderbaar maken van een gebruiker toe';
$txt['permissionhelp_member_undel'] = 'Door deze permissie aan te zetten sta je de gebruiker toe om een andere gebruiker niet-verwijderbaar te maken.';

$txt['permissionname_set_undel'] = 'Sta niet-verwijderbaar maken toe';
$txt['permissionhelp_set_undel'] = 'Door deze permissie aan te zetten sta je de gebruiker toe om een topic niet-verwijderbaar te maken die eerst verwijderbaar was.';
$txt['permissionname_unset_undel'] = 'Sta verwijderbaar maken toe';
$txt['permissionhelp_unset_undel'] = 'Door deze permissie aan te zetten sta je de gebruiker toe om een topic verwijderbaar te maken die eerst niet-verwijderbaar was.';

$txt['mod_set_undeletable'] = 'Maak niet-verwijderbaar';
$txt['mod_unset_undeletable'] = 'Maak verwijderbaar';
$txt['mod_undeletable_topic'] = 'Dit topic is nu gemarkeerd als niet-verwijderbaar. Je kunt dit topic nu niet meer verwijderen totdat je hem weer op verwijderbaar markeert';

$txt['mod_wrong_pm_id'] = 'Het persoonlijke bericht wat je probeert te wijzigen bestaat niet of is niet van jou.';

$txt['set_member_undel'] = 'Maak gebruiker niet-verwijderbaar';
$txt['set_member_del'] = 'Maak gebruiker verwijderbaar';
$txt['no_member_id'] = 'De opgegeven gebruiker ID bestaat niet';
$txt['member_undeletable'] = 'Deze gebruiker is nu gemarkeerd als niet-verwijderbaar. Je kunt deze gebruiker nu niet meer verwijderen totdat je hem weer op verwijderbaar markeert';
]]></add>
</operation>
</file>
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
Re: Undeletable
« Reply #6 on: May 09, 2011, 11:17:21 AM »
Thanks, I'll add it when I'll do the next update (most likely to mark it compatible with 2.0 final :)).


Take a peek at what I'm doing! ;D



Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline Joomlamz

  • SMF Hero
  • ******
  • Posts: 2,639
  • Gender: Male
  • Suporte SmfPT
    • apllicmz on Facebook
    • apllicmz on GitHub
    • https://www.linkedin.com/in/aplic on LinkedIn
    • @aplichosting on Twitter
    • Webdesign
Re: Undeletable
« Reply #7 on: May 29, 2011, 12:54:06 AM »
Good work
Nice Mod
when Update dont forget portuguese

Code: [Select]
<file name="$themedir/languages/Modifications.portuguese_pt.php" error="skip">
        <operation>
            <search position="end"><![CDATA[?>]]></search>
            <add><![CDATA[
$txt['permissionname_pm_undel'] = 'Permitir a marca&ccedil;ao de MP como n&atilde;o se pode apagar';
$txt['permissionhelp_pm_undel'] = 'Permitir a marca&ccedil;ao de MPs como n&atilde;o se pode apagar';

$txt['permissionname_member_undel'] = 'Permitir a marca&ccedil;ao dos membros como n&atilde;o se pode apagar';
$txt['permissionhelp_member_undel'] = 'Permitir a  marca&ccedil;a dos membros como n&atilde;o se pode apagar';

$txt['permissionname_set_undel'] = 'Permitir para marca&ccedil;ao de t&oacute;picos como n&atilde;o se pode apagar';
$txt['permissionhelp_set_undel'] = 'Permitir para a marca&ccedil;ao de t&oacute;picos como n&atilde;o se pode apagar';
$txt['permissionname_unset_undel'] = 'Permitir a desmarcar t&oacute;picos como nao se pode apagar';
$txt['permissionhelp_unset_undel'] = 'Activando essa permiss&atilde;o permitir que o utilizador remova o "nao se pode apagar" status de um t&oacute;pico que tem sido marcada como nao se pode apagar.';

$txt['mod_set_undeletable'] = 'Marcar como n&atilde;o se pode apagar';
$txt['mod_unset_undeletable'] = 'Marcar como pode se Apagar';
$txt['mod_undeletable_topic'] = 'Este t&oacute;pico est&aacute; marcado como nao se pode apagar. Voc&ecirc; n&atilde;o pode remover  t&oacute;pico e nenhuma de suas mensagens, a menos que marc&aacute;-lo novamente como pode se apagar';

$txt['mod_wrong_pm_id'] = 'A mensagem pessoal que voc&ecirc; est&aacute; tentando modificar n&atilde;o &eacute; sua ou n&atilde;o extiste.';

$txt['set_member_undel'] = 'Marcar membro como nao se pode apagar';
$txt['set_member_del'] = 'Marcar membro como se pode apagar';
$txt['no_member_id'] = 'A identifica&ccedil;&atilde;o do membro especificado n&atilde;o existe';
$txt['member_undeletable'] = 'Esre membro esta marcado como nao se pode apagar.Voc&ecirc; n&atilde;o pode apagar-lo porque ele foi definido como  pode se apagar';
]]></add>
        </operation>
    </file>



Offline becometa

  • Jr. Member
  • **
  • Posts: 113
Re: Undeletable
« Reply #8 on: July 08, 2011, 10:26:21 AM »
Awesome!

Here comes the Polish translation
Code: [Select]
$txt['permissionname_pm_undel'] = 'Zaznaczanie PW jako niekasowalne';
$txt['permissionhelp_pm_undel'] = 'Umożliwia chronić zaznaczone przez użytkownika prywatne wiadomości jako niekasowalne.';

$txt['permissionname_member_undel'] = 'Zaznaczanie użytkowników jako niekasowalnych';
$txt['permissionhelp_member_undel'] = 'Umożliwia chronić zaznaczonych użytkowników jako niekasowalnych.';

$txt['permissionname_set_undel'] = 'Zaznaczanie tematów jako niekasowalne';
$txt['permissionhelp_set_undel'] = 'Umożliwia chronić zaznaczone przez użytkownika tematy jako niekasowalne.';
$txt['permissionname_unset_undel'] = 'Odznaczanie tematów jako niekasowalne';
$txt['permissionhelp_unset_undel'] = 'Zezwolenie to umożliwia użytkownikowi zmienić status tematu z niekasowalny na kasowalny.';

$txt['mod_set_undeletable'] = 'Oznacz jako niekasowalny';
$txt['mod_unset_undeletable'] = 'Oznacz jako kasowalny';
$txt['mod_undeletable_topic'] = 'Ten temat jest chroniony i nie może zostać usunięty, to samo tyczy się wiadomości w nich zawartych, chyba, że znów zyskają status kasowalnych.';

$txt['mod_wrong_pm_id'] = 'Prywatna wiadomość, którą próbujesz modyfikować nie należy do ciebie bądź nie istnieje.';

$txt['set_member_undel'] = 'Oznacz użytkownika jako niekasowalnego';
$txt['set_member_del'] = 'Oznacz użytkownika jako kasowalnego';
$txt['no_member_id'] = 'ID użytkownika nie istnieje';
$txt['member_undeletable'] = 'Ten użytkownik jest chroniony i nie może zostać usunięty, chyba, że znów zyska status kasowalnego.';
Some of the strings are longer because of complexity of our language...

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
Re: Undeletable
« Reply #9 on: July 08, 2011, 10:52:18 AM »
Thanks, I'll add it.

In fact I should try to change the name to some easier to describe... :)


Take a peek at what I'm doing! ;D



Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline Xenmorph

  • Semi-Newbie
  • *
  • Posts: 35
Re: Undeletable
« Reply #10 on: August 04, 2011, 01:50:02 PM »
I have this installed on my 2.0 forum and everything works fine except for the Function for Undeletable PM's.


Upon Viewing PMS the Following error is recorded in my error log.

8: Undefined index: undeletable
File: ../Sources/PersonalMessage.php
Line: 756


This is the Line of Code it is referring to :

Code: [Select]
$context['show_remove'][$row['id_pm']] = !$row['undeletable'];
and the section of code this contained within.....

Code: [Select]
// Load the id_pms and initialize recipients.
$pms = array();
$lastData = array();
$posters = $context['folder'] == 'sent' ? array($user_info['id']) : array();
$recipients = array();

while ($row = $smcFunc['db_fetch_assoc']($request))
{
if (!isset($recipients[$row['id_pm']]))
{
if (isset($row['id_member_from']))
$posters[$row['id_pm']] = $row['id_member_from'];
$context['show_remove'][$row['id_pm']] = !$row['undeletable'];
$pms[$row['id_pm']] = $row['id_pm'];
$recipients[$row['id_pm']] = array(
'to' => array(),
'bcc' => array()
);
}

I have checked & double checked that all modifications made by this mod are in-place and everything seem to be fine.

Any help with this would be appreciated......

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
Re: Undeletable
« Reply #11 on: August 04, 2011, 02:53:58 PM »
Did you install it manually?
Please check if all the columns (4 all named "undeletable" in the 4 tables smf_topics, smf_personal_messages, smf_pm_recipients, smf_members) in the database have been created properly.

This or verify that the query about 40 lines above the error contains the modification needed, it should be:
Code: [Select]
$request = $smcFunc['db_query']('', '
SELECT pm.id_pm, pm.id_pm_head, pm.id_member_from, ' . ($context['folder'] == 'sent' ? 'pm.undeletable' : 'pmr.undeletable') . '


Take a peek at what I'm doing! ;D



Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline Xenmorph

  • Semi-Newbie
  • *
  • Posts: 35
Re: Undeletable
« Reply #12 on: August 04, 2011, 04:55:41 PM »
Code: [Select]
// !!!SLOW This query uses a filesort. (inbox only.)
$request = $smcFunc['db_query']('', '
SELECT pm.id_pm, pm.id_pm_head, pm.id_member_from, ' . ($context['folder'] == 'sent' ? 'pm.undeletable' : 'pmr.undeletable') . '

Yup that line is there as you stated it should be....

I have looked at Database and the fields you refer to appear to be in-place ( Screenshots attached )

The package was installed Using the Package manager, The only manual file edit I had to make was :

./Sources/Display.php

Manually edited this Line due other Mods....

Code: [Select]
t.num_replies, t.num_views, t.locked, ms.subject, t.is_sticky, t.id_poll,
So my Line in Display.php is actualy :

Code: [Select]
t.num_replies, t.num_views, t.locked, ms.subject, t.is_sticky, t.is_solved, t.id_poll, t.undeletable,

Also attaching my PersonalMessage.php file just in case.....



Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
Re: Undeletable
« Reply #13 on: August 04, 2011, 05:51:09 PM »
Everything seems fine, in all honesty I've no idea why you get this error. :-[

BTW, replacing:
Code: [Select]
$context['show_remove'][$row['id_pm']] = !$row['undeletable'];
with:
Code: [Select]
$context['show_remove'][$row['id_pm']] = empty($row['undeletable']);
should fix it. :)


Take a peek at what I'm doing! ;D



Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline Xenmorph

  • Semi-Newbie
  • *
  • Posts: 35
Re: Undeletable
« Reply #14 on: August 04, 2011, 06:20:03 PM »
Everything seems fine, in all honesty I've no idea why you get this error. :-[

BTW, replacing:
Code: [Select]
$context['show_remove'][$row['id_pm']] = !$row['undeletable'];
with:
Code: [Select]
$context['show_remove'][$row['id_pm']] = empty($row['undeletable']);
should fix it. :)

Thanks for that, that small change seems to have fixed things.

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
Re: Undeletable
« Reply #15 on: August 05, 2011, 08:57:28 AM »
Good, I'll include it at the next update. :)


Take a peek at what I'm doing! ;D



Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline pierrelogic

  • Semi-Newbie
  • *
  • Posts: 35
  • Gender: Male
  • my mousetrap needs an upgrade
    • Ohio Spyder Ryders
Re: Undeletable
« Reply #16 on: December 23, 2012, 09:28:47 AM »
I just wanted to thank emanuele for this mod.  I stumbled upon it by accident.  Perfect for my forum(s).

I did get the same test failed on normal install thru package manager in the index.css and two in the PersonalMessage.php noted above.  Emulating to earlier version of SMF had no real effect but thought it was worth a shot.  A manual 'adjustment' to those 2 files in 3 places and it installed like clockwork. Works great & very handy mod!!

It's all about the ride

Offline Ninja ZX-10RR

  • SMF Hero
  • ******
  • Posts: 2,156
  • Gender: Male
  • Sniper Legends
    • Flavio93Zena on Facebook
    • Virtual Interactive Games Entertainment Forum
Re: Undeletable
« Reply #17 on: June 29, 2014, 11:23:49 PM »
A tiny bump for this awesome mod that is able to fix a "vulnerability" in SMF IMHO. If you ever hire a moderator and you give him the power to delete accounts (of course otherwise he wouldn't be able to ban and delete people) and this guy wants to somehow betray you then with this mod you are safe by correctly setting up the permissions :D
Like I said, IMHO.
And of course thank you emanuele ;)
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.
♥ Jess ♥

STOP EDITING MY PROFILE

Offline Caracal

  • Semi-Newbie
  • *
  • Posts: 17
Re: Undeletable
« Reply #18 on: December 27, 2019, 10:49:54 AM »
Running 2.0.15. Installs fine and everything. Everything works besides marking the topics undeletable or deletable the button where move lock and sticky the topics should be the button isn't showing up. Ran it on a test forum with fresh install and the same witn no mods installed.