public function populateUserData($obj, $user_id) { // joomla fills the info $obj = parent::populateUserData($obj, $user_id); //populate jomsocial require_once JPATH_BASE . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php'; $pModel = CFactory::getModel('profile'); $profile = $pModel->getEditableProfile($this->activationUserID); $fields = $profile['fields']; //$obj->jomsocial = array(); foreach ($fields as $name => $fieldGroup) { foreach ($fieldGroup as $field) { $name = $field['name']; if ($field['fieldcode'] == 'XIPT_PROFILETYPE') { require_once JPATH_BASE . DS . 'components' . DS . 'com_xipt' . DS . 'api.xipt.php'; $profiletypeName = XiptAPI::getUserProfiletype($user_id, 'name'); $obj['profile'][$name] = $profiletypeName; continue; } $fieldId = $pModel->getFieldId($field['fieldcode']); $query = 'SELECT value FROM #__community_fields_values' . ' ' . 'WHERE `field_id`=' . $this->db->Quote($fieldId) . ' ' . 'AND `user_id`=' . $this->db->Quote($user_id); $result = $this->db->setQuery($query)->loadresult(); if (!empty($result)) { $obj['profile'][$name] = $result; } } } return $obj; }
function _extendUsers($usersdata) { foreach ($usersdata as $k => $v) { $usersdata[$k]['jspt'] = XiptAPI::getUserProfiletype($v['id']); $usersdata[$k]['jsptname'] = XiptAPI::getUserProfiletype($v['id'], 'name'); } return $usersdata; }
public function isApprovalRequired($user_id) { $file = JPATH_BASE . DS . 'components' . DS . 'com_xipt' . DS . 'api.xipt.php'; if (JFile::exists($file) && (include_once $file)) { $pID = XiptAPI::getUserProfiletype($user_id); // TODO : what to do for $pId =0 $allCondition = array(); $allCondition = XiptAPI::getProfiletypeInfo($pID); // if admin approval NOT required, then do nothing let the joomla handle if ($allCondition && $pID) { return $allCondition[0]->approve; } } return false; }
function displayModules($userId, $params, $attribs = array()) { // if no user id return blank if (empty($userId) || $userId == '0' || $userId == 0) { return ""; } //get profiletype id of user require_once JPATH_BASE . DS . 'components' . DS . 'com_xipt' . DS . 'api.xipt.php'; $pID = XiptAPI::getUserProfiletype($userId); //get module params $modId = $params->get('ximodule'); $modPt = $params->get('xiprofiletypes'); $module = self::getModule($modId); //custom module name is given by the title field $file = $module->module; $custom = substr($file, 0, 4) == 'mod_' ? 0 : 1; $module->user = $custom; $module->name = $custom ? $module->title : substr($file, 4); //check profiletype in module params, if its not an array, convert it if (!is_array($modPt)) { $modPt = array($modPt); } //check user Pid exists in module params or not if (!in_array($pID, $modPt)) { return; } // If style attributes are not given or set, // we enforce it to use the xhtml style // so the title will display correctly. if (!isset($attribs['style'])) { $attribs['style'] = 'xhtml'; } $contents = ''; $document = JFactory::getDocument(); $renderer = $document->loadRenderer('module'); $contents .= $renderer->render($module, $attribs); return $contents; }