I've got a tricky problem that I'm trying to work out and I'm not sure how to proceed.
I'm using the profile, usernode, and views modules. In the end, I'd like to create a view that shows all users with links to each's profile page.
I've set up a couple of profile fields: profile_firstname and profile_lastname. I'd like the view to show the user's name in the format:
profile_lastname, profile_firstname
plus, I'd like the whole thing to be a link to the user's profile page. It is important that I keep the profile_firstname and profile_lastname fields separate. Here's what I have so far in the views_profile.inc file:
//----- from profile_views_add_field
...snip...
if ($field->name == 'profile_lastname') {
$help = t('FGBC Custom profile last, first name field.');
$others = array(
'sortable' => true,
'handler' => array(
'views_handler_field_profile_default' => t('normal text'),
'views_handler_field_profile_link' => t('themed userlink'),
),
'uid' => 'uid',
'addlfields' => array('uid'),
);
}
...snip...
function views_handler_field_profile_link($fieldinfo, $fielddata, $value, $data) {
if ($value) {
$obj->name = $value;
$uidfield = $fielddata['tablename'] . "_" . $fieldinfo['uid'];
$obj->uid = $data->$uidfield;