News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Undeletable

Started by emanuele, May 08, 2011, 12:59:02 PM

Previous topic - Next topic

emanuele

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


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

I've been waiting for so long for a mod like this. Thank you mate.. . :)

ACAMS

Can I emulate this to RC3?

emanuele

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.

ACAMS

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.

NanoSector

Very nice mod!

Dutch translation:
<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."

emanuele

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.

Apllicmz

Good work
Nice Mod
when Update dont forget portuguese

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




becometa

Awesome!

Here comes the Polish translation
$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...

emanuele

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.

Xenmorph

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 :

$context['show_remove'][$row['id_pm']] = !$row['undeletable'];

and the section of code this contained within.....

// 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......

emanuele

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:
$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.

Xenmorph

// !!!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....

t.num_replies, t.num_views, t.locked, ms.subject, t.is_sticky, t.id_poll,

So my Line in Display.php is actualy :

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



emanuele

Everything seems fine, in all honesty I've no idea why you get this error. :-[

BTW, replacing:
$context['show_remove'][$row['id_pm']] = !$row['undeletable'];

with:
$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.

Xenmorph

Quote from: emanuele 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:
$context['show_remove'][$row['id_pm']] = !$row['undeletable'];

with:
$context['show_remove'][$row['id_pm']] = empty($row['undeletable']);

should fix it. :)

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

emanuele

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.

pierrelogic

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

Ninja ZX-10RR

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

Caracal

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.

Advertisement: