Writing Joomla bridge - User plugin

前端 未结 1 1825
有刺的猬
有刺的猬 2020-12-12 06:00

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

1条回答
  •  無奈伤痛
    2020-12-12 06:13

    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
      
    
    
    

    0 讨论(0)
提交回复
热议问题