title: Joomla user registration plugin field
body: <p>I have a plug-in with one drop-down list in profile.xml.</p>
  
  <p><strong>profiles / profile.xml</strong></p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  
      &lt;form&gt;
      &lt;fields name="rqegroup"&gt;
      &lt;fieldset name="rqegroup" class="rqegroup_field"&gt;  
      &lt;field 
      name="rqe_user_group" 
      type="sql" 
      description="PLG_USER_PROFILE_QQQ"
      default="2" 
      label="Select an article" 
      query="SELECT id, groupname FROM #__xxx_yyyy" 
      key_field="id" 
      value_field="groupname" /&gt;
  
     &lt;/fieldset&gt;
     &lt;/fields&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>profiles1.php</strong></p>
  
  <pre><code>&lt;?php
  defined('_JEXEC') or die('(@)|(@)');
  
  jimport('joomla.plugin.plugin');
  
  
  class plgUserRqeuseragent extends JPlugin
  {
      protected $my_var = null; // if needed
  
      public function __construct(&amp; $subject, $config)
      {
          parent::__construct($subject, $config);
          $this-&gt;loadLanguage();
      }
  
  
  function onContentPrepareForm($form, $data)
          {
                  $lang = JFactory::getLanguage();
                  $lang-&gt;load('plg_user_rqegroup', JPATH_ADMINISTRATOR);
  
  if (!($form instanceof JForm))
          {
              $this-&gt;_subject-&gt;setError('JERROR_NOT_A_FORM');
              return false;
          }
  
          $name = $form-&gt;getName();
          if (!in_array($name, array('com_admin.profile', 'com_users.user', 'com_users.profile', 'com_users.registration')))
          {
              return true;
          }
  
          JForm::addFormPath(__DIR__ . '/profiles');
          $form-&gt;loadFile('profile', false);
  
  
  
          return true;
  
  }
  
      public function onUserAfterSave($user, $isnew, $success, $msg)
      {
  $db = JFactory::getDbo();
  $query = $db-&gt;getQuery(true);
  $columns = array(
      'login', 
      'name',
      'jid'
  );
  $values = array(
      "'".$user['username']."'", 
      "'".$user['name']."'", 
      $user['id']
  );
  $query-&gt;insert($db-&gt;quoteName('#__qqqq_qqqq'))
      -&gt;columns($db-&gt;quoteName($columns))
      -&gt;values(implode(',', $values));
  $db-&gt;setQuery($query)
      -&gt;execute();    
  
  
      }
  
      public function onUserAfterDelete($user, $succes, $msg)
      {
  
  
      }   
  }
  ?&gt;
  </code></pre>
  
  <p>How can I get the value of the field in the profile1.php and insert it into the database?</p>
  
  <p>Folder Structure <br>
  profiles / profile.xml<br>
  profiles1.php<br>
  profiles1.xml</p>