Пример #1
0
 /**
  * 
  * Enter description here ...
  * @param JForm $form
  * @param unknown $data
  */
 function onContentPrepareForm($form, $data)
 {
     $app = JFactory::getApplication();
     $doc = JFactory::getDocument();
     $this->template = $this->getTemplateName();
     if ($this->template && ($app->isAdmin() && $form->getName() == 'com_templates.style' || $app->isSite() && ($form->getName() == 'com_config.templates' || $form->getName() == 'com_templates.style'))) {
         jimport('joomla.filesystem.path');
         //JForm::addFormPath( dirname(__FILE__) . DS. 'includes' . DS .'assets' . DS . 'admin' . DS . 'params');
         $plg_file = JPath::find(dirname(__FILE__) . DS . 'includes' . DS . 'assets' . DS . 'admin' . DS . 'params', 'template.xml');
         $tpl_file = JPath::find(JPATH_ROOT . DS . 'templates' . DS . $this->template, 'templateDetails.xml');
         if (!$plg_file) {
             return false;
         }
         if ($tpl_file) {
             $form->loadFile($plg_file, false, '//form');
             $form->loadFile($tpl_file, false, '//config');
         } else {
             $form->loadFile($plg_file, false, '//form');
         }
         if ($app->isSite()) {
             $jmstorage_fields = $form->getFieldset('jmstorage');
             foreach ($jmstorage_fields as $name => $field) {
                 $form->removeField($name, 'params');
             }
             $form->removeField('config', 'params');
         }
         if ($app->isAdmin()) {
             $doc->addStyleDeclaration('#jm-ef3plugin-info, .jm-row > .jm-notice {display: none !important;}');
         }
     }
 }
Пример #2
0
 protected function preprocessForm(\JForm $form, $data, $group = 'content')
 {
     // if no data, grab the posted form data.
     if (!$data instanceof JObject) {
         $data = JFactory::getApplication()->input->get('jform', $data, 'array');
         $data = JArrayHelper::toObject($data);
     }
     $params = new JRegistry();
     $params->loadArray($data->params);
     if ($params->get('discovery.url')) {
         $plugin = $params->get('discovery.type');
         $language = JFactory::getLanguage();
         $language->load('plg_harvest_' . $plugin);
         $path = JPATH_ROOT . '/plugins/harvest/' . $plugin . '/forms/harvest.xml';
         $form->loadFile($path, false);
         foreach (JPluginHelper::getPlugin('ingest') as $plugin) {
             $language->load('plg_ingest_' . $plugin->name);
             $path = JPATH_ROOT . '/plugins/ingest/' . $plugin->name . '/forms/ingest.xml';
             $form->loadFile($path, false);
         }
         $form->removeField('originating_url');
         $form->removeField('harvester');
         // hide the run_once value (users cannot set it after discovery)
         $form->setFieldAttribute("run_once", 'type', 'hidden');
         $form->setFieldAttribute("run_once", 'class', '');
     } else {
         $form->removeField('state');
         $form->removeField('harvested');
         $form->removeField('url', 'params.discovery');
         $form->removeField('type', 'params.discovery');
     }
     parent::preprocessForm($form, $data, $group);
 }
Пример #3
0
 /**
  * Override preprocessForm to load the user plugin group instead of content.
  *
  * @param	object	A form object.
  * @param	mixed	The data expected for the form.
  * @throws	Exception if there is an error in the form event.
  * @since	1.6
  */
 protected function preprocessForm(JForm $form, $data, $group = 'user')
 {
     $userParams = JComponentHelper::getParams('com_users');
     // Deal with captcha
     $captcha = $userParams->get('captcha', '0');
     $captchaRemind = $userParams->get('allowCaptchaUserRemind', '0');
     if ($captcha === '0') {
         $form->removeField('captcha');
     } else {
         if ($captchaRemind === '0') {
             $form->removeField('captcha');
         } else {
             $form->setFieldAttribute('captcha', 'plugin', $captcha);
         }
     }
     parent::preprocessForm($form, $data, 'user');
 }
Пример #4
0
 /**
  * @param	int $userId		The user id
  * @param	JForm $form
  *
  * @return	boolean
  */
 function onPrepareUserProfileForm($userId, &$form)
 {
     // Add the profile fields to the form.
     JForm::addFormPath(dirname(__FILE__) . DS . 'profiles');
     $form->load('profile', true, false);
     // Toggle whether the address1 field is required.
     if ($this->params->get('profile-require_address1', 1) > 0) {
         $form->setFieldAttribute('address1', 'required', $this->params->get('profile-require_address1') == 2, 'profile');
     } else {
         $form->removeField('address1', 'profile');
     }
     // Toggle whether the address2 field is required.
     if ($this->params->get('profile-require_address2', 1) > 0) {
         $form->setFieldAttribute('address2', 'required', $this->params->get('profile-require_address2') == 2, 'profile');
     } else {
         $form->removeField('address2', 'profile');
     }
     // Toggle whether the city field is required.
     if ($this->params->get('profile-require_city', 1) > 0) {
         $form->setFieldAttribute('city', 'required', $this->params->get('profile-require_address1') == 2, 'profile');
     } else {
         $form->removeField('city', 'profile');
     }
     // Toggle whether the region field is required.
     if ($this->params->get('profile-require_region', 1) > 0) {
         $form->setFieldAttribute('region', 'required', $this->params->get('profile-require_address1') == 2, 'profile');
     } else {
         $form->removeField('region', 'profile');
     }
     // Toggle whether the country field is required.
     if ($this->params->get('profile-require_country', 1) > 0) {
         $form->setFieldAttribute('country', 'required', $this->params->get('profile-require_address1') == 2, 'profile');
     } else {
         $form->removeField('country', 'profile');
     }
     // Toggle whether the postal code field is required.
     if ($this->params->get('profile-require_postal_code', 1) > 0) {
         $form->setFieldAttribute('postal_code', 'required', $this->params->get('profile-require_address1') == 2, 'profile');
     } else {
         $form->removeField('postal_code', 'profile');
     }
     // Toggle whether the phone field is required.
     if ($this->params->get('profile-require_phone', 1) > 0) {
         $form->setFieldAttribute('phone', 'required', $this->params->get('profile-require_address1') == 2, 'profile');
     } else {
         $form->removeField('phone', 'profile');
     }
     // Toggle whether the website field is required.
     if ($this->params->get('profile-require_website', 1) > 0) {
         $form->setFieldAttribute('website', 'required', $this->params->get('profile-require_address1') == 2, 'profile');
     } else {
         $form->removeField('website', 'profile');
     }
     return true;
 }
 function onContentPrepareForm(JForm $form, $data)
 {
     $name = $form->getName();
     if (!in_array($name, array('com_admin.profile', 'com_users.user', 'com_users.profile', 'com_users.registration'))) {
         return true;
     }
     // Add the extra fields
     JForm::addFormPath(dirname(__FILE__) . '/profiles');
     $form->loadFile('profile', false);
     // If we're admin we can do some extra things
     if ($name != "com_users.user") {
         $form->setFieldAttribute("programmename", "readonly", true, "swg_extras");
         // 			$form->setFieldAttrib("leaderid", "readonly", )
         $form->removeField("leaderid", "swg_extras");
         $form->removeField("leadersetup", "swg_extras");
     }
     return true;
 }
Пример #6
0
 protected function preprocessForm(JForm $form, $data, $group = 'content')
 {
     $template = $this->getState('template.template');
     $lang = JFactory::getLanguage();
     $template_path = COM_TZ_PORTFOLIO_PLUS_PATH_SITE . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $template;
     jimport('joomla.filesystem.path');
     $formFile = JPath::clean($template_path . DIRECTORY_SEPARATOR . 'template.xml');
     // Load the core and/or local language file(s).
     $lang->load('tpl_' . $template, $template_path, null, false, true) || $lang->load('tpl_' . $template, $template_path . '/templates/' . $template, null, false, true);
     $default_directory = 'components' . DIRECTORY_SEPARATOR . 'com_tz_portfolio_plus' . DIRECTORY_SEPARATOR . 'templates';
     $directory = $default_directory . DIRECTORY_SEPARATOR . $template . DIRECTORY_SEPARATOR . 'html';
     if (JFolder::exists(JPATH_SITE . DIRECTORY_SEPARATOR . $directory)) {
         $form->setFieldAttribute('layout', 'directory', $directory, 'params');
     } elseif (is_array($data) && array_key_exists('protected', $data) && $data['protected'] == 1 || is_object($data) && isset($data->protected) && $data->protected == 1) {
         $form->removeField('layout', 'params');
     } else {
         $form->removeField('layout', 'params');
     }
     if (file_exists($formFile)) {
         // Get the template form.
         if (!$form->loadFile($formFile, false, '//config')) {
             throw new Exception(JText::_('JERROR_LOADFILE_FAILED'));
         }
     }
     // Disable home field if it is default style
     if (is_array($data) && array_key_exists('home', $data) && $data['home'] == '1' || is_object($data) && isset($data->home) && $data->home == '1') {
         $form->setFieldAttribute('home', 'readonly', 'true');
     }
     // Attempt to load the xml file.
     if (!($xml = simplexml_load_file($formFile))) {
         throw new Exception(JText::_('JERROR_LOADFILE_FAILED'));
     }
     // Get the help data from the XML file if present.
     $help = $xml->xpath('/extension/help');
     if (!empty($help)) {
         $helpKey = trim((string) $help[0]['key']);
         $helpURL = trim((string) $help[0]['url']);
         $this->helpKey = $helpKey ? $helpKey : $this->helpKey;
         $this->helpURL = $helpURL ? $helpURL : $this->helpURL;
     }
     // Trigger the default form events.
     parent::preprocessForm($form, $data, $group);
 }
Пример #7
0
 /**
  * Display method
  *
  * @param   string  $tpl  The template name
  *
  * @return  void
  */
 public function display($tpl = null)
 {
     $model = $this->getModel();
     $app = JFactory::getApplication();
     $this->contentElementName = RedcoreHelpersTranslation::getCurrentContentElement();
     $this->componentName = $app->input->get->get('component', $model->getState('filter.component', ''));
     $this->activeFilters = $model->getActiveFilters();
     $this->state = $model->getState();
     $this->filterForm = $model->getForm();
     $this->pagination = $model->getPagination();
     if (!empty($this->contentElementName)) {
         $this->translationTable = RedcoreHelpersTranslation::getTranslationTable();
         $this->contentElement = RTranslationHelper::getContentElement($this->translationTable->option, $this->translationTable->xml);
         $this->items = $model->getItems();
         $this->filterForm->removeField('component', 'filter');
     } else {
         /** @var RedcoreModelConfig $modelConfig */
         $modelConfig = RModelAdmin::getAdminInstance('Config', array('ignore_request' => true), 'com_redcore');
         if (!empty($this->componentName)) {
             $this->component = $modelConfig->getComponent($this->componentName);
         }
         $this->contentElements = $modelConfig->loadContentElements($this->componentName);
         $this->missingContentElements = $modelConfig->loadMissingContentElements($this->componentName, $this->contentElements);
         $this->return = base64_encode('index.php?option=com_redcore&view=translations&contentelement=&component=' . $this->componentName);
         $layout = 'manage';
         $this->setLayout($layout);
         $app->input->set('layout', $layout);
         $this->filterForm->removeField('language', 'filter');
         $this->filterForm->removeField('search_translations', 'filter');
         $this->filterForm->removeField('translations_limit', 'list');
         $this->filterForm->removeField('contentelement', 'filter');
     }
     // Check if option is enabled
     if (RBootstrap::getConfig('enable_translations', 0) == 0) {
         JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_REDCORE_CONFIG_TRANSLATIONS_PLUGIN_LABEL_WARNING', '<a href="index.php?option=com_plugins&view=plugins&filter_search=redcore">' . JText::_('COM_REDCORE_CONFIGURE') . '</a>'), 'error');
     }
     parent::display($tpl);
 }
Пример #8
0
 protected function preprocessForm(JForm $form, $data, $group = 'content')
 {
     $app = JFactory::getApplication();
     $params = JComponentHelper::getParams('com_djcatalog2');
     $user = JFactory::getUser();
     $switchable_fields = array('contact_phone', 'contact_street', 'contact_city', 'contact_zip', 'contact_country', 'contact_company_name', 'contact_email_copy');
     foreach ($switchable_fields as $field_name) {
         if ($params->get($field_name . '_field', '0') == '0') {
             $form->removeField($field_name);
         } else {
             if ($params->get($field_name . '_field', '0') == '2') {
                 $form->setFieldAttribute($field_name, 'required', 'required');
                 $form->setFieldAttribute($field_name, 'class', $form->getFieldAttribute($field_name, 'class') . ' required');
             }
         }
     }
     $plugin = JFactory::getApplication()->getParams()->get('contact_captcha', JFactory::getConfig()->get('captcha'));
     if ($user->id > 0 || ($plugin === 0 || $plugin === '0' || $plugin === '' || $plugin === null)) {
         $form->removeField('captcha');
     } else {
         $form->setFieldAttribute('captcha', 'plugin', $plugin, 'captcha');
     }
 }
Пример #9
0
 /**
  * Adds additional fields to the user editing form
  *
  * @param   JForm  $form  The form to be altered.
  * @param   mixed  $data  The associated data for the form.
  *
  * @return  boolean
  */
 public function onContentPrepareForm($form, $data)
 {
     if (!$form instanceof JForm) {
         $this->_subject->setError('JERROR_NOT_A_FORM');
         return false;
     }
     // We only work with com_users.* and com_admin.profile:
     $form_name = $form->getName();
     if (!in_array($form_name, array('com_admin.profile', 'com_users.user', 'com_users.profile', 'com_users.registration'))) {
         return true;
     }
     //JLog::add("onContentPrepareForm ".htmlentities($form_name));
     $app = JFactory::getApplication();
     if ($app->isSite() && $form_name == 'com_users.registration') {
         $lang = JFactory::getLanguage()->getTag();
         $form->removeField("email2");
         $grpoptions = "";
         foreach (explode(",", $this->params->get('altgroups')) as $grp) {
             $grp = htmlentities(trim($grp));
             $grpoptions .= "        <option value=\"{$grp}\">" . ($lang == "ru-RU" ? "Я -" : "I'm") . " {$grp}</option>\n";
         }
         /* Append "altgroup.groupname" field to "default" fieldset
          * so that it would be rendered in the same "block" as
          * core user fields like "username/email/password": */
         $form->load('<form>' . '  <fields name="altgroup">' . '    <fieldset name="default">' . '      <field name="groupname" type="radio"' . '          label=' . ($lang == "ru-RU" ? '"Кто вы?"' : '"Who are you?"') . '          required="true">' . $grpoptions . '      </field>' . '    </fieldset>' . '  </fields>' . '</form>');
         /* JLog::add("input=".self::_str(
         		$form->getInput("groupname", "altgroup")));
         	    JLog::add("form=".self::_str($form));*/
     } elseif ($form_name == 'com_users.profile') {
         $lang = JFactory::getLanguage()->getTag();
         $form->removeField("email2");
         $group_names = array();
         if (isset($data->altgroup['groups'])) {
             foreach ($data->altgroup['groups'] as $g) {
                 $group_names[] = $g[1];
             }
         }
         /* Append "altgroup.groupnames" field to "core"
          * fieldset: */
         $form->load('<form>' . '  <fields name="altgroup">' . '    <fieldset name="core">' . '      <field name="groupnames" type="text"' . '          disabled="true"' . '          label=' . ($lang == "ru-RU" ? '"Вы:"' : '"You are:"') . '          default="' . htmlentities(implode(", ", $group_names)) . '"' . '      />' . '    </fieldset>' . '  </fields>' . '</form>');
     }
     return true;
 }
Пример #10
0
 /**
  * Method to allow derived classes to preprocess the form.
  *
  * @param	object	A form object.
  * @param	mixed	The data expected for the form.
  * @param	string	The name of the plugin group to import (defaults to "content").
  * @throws	Exception if there is an error in the form event.
  * @since	1.6
  */
 protected function preprocessForm(JForm $form, $data, $group = 'user')
 {
     $userParams = JComponentHelper::getParams('com_users');
     // Deal with captcha
     $captcha = $userParams->get('captcha', '0');
     $captchaLogin = $userParams->get('allowCaptchaUserLogin', '0');
     if ($captcha === '0') {
         $form->removeField('captcha');
     } else {
         if ($captchaLogin === '0') {
             $form->removeField('captcha');
         } else {
             $form->setFieldAttribute('captcha', 'plugin', $captcha);
         }
     }
     // Import the approriate plugin group.
     JPluginHelper::importPlugin($group);
     // Get the dispatcher.
     $dispatcher = JDispatcher::getInstance();
     // Trigger the form preparation event.
     $results = $dispatcher->trigger('onContentPrepareForm', array($form, $data));
     // Check for errors encountered while preparing the form.
     if (count($results) && in_array(false, $results, true)) {
         // Get the last error.
         $error = $dispatcher->getError();
         // Convert to a JException if necessary.
         if (!$error instanceof Exception) {
             throw new Exception($error);
         }
     }
 }
Пример #11
0
 /**
 	 * @param	JForm	$form	The form to be altered.
 	 * @param	array	$data	The associated data for the form.
 	 *
 	 * @return	boolean
 	 * @since	1.6
 */
 function onContentPrepareForm($form, $data)
 {
     if (!$form instanceof JForm) {
         $this->_subject->setError('JERROR_NOT_A_FORM');
         return false;
     }
     // Check we are manipulating a valid form.
     $name = $form->getName();
     if (!in_array($name, array('com_admin.profile', 'com_users.user', 'com_users.profile', 'com_users.registration'))) {
         return true;
     }
     $lang = JFactory::getLanguage();
     $lang->load('plg_user_profile', JPATH_ADMINISTRATOR);
     $lang->load('mod_improved_ajax_login');
     // Add the registration fields to the form.
     $db = JFactory::getDBO();
     $db->setQuery('SELECT fields FROM #__offlajn_forms WHERE id = 1');
     $res = $db->loadObject();
     $fields = json_decode($res->fields);
     function getAttr($obj, $name)
     {
         $name = 'jform[elem_' . $name . ']';
         return isset($obj->{$name}) ? $obj->{$name} : null;
     }
     $xml = '<form><fields name="improved"><fieldset name="improved" label="PLG_USER_PROFILE_SLIDER_LABEL"></fieldset></fields></form>';
     $profile = JFactory::getXML($xml, false);
     foreach ($fields->page as $page) {
         foreach ($page->elem as $elem) {
             $type = getAttr($elem, 'type');
             $name = getAttr($elem, 'name');
             if (!isset($type->profile) || $name->value == 'newsletter') {
                 continue;
             }
             $field = $profile->fields->fieldset->addChild('field');
             $field->addAttribute('name', $name->value ? $name->value : $name->placeholder);
             $field->addAttribute('id', 'ial-' . getAttr($elem, 'name')->value);
             $field->addAttribute('type', isset($type->defaultValue) ? $type->defaultValue : $type->value);
             $field->addAttribute('required', getAttr($elem, 'required')->checked ? 'true' : 'false');
             $label = getAttr($elem, 'label');
             if ($label) {
                 $field->addAttribute('label', JText::_($label->value ? $label->value : (@$label->defaultValue ? @$label->defaultValue : @$label->placeholder)));
             }
             $title = getAttr($elem, 'title');
             if ($label) {
                 $field->addAttribute('description', JText::_($title->value ? $title->value : @$title->defaultValue));
             }
             $error = getAttr($elem, 'error');
             if ($error) {
                 $field->addAttribute('message', JText::_($error->value ? $error->value : $error->defaultValue));
             }
             if ($type->value == 'checkbox') {
                 $field->addAttribute('value', 'on');
             }
             if ($type->value == 'select') {
                 $field['type'] = 'list';
                 $xml = str_replace(array('[', ']'), array('<', '>'), $options = getAttr($elem, 'select')->value);
                 $opts = JFactory::getXML("<select>{$xml}</select>", false);
                 foreach ($opts as $opt) {
                     $option = $field->addChild('option');
                     $option->addAttribute('value', $opt['value']);
                     $option[0] = (string) $opt;
                 }
             }
             $article = getAttr($elem, 'article');
             if ($article) {
                 $field->addAttribute('article', $article->value);
                 $option = $field->addChild('option');
                 $option->addAttribute('value', 'on');
                 $option[0] = 'JYES';
             }
         }
     }
     $form->load($profile, false);
     if ($name != 'com_users.registration') {
         // We only want the TOS in the registration form
         $form->removeField('tos', 'improved');
     }
     return true;
 }
Пример #12
0
 /**
  * @param	JForm	$form	The form to be altered.
  * @param	array	$data	The associated data for the form.
  *
  * @return	boolean
  * @since	1.6
  */
 function onContentPrepareForm($form, $data)
 {
     // Load user_profile plugin language
     $lang = JFactory::getLanguage();
     $lang->load('plg_user_profile', JPATH_ADMINISTRATOR);
     if (!$form instanceof JForm) {
         $this->_subject->setError('JERROR_NOT_A_FORM');
         return false;
     }
     // Check we are manipulating a valid form.
     if (!in_array($form->getName(), array('com_admin.profile', 'com_users.user', 'com_users.registration', 'com_users.profile'))) {
         return true;
     }
     // Add the registration fields to the form.
     JForm::addFormPath(dirname(__FILE__) . '/profiles');
     $form->loadFile('profile', false);
     // Toggle whether the address1 field is required.
     if ($this->params->get('register-require_address1', 1) > 0) {
         $form->setFieldAttribute('address1', 'required', $this->params->get('register-require_address1') == 2, 'profile');
     } else {
         $form->removeField('address1', 'profile');
     }
     // Toggle whether the address2 field is required.
     if ($this->params->get('register-require_address2', 1) > 0) {
         $form->setFieldAttribute('address2', 'required', $this->params->get('register-require_address2') == 2, 'profile');
     } else {
         $form->removeField('address2', 'profile');
     }
     // Toggle whether the city field is required.
     if ($this->params->get('register-require_city', 1) > 0) {
         $form->setFieldAttribute('city', 'required', $this->params->get('register-require_city') == 2, 'profile');
     } else {
         $form->removeField('city', 'profile');
     }
     // Toggle whether the region field is required.
     if ($this->params->get('register-require_region', 1) > 0) {
         $form->setFieldAttribute('region', 'required', $this->params->get('register-require_region') == 2, 'profile');
     } else {
         $form->removeField('region', 'profile');
     }
     // Toggle whether the country field is required.
     if ($this->params->get('register-require_country', 1) > 0) {
         $form->setFieldAttribute('country', 'required', $this->params->get('register-require_country') == 2, 'profile');
     } else {
         $form->removeField('country', 'profile');
     }
     // Toggle whether the postal code field is required.
     if ($this->params->get('register-require_postal_code', 1) > 0) {
         $form->setFieldAttribute('postal_code', 'required', $this->params->get('register-require_postal_code') == 2, 'profile');
     } else {
         $form->removeField('postal_code', 'profile');
     }
     // Toggle whether the phone field is required.
     if ($this->params->get('register-require_phone', 1) > 0) {
         $form->setFieldAttribute('phone', 'required', $this->params->get('register-require_phone') == 2, 'profile');
     } else {
         $form->removeField('phone', 'profile');
     }
     // Toggle whether the website field is required.
     if ($this->params->get('register-require_website', 1) > 0) {
         $form->setFieldAttribute('website', 'required', $this->params->get('register-require_website') == 2, 'profile');
     } else {
         $form->removeField('website', 'profile');
     }
     // Toggle whether the favoritebook field is required.
     if ($this->params->get('register-require_favoritebook', 1) > 0) {
         $form->setFieldAttribute('favoritebook', 'required', $this->params->get('register-require_favoritebook') == 2, 'profile');
     } else {
         $form->removeField('favoritebook', 'profile');
     }
     // Toggle whether the aboutme field is required.
     if ($this->params->get('register-require_aboutme', 1) > 0) {
         $form->setFieldAttribute('aboutme', 'required', $this->params->get('register-require_aboutme') == 2, 'profile');
     } else {
         $form->removeField('aboutme', 'profile');
     }
     // Toggle whether the tos field is required.
     if ($this->params->get('register-require_tos', 1) > 0) {
         $form->setFieldAttribute('tos', 'required', $this->params->get('register-require_tos') == 2, 'profile');
     } else {
         $form->removeField('tos', 'profile');
     }
     // Toggle whether the dob field is required.
     if ($this->params->get('register-require_dob', 1) > 0) {
         $form->setFieldAttribute('dob', 'required', $this->params->get('register-require_dob') == 2, 'profile');
     } else {
         $form->removeField('dob', 'profile');
     }
     return true;
 }
Пример #13
0
 protected function preprocessForm(JForm $form, $data, $group = 'content')
 {
     $app = JFactory::getApplication();
     $params = JComponentHelper::getParams('com_djcatalog2');
     $user = JFactory::getUser();
     $allowed_categories = $params->get('fed_allowed_categories', array());
     JArrayHelper::toInteger($allowed_categories);
     if (!empty($allowed_categories)) {
         $form->setFieldAttribute('cat_id', 'allowed_categories', implode(',', $allowed_categories));
     }
     if ($params->get('fed_multiple_categories', '0') == '0') {
         $form->removeField('categories');
     } else {
         if (!empty($allowed_categories)) {
             $form->setFieldAttribute('categories', 'allowed_categories', implode(',', $allowed_categories));
         }
         if ((int) $params->get('fed_multiple_categories_limit', 3) > 0) {
             $form->setFieldAttribute('categories', 'limit', (int) $params->get('fed_multiple_categories_limit', 3));
             if (!empty($data->cat_id)) {
                 $form->setFieldAttribute('categories', 'ignored_values', $data->cat_id);
             }
         } else {
             if ($params->get('fed_multiple_categories_limit', 3) == '0') {
                 $form->removeField('categories');
             }
         }
     }
     if ($params->get('fed_producer', '0') == '0') {
         $form->removeField('producer_id');
     } else {
         if ($params->get('fed_producer', '0') == '2') {
             $form->setFieldAttribute('producer_id', 'required', 'required');
             $form->setFieldAttribute('producer_id', 'class', $form->getFieldAttribute('producer_id', 'class') . ' required');
         }
         if ($params->get('fed_producer_restrict', 0) == '1') {
             $form->setFieldAttribute('producer_id', 'validate', 'djcproducer');
             if (!empty($data->created_by) && $data->created_by > 0) {
                 $form->setFieldAttribute('producer_id', 'validate_user', $data->created_by);
             }
         }
     }
     if ($params->get('fed_price', '0') == '0') {
         $form->removeField('price');
         $form->removeField('special_price');
     } else {
         if ($params->get('fed_price', '0') == '2') {
             $form->setFieldAttribute('price', 'required', 'required');
             $form->setFieldAttribute('price', 'class', $form->getFieldAttribute('price', 'class') . ' required');
         }
     }
     if ($params->get('fed_featured', '0') == '0') {
         $form->removeField('featured');
     } else {
         if ($params->get('fed_featured', '0') == '2') {
             $form->setFieldAttribute('featured', 'required', 'required');
             $form->setFieldAttribute('featured', 'class', $form->getFieldAttribute('featured', 'class') . ' required');
         }
     }
     if ($params->get('fed_group', '0') == '0') {
         $form->removeField('group_id');
     } else {
         if ($params->get('fed_group', '0') == '2') {
             $form->setFieldAttribute('group_id', 'required', 'true');
             //$form->setFieldAttribute('group_id', 'class', $form->getFieldAttribute('group_id', 'class').' required');
         }
     }
     if ($params->get('fed_meta', '0') == '0') {
         $form->removeField('metatitle');
         $form->removeField('metakey');
         $form->removeField('metadesc');
     }
     if ($params->get('fed_intro_description_editor', null)) {
         $form->setFieldAttribute('intro_desc', 'editor', $params->get('fed_intro_description_editor'));
     }
     if ($params->get('fed_intro_description', '0') == '0') {
         $form->removeField('intro_desc');
     } else {
         if ($params->get('fed_intro_description', '0') == '2') {
             $form->setFieldAttribute('intro_desc', 'required', 'required');
             $form->setFieldAttribute('intro_desc', 'class', $form->getFieldAttribute('intro_desc', 'class') . ' required');
         }
     }
     if ($params->get('fed_description_editor', null)) {
         $form->setFieldAttribute('description', 'editor', $params->get('fed_description_editor'));
     }
     if ($params->get('fed_description', '0') == '0') {
         $form->removeField('description');
     } else {
         if ($params->get('fed_description', '0') == '2') {
             $form->setFieldAttribute('description', 'required', 'required');
             $form->setFieldAttribute('description', 'class', $form->getFieldAttribute('description', 'class') . ' required');
         }
     }
     $default_state = $params->get('fed_default_state', '0');
     $form->setFieldAttribute('published', 'default', $default_state);
     $is_owner = empty($data->created_by) && !empty($data) || isset($data->created_by) && (int) JFactory::getUser()->id === (int) $data->created_by ? true : false;
     if (!(JFactory::getUser()->authorise('core.edit.state', 'com_djcatalog2') || JFactory::getUser()->authorise('core.edit.state.own', 'com_djcatalog2') && $is_owner)) {
         if (isset($data->published)) {
             $form->removeField('published');
         }
     }
 }
Пример #14
0
 /**
  * @param	JForm	$form	The form to be altered.
  * @param	array	$data	The associated data for the form.
  *
  * @return	boolean
  * @since	1.6
  */
 public function onContentPrepareForm($form, $data)
 {
     $formName = $form->getName();
     // 		var_dump($formName);
     if ($formName == 'com_users.reset_request' || $formName == 'com_users.remind' || $formName == 'com_contact.contact') {
         return 1;
     }
     if (!$form instanceof JForm) {
         $this->_subject->setError('JERROR_NOT_A_FORM');
         return false;
     }
     JForm::addFormPath(JPATH_PLUGIN_HPUSER . DS . 'forms');
     $form->loadFile('hpuser', false);
     $user = JFactory::getUser();
     $userType = JRequest::getInt('type', -1);
     if (is_object($data) && isset($data->user_type)) {
         $userType = $data->user_type;
     }
     $form->setValue('user_type', '', $userType);
     if (@$data->id > 0) {
         if ($userType == 1) {
             $form->loadFile('business_user', false);
         } else {
             $form->loadFile('normal_user', false);
         }
     } elseif (!$user->get('isRoot')) {
         $form->loadFile('business_user', false);
         $form->loadFile('normal_user', false);
     }
     //If not at new user, don't editable user_type field
     if ($formName != 'com_users.registration' && @$data->id != 0) {
         $form->setFieldAttribute('user_type', 'readonly', 'true');
         $form->setFieldAttribute('username', 'readonly', 'true');
         $form->setFieldAttribute('email1', 'readonly', 'true');
         $form->removeField("email2");
         /*if($user->get('isRoot')) {
         			$form->setFieldAttribute('user_type', 'readonly', 'true');
         		} else {
         			$form->setFieldAttribute('user_type', 'type', 'hidden');
         		}*/
     } else {
         $form->removeField("business_logo", "business_profile");
         $form->removeField("business_banner", "business_profile");
     }
     return true;
 }
Пример #15
0
 /**
  * @param	JForm	$form	The form to be altered.
  * @param	array	$data	The associated data for the form.
  *
  * @return	boolean
  * @since	1.6
  */
 public function onRoomTypePrepareForm($form, $data)
 {
     // Load solidres plugin language
     $lang = JFactory::getLanguage();
     $lang->load('plg_extension_solidres', JPATH_ADMINISTRATOR);
     if (!$form instanceof JForm) {
         $this->_subject->setError('JERROR_NOT_A_FORM');
         return false;
     }
     // Check we are manipulating a valid form.
     if (!in_array($form->getName(), array('com_solidres.roomtype'))) {
         return true;
     }
     // Add the registration fields to the form.
     JForm::addFormPath(__DIR__ . '/fields');
     $form->loadFile('roomtype', false);
     // Toggle whether the checkin time field is required.
     if ($this->params->get('param_roomtype_room_facilities', 1) > 0) {
         $form->setFieldAttribute('room_facilities', 'required', $this->params->get('param_roomtype_room_facilities') == 2, 'roomtype_custom_fields');
     } else {
         $form->removeField('room_facilities', 'roomtype_custom_fields');
     }
     // Toggle whether the checkout time field is required.
     if ($this->params->get('param_roomtype_room_size', 1) > 0) {
         $form->setFieldAttribute('room_size', 'required', $this->params->get('param_roomtype_room_size') == 2, 'roomtype_custom_fields');
     } else {
         $form->removeField('room_size', 'roomtype_custom_fields');
     }
     // Toggle whether the cancellation prepayment field is required.
     if ($this->params->get('param_roomtype_bed_size', 1) > 0) {
         $form->setFieldAttribute('bed_size', 'required', $this->params->get('param_roomtype_bed_size') == 2, 'roomtype_custom_fields');
     } else {
         $form->removeField('bed_size', 'roomtype_custom_fields');
     }
     return true;
 }
Пример #16
0
 /**
  * adds additional fields to the user editing form
  *
  * @param   JForm  $form  The form to be altered.
  * @param   mixed  $data  The associated data for the form.
  *
  * @return  boolean
  *
  * @since   1.6
  */
 public function onContentPrepareForm($form, $data)
 {
     if (!$form instanceof JForm) {
         $this->_subject->setError('JERROR_NOT_A_FORM');
         return false;
     }
     // Check we are manipulating a valid form.
     $name = $form->getName();
     if (!in_array($name, array('com_admin.profile', 'com_users.user', 'com_users.profile', 'com_users.registration'))) {
         return true;
     }
     // Add the registration fields to the form.
     JForm::addFormPath(__DIR__ . '/profiles');
     $form->loadFile('profile', false);
     $fields = array('address1', 'address2', 'city', 'region', 'country', 'postal_code', 'phone', 'website', 'favoritebook', 'aboutme', 'dob', 'tos');
     // Change fields description when displayed in front-end or back-end profile editing
     $app = JFactory::getApplication();
     if ($app->isSite() || $name == 'com_users.user' || $name == 'com_admin.profile') {
         $form->setFieldAttribute('address1', 'description', 'PLG_USER_PROFILE_FILL_FIELD_DESC_SITE', 'profile');
         $form->setFieldAttribute('address2', 'description', 'PLG_USER_PROFILE_FILL_FIELD_DESC_SITE', 'profile');
         $form->setFieldAttribute('city', 'description', 'PLG_USER_PROFILE_FILL_FIELD_DESC_SITE', 'profile');
         $form->setFieldAttribute('region', 'description', 'PLG_USER_PROFILE_FILL_FIELD_DESC_SITE', 'profile');
         $form->setFieldAttribute('country', 'description', 'PLG_USER_PROFILE_FILL_FIELD_DESC_SITE', 'profile');
         $form->setFieldAttribute('postal_code', 'description', 'PLG_USER_PROFILE_FILL_FIELD_DESC_SITE', 'profile');
         $form->setFieldAttribute('phone', 'description', 'PLG_USER_PROFILE_FILL_FIELD_DESC_SITE', 'profile');
         $form->setFieldAttribute('website', 'description', 'PLG_USER_PROFILE_FILL_FIELD_DESC_SITE', 'profile');
         $form->setFieldAttribute('favoritebook', 'description', 'PLG_USER_PROFILE_FILL_FIELD_DESC_SITE', 'profile');
         $form->setFieldAttribute('aboutme', 'description', 'PLG_USER_PROFILE_FILL_FIELD_DESC_SITE', 'profile');
         $form->setFieldAttribute('dob', 'description', 'PLG_USER_PROFILE_FILL_FIELD_DESC_SITE', 'profile');
         $form->setFieldAttribute('tos', 'description', 'PLG_USER_PROFILE_FIELD_TOS_DESC_SITE', 'profile');
     }
     $tosarticle = $this->params->get('register_tos_article');
     $tosenabled = $this->params->get('register-require_tos', 0);
     // We need to be in the registration form, field needs to be enabled and we need an article ID
     if ($name != 'com_users.registration' || !$tosenabled || !$tosarticle) {
         // We only want the TOS in the registration form
         $form->removeField('tos', 'profile');
     } else {
         // Push the TOS article ID into the TOS field.
         $form->setFieldAttribute('tos', 'article', $tosarticle, 'profile');
     }
     foreach ($fields as $field) {
         // Case using the users manager in admin
         if ($name == 'com_users.user') {
             // Remove the field if it is disabled in registration and profile
             if ($this->params->get('register-require_' . $field, 1) == 0 && $this->params->get('profile-require_' . $field, 1) == 0) {
                 $form->removeField($field, 'profile');
                 if ($field == 'dob') {
                     $form->removeField('dob_spacer', 'profile');
                 }
             }
             if ($this->params->get('profile-require_dob', 1) > 0) {
                 $form->setFieldAttribute('spacer', 'type', 'spacer', 'profile');
             }
         } elseif ($name == 'com_users.registration') {
             // Toggle whether the field is required.
             if ($this->params->get('register-require_' . $field, 1) > 0) {
                 $form->setFieldAttribute($field, 'required', $this->params->get('register-require_' . $field) == 2 ? 'required' : '', 'profile');
             } else {
                 $form->removeField($field, 'profile');
                 if ($field == 'dob') {
                     $form->removeField('dob_spacer', 'profile');
                 }
             }
             if ($this->params->get('register-require_dob', 1) > 0) {
                 $form->setFieldAttribute('spacer', 'type', 'spacer', 'profile');
             }
         } elseif ($name == 'com_users.profile' || $name == 'com_admin.profile') {
             // Toggle whether the field is required.
             if ($this->params->get('profile-require_' . $field, 1) > 0) {
                 $form->setFieldAttribute($field, 'required', $this->params->get('profile-require_' . $field) == 2 ? 'required' : '', 'profile');
             } else {
                 $form->removeField($field, 'profile');
                 if ($field == 'dob') {
                     $form->removeField('dob_spacer', 'profile');
                 }
             }
             if ($this->params->get('profile-require_dob', 1) > 0) {
                 $form->setFieldAttribute('spacer', 'type', 'spacer', 'profile');
             }
         }
     }
     return true;
 }
 /**
  * 
  * We need to specially prepare the form because we're merging templateDetails.xml from a template and params.xml from the plugin.
  * @param JForm $form
  * @param mixed $data
  */
 function onContentPrepareForm($form, $data)
 {
     $app = JFactory::getApplication();
     $doc = JFactory::getDocument();
     $this->template = $this->getTemplateName();
     if ($this->template && ($app->isAdmin() && $form->getName() == 'com_templates.style' || $app->isSite() && ($form->getName() == 'com_config.templates' || $form->getName() == 'com_templates.style'))) {
         jimport('joomla.filesystem.path');
         //JForm::addFormPath( dirname(__FILE__) . DS. 'includes' . DS .'assets' . DS . 'admin' . DS . 'params');
         $plg_file = JPath::find(dirname(__FILE__) . DS . 'includes' . DS . 'assets' . DS . 'admin' . DS . 'params', 'template.xml');
         $tpl_file = JPath::find(JPATH_ROOT . DS . 'templates' . DS . $this->template, 'templateDetails.xml');
         $default_settings_file = JPATH_ROOT . DS . 'templates' . DS . $this->template . DS . 'templateDefaults.json';
         if (!$plg_file) {
             return false;
         }
         // params.xml should be loaded first and templateDetails.xml afterwards
         if ($tpl_file) {
             $form->loadFile($plg_file, false, '//form');
             $form->loadFile($tpl_file, false, '//config');
         } else {
             $form->loadFile($plg_file, false, '//form');
         }
         // for users' own safety, we don't allow some things to be changed in the front-end
         if ($app->isSite()) {
             $jmstorage_fields = $form->getFieldset('jmstorage');
             foreach ($jmstorage_fields as $name => $field) {
                 $form->removeField($name, 'params');
             }
             $form->removeField('config', 'params');
             $jmlayoutbuilder_fields = $form->getFieldset('jmlayoutbuilder');
             foreach ($jmlayoutbuilder_fields as $name => $field) {
                 $form->removeField($name, 'params');
             }
             $form->removeField('layout', 'params');
         }
         // Hiding a notice to enable this plugin. If plugin is disabled then the notice is visible. That's it.
         if ($app->isAdmin()) {
             $doc->addStyleDeclaration('#jm-ef3plugin-info, .jm-row > .jm-notice {display: none !important}');
         }
         if (JFile::exists($default_settings_file)) {
             $settings_json = JFile::read($default_settings_file);
             if ($settings_json) {
                 $defaults = json_decode($settings_json, true);
                 if ($defaults && is_array($defaults)) {
                     foreach ($form->getFieldset() as $field) {
                         $field_name = $field->__get('fieldname');
                         if (array_key_exists($field_name, $defaults) && is_scalar($defaults[$field_name])) {
                             $form->setFieldAttribute($field_name, 'default', $defaults[$field_name], $field->__get('group'));
                         }
                     }
                     /*if (!empty($data) && isset($data->params)) {
                     			foreach ($data->params as $param_name => $param_value) {
                     				if (empty($param_value) && array_key_exists($param_name, $defaults)  && is_scalar($defaults[$param_name])) {
                     					$data->params[$param_name] = $defaults[$param_name];
                     				}
                     			}
                     		}*/
                 }
             }
         }
     }
 }
Пример #18
0
 /**
  * @param	JForm	$form	The form to be altered.
  * @param	array	$data	The associated data for the form.
  *
  * @return	boolean
  * @since	1.6
  */
 function onContentPrepareForm($form, $data)
 {
     if (!$form instanceof JForm) {
         $this->_subject->setError('JERROR_NOT_A_FORM');
         return false;
     }
     // Check we are manipulating a valid form.
     $name = $form->getName();
     if (!in_array($name, array('com_admin.profile', 'com_users.user', 'com_users.profile', 'com_users.registration'))) {
         return true;
     }
     // Add the registration fields to the form.
     JForm::addFormPath(dirname(__FILE__) . '/profiles');
     $form->loadFile('profile', false);
     $fields = array('address1', 'address2', 'city', 'region', 'country', 'postal_code', 'phone', 'website', 'favoritebook', 'aboutme', 'tos', 'dob');
     foreach ($fields as $field) {
         // Case using the users manager in admin
         if ($name == 'com_users.user') {
             // Remove the field if it is disabled in registration and profile
             if ($this->params->get('register-require_' . $field, 1) == 0 && $this->params->get('profile-require_' . $field, 1) == 0) {
                 $form->removeField($field, 'profile');
             }
         } elseif ($name == 'com_users.registration') {
             // Toggle whether the field is required.
             if ($this->params->get('register-require_' . $field, 1) > 0) {
                 $form->setFieldAttribute($field, 'required', $this->params->get('register-require_' . $field) == 2 ? 'required' : '', 'profile');
             } else {
                 $form->removeField($field, 'profile');
             }
         } elseif ($name == 'com_users.profile' || $name == 'com_admin.profile') {
             // Toggle whether the field is required.
             if ($this->params->get('profile-require_' . $field, 1) > 0) {
                 $form->setFieldAttribute($field, 'required', $this->params->get('profile-require_' . $field) == 2 ? 'required' : '', 'profile');
             } else {
                 $form->removeField($field, 'profile');
             }
         }
     }
     return true;
 }
Пример #19
0
 /**
  * Called before a JForm is rendered. It can be used to modify the JForm object in memory before rendering.
  *
  * @param   JForm  $form  The form to be altered.
  * @param   array  $data  The associated data for the form.
  *
  * @return	boolean
  */
 public function onContentPrepareForm($form, $data)
 {
     if (!$form instanceof JForm) {
         $this->_subject->setError('JERROR_NOT_A_FORM');
         return false;
     }
     // Check we are manipulating a valid form.
     $name = $form->getName();
     if (strpos($name, 'com_redsource.edit.field.') !== 0) {
         return true;
     }
     // Add the extra fields to the form.
     $type = 'text';
     if ($type) {
         // Loading file may fail, but that's ok.
         JForm::addFormPath(__DIR__ . '/forms');
         $form->loadFile('rsfield_' . $type, false);
     }
     $form->removeField('translate_label');
     $form->removeField('translate_description');
     return true;
 }
Пример #20
0
 protected function preprocessForm(JForm $form, $data, $group = 'content')
 {
     if (!$form instanceof JForm) {
         $this->setError('JERROR_NOT_A_FORM');
         return false;
     }
     $app = JFactory::getApplication();
     $params = JComponentHelper::getParams('com_djcatalog2');
     $user = JFactory::getUser();
     $plugin = JFactory::getApplication()->getParams()->get('cart_order_captcha', JFactory::getConfig()->get('captcha'));
     if ($user->guest == false || ($plugin === 0 || $plugin === '0' || $plugin === '' || $plugin === null)) {
         $form->removeField('captcha', 'captcha');
     } else {
         $form->setFieldAttribute('captcha', 'plugin', $plugin, 'captcha');
     }
     $form->removeField('client_type', 'djcatalog2profile');
     $form->removeField('customer_group_id', 'djcatalog2profile');
     $fields = array('company', 'position', 'address', 'city', 'postcode', 'country_id', 'vat_id', 'phone', 'fax', 'www', 'customer_note');
     $group = 'djcatalog2profile';
     foreach ($fields as $field) {
         // in case config is broken - using defaults from XML file
         if ($params->get('cart_orderfield_' . $field, false) === false) {
             continue;
         }
         if ($params->get('cart_orderfield_' . $field, '0') == '0') {
             $form->removeField($field, $group);
         } else {
             if ($params->get('cart_orderfield_' . $field, '0') == '2') {
                 $form->setFieldAttribute($field, 'required', 'required', $group);
                 $form->setFieldAttribute($field, 'class', $form->getFieldAttribute($field, 'class') . ' required', $group);
             } else {
                 $form->setFieldAttribute($field, 'required', false, $group);
                 $class = $form->getFieldAttribute($field, 'class', '', $group);
                 $class = str_replace('required', '', $class);
                 $form->setFieldAttribute($field, 'class', $class, $group);
             }
         }
     }
 }
Пример #21
0
 /**
  * adds additional fields to the user editing form
  *
  * @param   JForm  $form  The form to be altered.
  * @param   mixed  $data  The associated data for the form.
  *
  * @return  boolean
  *
  * @since   1.6
  */
 public function onContentPrepareForm($form, $data)
 {
     $app = JFactory::getApplication();
     if (!$form instanceof JForm) {
         $this->_subject->setError('JERROR_NOT_A_FORM');
         return false;
     }
     // Check we are manipulating a valid form.
     $name = $form->getName();
     if (!in_array($name, array('com_admin.profile', 'com_users.user', 'com_users.profile', 'com_users.registration'))) {
         return true;
     }
     // Add the registration fields to the form.
     JForm::addFormPath(__DIR__ . '/sibdiets');
     $form->loadFile('sibdiet', false);
     if ($name == 'com_users.registration') {
         $form->setFieldAttribute('id', 'type', 'hidden', 'sibdiet');
         if ($agent = $app->input->get('agent', 0, 'INT')) {
             $form->setValue('created_by', 'sibdiet', $agent);
         }
     }
     // Permissions field will show just in joomla backend and only for super admins.
     if (!JFactory::getUser()->get('isRoot') || !$app->isAdmin()) {
         // We only want the Permissions in the backend just for super user
         $form->removeField('permissions', 'sibdiet');
         // We only want the Created by in the backend just for super user
         $form->setFieldAttribute('created_by', 'type', 'hidden', 'sibdiet');
     }
     // Fix File Number
     if (!empty($data->sibdiet['id'])) {
         $data->sibdiet['id'] += 200000;
     }
     return true;
 }
Пример #22
0
 function getInput()
 {
     $formRegistration = new JForm('com_users.registration');
     $formProfile = new JForm('com_users.registration');
     $plugin = JPluginHelper::getPlugin('user', 'profile');
     //load language com_user and plugin profile
     $language = JFactory::getLanguage();
     $language_tag = $language->getTag();
     JFactory::getLanguage()->load('lib_joomla', JPATH_SITE, $language_tag, true);
     JFactory::getLanguage()->load('com_users', JPATH_SITE, $language_tag, true);
     JFactory::getLanguage()->load('plg_user_profile', JPATH_ADMINISTRATOR, $language_tag, true);
     // Add the registration fields to the form.
     $formRegistration->loadFile(JPATH_ROOT . '/components/com_users/models/forms/registration.xml', false);
     // remove unused fiels of registrer form
     $formRegistration->removeField('captcha');
     $formRegistration->removeField('spacer');
     $formRegistration->removeField('password1');
     $formRegistration->removeField('password2');
     $formRegistration->removeField('email2');
     //setting  list box
     $class = $this->element['class'] ? (string) $this->element['class'] : '';
     $social = $this->element['social'] ? (string) $this->element['social'] : '';
     $html = '<ul class="profile-fields ' . $class . '" id="' . $this->id . '" version="' . JVERSION . '">';
     $options = array();
     switch ($social) {
         case 'facebook':
             $options[] = JHtml::_('select.option', '', JText::_('JNONE'));
             $options[] = JHtml::_('select.option', 'id', JText::_('ID'));
             $options[] = JHtml::_('select.option', 'name', 'Name');
             $options[] = JHtml::_('select.option', 'username', 'Username');
             $options[] = JHtml::_('select.option', 'email', 'Email');
             $options[] = JHtml::_('select.option', 'link', 'Profile link');
             //$options[] = JHtml::_('select.option', 'picture', 'Profile Picture');
             $options[] = JHtml::_('select.option', 'birthday', 'Date of birth');
             $options[] = JHtml::_('select.option', 'location', 'Location');
             $options[] = JHtml::_('select.option', 'hometown', 'Hometown');
             $options[] = JHtml::_('select.option', 'website', 'Website');
             $options[] = JHtml::_('select.option', 'bio', 'About me');
             $options[] = JHtml::_('select.option', 'quotes', 'Favorite Quotes');
             break;
         case 'google':
             $options[] = JHtml::_('select.option', '', JText::_('JNONE'));
             $options[] = JHtml::_('select.option', 'id', JText::_('ID'));
             $options[] = JHtml::_('select.option', 'name', 'Name');
             $options[] = JHtml::_('select.option', 'username', 'Username');
             $options[] = JHtml::_('select.option', 'email', 'Email');
             $options[] = JHtml::_('select.option', 'link', 'Profile link');
             //$options[] = JHtml::_('select.option', 'picture', 'Profile Picture');
             $options[] = JHtml::_('select.option', 'birthday', 'Date of birth');
             break;
         case 'twitter':
             $options[] = JHtml::_('select.option', '', JText::_('JNONE'));
             $options[] = JHtml::_('select.option', 'id', JText::_('ID'));
             $options[] = JHtml::_('select.option', 'name', 'Name');
             $options[] = JHtml::_('select.option', 'username', 'Screen Name');
             $options[] = JHtml::_('select.option', 'link', 'Profile link');
             //$options[] = JHtml::_('select.option', 'picture', 'Profile Picture');
             $options[] = JHtml::_('select.option', 'birthday', 'Date of birth');
             $options[] = JHtml::_('select.option', 'location', 'Location');
             $options[] = JHtml::_('select.option', 'website', 'Website');
             $options[] = JHtml::_('select.option', 'bio', 'Description');
             $options[] = JHtml::_('select.option', 'status', 'Status');
             break;
     }
     //add field from register form
     foreach ($formRegistration->getFieldsets() as $fieldset) {
         $fields = $formRegistration->getFieldset($fieldset->name);
         if (count($fields)) {
             foreach ($fields as $field) {
                 $html .= '<li class="control-group">' . $field->getLabel();
                 if ($field->fieldname == 'name') {
                     $html .= JHtml::_('select.genericlist', $options, '', 'class="name control-group"', 'value', 'text', 'name');
                 } elseif ($field->fieldname == 'username') {
                     $html .= JHtml::_('select.genericlist', $options, '', 'class="username control-group"', 'value', 'text', $social == 'google' ? 'email' : 'username');
                 } elseif ($field->fieldname == 'email1') {
                     $html .= JHtml::_('select.genericlist', $options, '', 'class="email1 control-group" disabled="disabled"', 'value', 'text', 'email');
                     if ($social == 'twitter') {
                         $html .= '<br /><span style="color:red;line-height:200%">The Twitter API does not provide the user\'s email address. So if you turn off "editing email" the twitter users will have email type: screen_name@twitter.com</span>';
                     }
                 }
             }
         }
     }
     //load fields of plugin profile
     if ($plugin != null) {
         $params = new JRegistry();
         $params->loadString($plugin->params);
         $formProfile->loadFile(JPATH_ROOT . '/plugins/user/profile/profiles/profile.xml', false);
         $fields = array('address1', 'address2', 'city', 'region', 'country', 'postal_code', 'website', 'favoritebook', 'aboutme', 'dob');
         //remove field unused
         $formProfile->removeField('tos', 'profile');
         //$formProfile->removeField('city','profile');
         //$formProfile->removeField('region','profile');
         //$formProfile->removeField('country','profile');
         $formProfile->removeField('postal_code', 'profile');
         $formProfile->removeField('favoritebook', 'profile');
         $formProfile->removeField('phone', 'profile');
         //remove field disable in profile form
         foreach ($fields as $field) {
             if ($params->get('register-require_' . $field, 1) > 0) {
                 $formProfile->setFieldAttribute($field, 'required', $params->get('register-require_' . $field) == 2 ? 'required' : '', 'profile');
             } else {
                 $formProfile->removeField($field, 'profile');
             }
         }
         foreach ($formProfile->getFieldsets() as $fieldset) {
             $fields = $formProfile->getFieldset($fieldset->name);
             if (count($fields)) {
                 $html .= '<li class="control-group"><h3 class="enable_profile_1">Profile plugin:</h3></li>';
                 foreach ($fields as $field) {
                     $html .= '<li class="control-group">' . $field->getLabel();
                     if ($field->fieldname == 'address1') {
                         $html .= JHtml::_('select.genericlist', $options, '', 'class="profile_address1 enable_profile_1"', 'value', 'text', 'location');
                     } elseif ($field->fieldname == 'address2') {
                         $html .= JHtml::_('select.genericlist', $options, '', 'class="profile_address2 enable_profile_1"', 'value', 'text', '');
                     } elseif ($field->fieldname == 'city') {
                         $html .= JHtml::_('select.genericlist', $options, '', 'class="profile_city enable_profile_1"', 'value', 'text', 'hometown');
                     } elseif ($field->fieldname == 'region') {
                         $html .= JHtml::_('select.genericlist', $options, '', 'class="profile_region enable_profile_1"', 'value', 'text', '');
                     } elseif ($field->fieldname == 'country') {
                         $html .= JHtml::_('select.genericlist', $options, '', 'class="profile_country enable_profile_1"', 'value', 'text', '');
                     } elseif ($field->fieldname == 'website') {
                         $html .= JHtml::_('select.genericlist', $options, '', 'class="profile_website enable_profile_1"', 'value', 'text', 'website');
                     } elseif ($field->fieldname == 'aboutme') {
                         $html .= JHtml::_('select.genericlist', $options, '', 'class="profile_aboutme enable_profile_1"', 'value', 'text', 'bio');
                     } elseif ($field->fieldname == 'dob') {
                         $html .= JHtml::_('select.genericlist', $options, '', 'class="profile_dob enable_profile_1"', 'value', 'text', 'birthday');
                     }
                 }
             }
         }
     }
     $html .= "</ul>";
     $html .= '<input class="socialinput" type="hidden" name="' . $this->name . '" value="' . $this->value . '" />';
     return $html;
 }