dave thanks so much for your reply. I am working on my own plugin.
Basically I would like to output user question:
relationship and
match_sex.
I use this:
BOL_QuestionService::getInstance()->getQuestionValueLang('relationship', $question['relationship']) . ', ';
$question['relationship'] contains user
relationship or
match_sex ID
Now the problem is that it doesn't output when user has selected more than one option in profile question. It only outputs one!
Please teach me how to fetch or out put
elationship or
match_sex that will show all results.
My code:
[php]class TEST_UserList extends BASE_CMP_Users
{
public function __construct( array $list, $itemCount, $usersOnPage, $showOnline = true)
{
parent::__construct($list, $itemCount, $usersOnPage, $showOnline);
}
public function getFields( $userIdList )
{
$fields = array();
$qs = array();
$qBdate = BOL_QuestionService::getInstance()->findQuestionByName('birthdate');
if ( $qBdate !== null && $qBdate->onView )
$qs[] = 'birthdate';
$qSex = BOL_QuestionService::getInstance()->findQuestionByName('sex');
if ( $qSex !== null && $qSex->onView )
$qs[] = 'sex';
//working
$a = BOL_QuestionService::getInstance()->findQuestionByName('relationship');
if ( $a !== null && $a->onView )
$qs[] = 'relationship';
$questionList = BOL_QuestionService::getInstance()->getQuestionData($userIdList, $qs);
foreach ( $questionList as $uid => $question )
{
$fields[$uid] = array();
$age = '';
$locationvalue = "<div>".$question['address']."</div>";
if ( !empty($question['birthdate']) )
{
$date = UTIL_DateTime::parseDate($question['birthdate'], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
$age = UTIL_DateTime::getAge($date['year'], $date['month'], $date['day']);
}
$sexValue = '';
if ( !empty($question['sex']) )
{
$sex = $question['sex'];
for ( $i = 0; $i < 31; $i++ )
{
$val = pow(2, $i);
if ( (int) $sex & $val )
{
$sexValue .= BOL_QuestionService::getInstance()->getQuestionValueLang('sex', $val) . ', ';
}
}
if ( !empty($sexValue) )
{
$sexValue = substr($sexValue, 0, -2);
}
}
//working
$test = BOL_QuestionService::getInstance()->getQuestionValueLang('relationship', $question['relationship']) . ', ';
if ( !empty($sexValue) && !empty($age) )
{
$fields[$uid][] = array(
'label' => '',
'value' => $sexValue . ' ' . $age .' '.$locationvalue.' '.$test
);
}
}
return $fields;
}
}
[/php]