I have a external script for a web app connected to Joomla database This is for user registration Source : https://gist.github.com/AdamMadrzejewski/2581730241748da89798
<?php require_once __DIR__ . '/db_connect.php'; $type = '0'; $username = 'username'; $password = 'pass'; $name = 'john'; $mobile = '9090909090'; $email = '[email protected]'; $alias = strtr($name, array (' ' => '-')); define( '_JEXEC', 1 ); define('JPATH_BASE', dirname(__FILE__) ); define( 'DS', DIRECTORY_SEPARATOR ); require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' ); require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' ); $app = JFactory::getApplication('site'); $app->initialise(); require_once(JPATH_BASE.DS.'components'.DS.'com_users'.DS.'models'.DS.'registration.php'); $lang = JFactory::getLanguage(); $extension = 'com_users'; $base_dir = JPATH_SITE; $language_tag = 'en-GB'; $reload = true; $lang->load($extension, $base_dir, $language_tag, $reload); $model = new UsersModelRegistration(); jimport('joomla.mail.helper'); jimport('joomla.user.helper'); $block = '0'; $sendEmail = '0'; $activation = '1'; $data = array( 'username' => $username, 'name' => $name, 'email1' => $email, 'password1' => $password, // First password field 'password2' => $password, // Confirm password field 'sendEmail' => $sendEmail, 'activation' => $activation, 'mobile' => $mobile, 'groups' =>array("2","10")); $response = $model->register($data); echo $data['mobile']; Expected result is store all the values including a custom field called 'mobile' in #__users table
but it stores all the values except for mobile I have added declared the variable
$mobile = null; // line 60 at root/libraries/joomla/user/user.php Adding value at com_users/models/forms/registration.xml doesn't help
<field name="mobile" type="text" description="COM_USERS_DESIRED_USERNAME" filter="mobile" label="COM_USERS_REGISTER_USERNAME_LABEL" message="COM_USERS_REGISTER_USERNAME_MESSAGE" size="30" /> But somehow it doesnt store only mobile value in the table
Where am i going wrong ? This code calls the function com_users/models/registration.php
public function register() Where exactly should I modify to add the value 'mobile'? Appreciate the help !