PEAK XOOPS - How to delete contents of myalbum-p when user delete his account with? in englishin japanese

How to delete contents of myalbum-p when user delete his account with?

List posts in the topic

question How to delete contents of myalbum-p when user delete his account with?

msg# 1
depth:
0
Previous post - Next post | Parent - No child | Posted on 2010/3/18 15:08 | Last modified
shirahagi  二等兵   Posts: 2
How to delete contents of myalbum-p when user delete his account with?

all modules has this problem which deleted user left contents, but especially myalbum-p posting has a lot of photos(much heavy!), so I want to make delete all his posting with his account deleting.

Is it possible?

One japanese girl has same problem on this BBS(in japanese, but you can see "code" only, must be), but still correct answer has not yet.
http://xoopscube.jp/forum/6658

One guy suggested below PHP code, it is quite smart one, this preload is working on xoops-cube he said.

Make "User_ExtendedDelete.class.php" file, and paste this code, and put this file into XOOPS_root/preload/ .
That's quite simple.
But the japanese girl and me as well cant get good working.

<?php

if( ! defined( 'XOOPS_ROOT_PATH' ) ) exit ;

class User_ExtendedDelete extends XCube_ActionFilter
{
function preFilter()
{
$this->mRoot->mDelegateManager->add('Legacy.Event.UserDelete' , array(&$this, 'hook'));
$this->mRoot->mDelegateManager->add('Legacy.Admin.Event.UserDelete.Success', array(&$this, 'hook'));
}

function hook( &$userObj )
{
//myalbum-p
global $xoopsDB;

include_once XOOPS_ROOT_PATH."/modules/myalbum/include/read_configs.php" ;
$uid = $userObj->get('uid');
$whr = "submitter=$uid" ;
$prs = $xoopsDB->query("SELECT lid, ext FROM $table_photos WHERE $whr" ) ;
while( list( $lid , $ext ) = $xoopsDB->fetchRow( $prs ) ) {
xoops_comment_delete( $myalbum_mid , $lid ) ;
xoops_notification_deletebyitem( $myalbum_mid , 'photo' , $lid ) ;

$xoopsDB->query( "DELETE FROM $table_votedata WHERE lid=$lid" ) or die( "DB error: DELETE votedata table." ) ;
$xoopsDB->query( "DELETE FROM $table_text WHERE lid=$lid" ) or die( "DB error: DELETE text table." ) ;
$xoopsDB->query( "DELETE FROM $table_photos WHERE lid=$lid" ) or die( "DB error: DELETE photo table." ) ;

@unlink( "$photos_dir/$lid.$ext" ) ;
@unlink( "$photos_dir/$lid.gif" ) ;
@unlink( "$thumbs_dir/$lid.$ext" ) ;
@unlink( "$thumbs_dir/$lid.gif" ) ;
}

}
}
?>

So, I just trying to asking for international Xoops peaple,
If some one knows how to do this, please tell me.

when I get it, I ll tell to guys too.

regard
Votes:7 Average:10.00

Posts tree

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!