Trying to delete an user

Author Message

Antoine W.

Thursday 04 August 2005 7:16:43 am

Hi !
I'm coding a custom login handler and I need to delete an user when this user dont more exist in a distant database.
I have tried with the following code :

$existUser =& $this->fetchByName( $login );
if( $existUser )
{
    $userId =& $existUser->id();
    eZUser::removeUser( $userId );
}

With this code, user that should be deleted already exists in the user list, but all its attributes are empty (login, password, email...).
Do you know which function must be called to remove node assignment of this object ? Must I call other functions to be sure to delete every related informations about this user ?
Thanks !

Antoine W.

Friday 12 August 2005 3:41:12 am

After searching a few days, I cant find a code working to delete properly an user.
Any help would be greatly appreciated =)

K259

Tuesday 16 August 2005 6:27:59 am

I wonder how it's possible to delete a user with sql on the command line in eZ publish...and howto list all users which belongs to a specific group with sql.

Michael D.

Wednesday 10 May 2006 4:44:14 am

Antoine: Try adding this code under eZUser::removeUser

eZContentObjectTreeNode::removeSubtrees( array($existUser->attribute("node_id")), false );

The second parameter tells ez to delete the user (if false) instead of just moving it into the trash (if true).

I hope this helps.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 19:39:22
Script start
Timing: Jan 18 2025 19:39:22
Module start 'layout'
Timing: Jan 18 2025 19:39:22
Module start 'content'
Timing: Jan 18 2025 19:39:22
Module end 'content'
Timing: Jan 18 2025 19:39:22
Script end

Main resources:

Total runtime0.6561 sec
Peak memory usage4,096.0000 KB
Database Queries62

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0042 587.9141152.6250
Module start 'layout' 0.00420.0022 740.539139.4453
Module start 'content' 0.00640.6483 779.9844512.4063
Module end 'content' 0.65470.0014 1,292.390612.4766
Script end 0.6561  1,304.8672 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00290.4401160.0002
Check MTime0.00120.1809160.0001
Mysql Total
Database connection0.00050.073910.0005
Mysqli_queries0.615693.8298620.0099
Looping result0.00070.0997600.0000
Template Total0.630796.120.3153
Template load0.00200.310820.0010
Template processing0.628695.813220.3143
Template load and register function0.00020.034610.0002
states
state_id_array0.00100.145510.0010
state_identifier_array0.00150.234620.0008
Override
Cache load0.00160.2429200.0001
Sytem overhead
Fetch class attribute can translate value0.00070.102330.0002
Fetch class attribute name0.00100.159040.0003
XML
Image XML parsing0.00030.049730.0001
class_abstraction
Instantiating content class attribute0.00000.001440.0000
General
dbfile0.00070.1092100.0001
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 17
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs