I want to write a Joomla plugin to connect to user tables in database (one way).
So on new user registration, user will be duplicated and stored also in second table
I have written a plugin for Joomla 1.6 that takes the new registered user's id and puts it into another table. It also deletes the user info from the secondary table if the user account is deleted. This should get you going, have a look at my code below:
This is for a plugin called: plg_foo_user
foouser.php
setQuery( 'INSERT INTO #__foo_users (user_id) VALUES ('.$user['id'].')' );
$db->query();
}
}
function onUserAfterDelete( $user, $success, $msg ) {
//JError::raiseWarning(100, 'here2');
$db = &JFactory::getDBO();
if ($success) {
$db->setQuery( 'DELETE FROM #__foo_users WHERE user_id ='.$user['id'] );
$db->query();
return true;
}
}
}
?>
foouser.xml
Foo User
Martin Rose
January 2011
(C) 2011 Open Source Matters. All rights reserved.
GNU/GPL
1.0
Making foo happen
foouser.php
index.html