database - Writing Joomla bridge - User plugin -
i want write joomla plugin connect user tables in database (one way).
so on new user registration, user duplicated , stored in second table (other script). main goal. things updating on password change/delete etc. can left until later.
any ideas can find information helping me write plugin joomla 1.6? can user registration data etc?
i have written plugin joomla 1.6 takes new registered user's id , puts table. deletes user info secondary table if user account deleted. should going, have @ code below:
this plugin called: 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 #__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 #__foo_users 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. 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>
Comments
Post a Comment