4
I have successfully integrated smartprofiles and yogurt social networking together. This is how I did it:
1. Add the following code to yogurt/index.php:
$gperm_handler = & xoops_gethandler( 'groupperm' );
$groups = is_object($xoopsUser) ? $thisUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS);
// Dynamic User Profiles
$thisUsergroups =& $thisUser->getGroups();
$fieldids = xoops_getmodulehandler('visibility','smartprofile')->getVisibleFields($groups, $thisUsergroups);
$profile_handler =& xoops_getmodulehandler('profile','smartprofile');
$fields =& $profile_handler->loadFields();
$profile = $profile_handler->get($thisUser->getVar('uid'));
// Add dynamic fields
foreach (array_keys($fields) as $i) {
//If field should be shown
if (in_array($fields[$i]->getVar('fieldid'), $fieldids)) {
//echo "VAL0:".$value."
";
$value = $fields[$i]->getOutputValue($thisUser, $profile);
if (is_array($value)) {
$value = implode('
', array_values($value));
}
if($value){
$fieldattr=array('title' => $fields[$i]->getVar('field_title'), 'value' => $value);
$fieldname=$fields[$i]->getVar('field_name');
$xoopsTpl->assign($fieldname, $fieldattr);
}
}
}
2. Edit the following code in /class/field.php like so:
function getUserVars() {
return xoops_getmodulehandler('profile','smartprofile')->getUserVars();
}
3. Now you can refer to smartprofile vars in your yogurt social networking index template like so:
<{$user_book.value}>
<{$.value}> e.g. <{$user_ICQ.value}>