Skip to Content Skip to Menu

Problem with function in a plugin

  • alsab
  • alsab
  • OFFLINE
  • Posts: 3
  • Thanks: 0
  • Karma: 0
14 years 3 months ago #138602 by alsab
Problem with function in a plugin was created by alsab
Hello,

I have a little problem. I can't understand.
I use a function for delete some files.

with this trigger, no problem:

$_PLUGINS->registerFunction( 'onAfterEditATab', 'deleteartiprobatentry', 'getchangeartiprobat2fieldTab' );

But if I use this trigger the function doesn't work:

$_PLUGINS->registerFunction( 'onBeforeDeleteUser', 'deleteartiprobatentry', 'getchangeartiprobat2fieldTab' );


I just change onAfterEditATab by onBeforeDeleteUser.
Do you have an idea?

Thanks

function deleteartiprobatentry() {

$dossier = 'images/com_artiprobat2/gallery/91' ;
$ouverture=@opendir($dossier);
if (!$ouverture) return;
while($fichier=readdir($ouverture)) {
if ($fichier == '.' || $fichier == '..') continue;
if (is_dir($dossier."/".$fichier)) {
$r=clearDir($dossier."/".$fichier);
if (!$r) return false;
}
else {
$r=@unlink($dossier."/".$fichier);
if (!$r) return false;
}
}
closedir($ouverture);
$r=@rmdir($dossier); }

Post edited by: alsab, at: 2010/07/24 15:30

Post edited by: alsab, at: 2010/07/24 15:32

Please Log in or Create an account to join the conversation.

  • alsab
  • alsab
  • OFFLINE
  • Posts: 3
  • Thanks: 0
  • Karma: 0
14 years 3 months ago #138658 by alsab
Replied by alsab on topic Re:Problem with function in a plugin
Hello,

I try this very simple function


function deletesobientry() {
unlink ("images/com_artiprobat2/clients/65_thumb_1.jpg");
}

If I use this trigger:
$_PLUGINS->registerFunction( 'onAfterUserUpdate', 'deletesobientry', 'getchangeartiprobat2fieldTab' );

And I update a profil, the file is deleted.

But if I use this trigger:
$_PLUGINS->registerFunction( 'onBeforeDeleteUser', 'deletesobientry', 'getchangeartiprobat2fieldTab' );

And I delete a profil, the file is not deleted.


Why can I not delete a file when I delete an user?
Could you explain me, because I don't understand.
Thanks

Post edited by: alsab, at: 2010/07/26 14:09

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum