解决方法
我为Joomla 1.6编写了一个插件,它接受新注册用户的id并将其放入另一个表中.如果删除了用户帐户,它还会从辅助表中删除用户信息.这应该让你去,看看我的代码如下:
这是一个名为:plg_foo_user的插件
foouser.PHP
<?PHP defined('_JEXEC') or die(); jimport('joomla.plugin.plugin'); class plgUserFooUser extends JPlugin { function onUserAfterSave( $user,$isnew,$success,$msg ) { //JError::raiseWarning(100,'here1'); if ($isnew && $success) { $db = &JFactory::getDBO(); $db->setQuery( 'INSERT INTO #__foo_users (user_id) VALUES ('.$user['id'].')' ); $db->query(); } } function onUserAfterDelete( $user,'here2'); $db = &JFactory::getDBO(); if ($success) { $db->setQuery( 'DELETE FROM #__foo_users WHERE user_id ='.$user['id'] ); $db->query(); return true; } } } ?>
foouser.xml
<?xml version="1.0" encoding="utf-8"?> <extension version="1.6" type="plugin" group="user"> <name>Foo User</name> <author>Martin Rose</author> <creationDate>January 2011</creationDate> <copyright>(C) 2011 Open Source Matters. All rights reserved.</copyright> <license>GNU/GPL</license> <authorEmail></authorEmail> <authorUrl></authorUrl> <version>1.0</version> <description>Making foo happen</description> <files> <filename plugin="foouser">foouser.PHP</filename> <filename>index.html</filename> </files> </extension>