Hi,
This is now solved.
I've got a dynamic select field repeated with field X to select several authors.
In my custom template I use this code to fetch the ID's of the other authors and to grab more another value from the database:
$test_coauthor = $cck->get('nyheter_fx_coauthors')->value;
$test_coauthor2 = $test_coauthor[0]->value;
if(!empty($test_coauthor2)) {
foreach($cck->get('nyheter_fx_coauthors')->value as $gx) {
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('bruker_profilbilde');
$query->from($db->quoteName('#__cck_store_form_brukere'));
$query->where($db->quoteName('id')." = ".$db->quote($gx->value));
$db->setQuery($query);
$result = $db->loadResult();
echo '<img src="'.$result.'" class="img-circle img-responsive profilbilde">';
echo '<p class="text-center">'.$gx->text.'</p>';
}
}
<br>
This gives me their name (gx->text) and the id (gx->id) which I use in the query to feth the URL to the profile picture. Works like a charm.
You can see it in the article at http://drm24.no/nyheter/fargerik-folkefest-pa-fjell where two authors are selected.