Took me a little while to work out, but here's how to do it. Add this to your template_preprocess_node function in your template. If anyone has a better or faster way of doing please do let me know. At the moment I am loading in the entire term just to get the name and url.

// We load in the term of node author
$nodeprofile = profile2_load_by_user($variables['uid']);
//Change field name here to be the name of your field. In this example we load in the URL and term name.
$termer = taxonomy_term_load($nodeprofile['main']->field_member_associate['und'][0]['tid']);
// Put the author string together.
$variables['author'] = t('Posted by !username from !org', array('!username' => $variables['name'],'!org' => l(t($termer->name), 'taxonomy/term/' . $termer->tid)));

Then in your theme print the whole thing out with:

print $author;

At the moment I get a ton of notice warnings, but it works.

Comments

joachim’s picture

Interesting example, thanks for sharing it! Though I don't really understand what you're doing with taxonomy here -- how does that relate to users?

cnolle’s picture

I've set my users up to be grouped using profile2 and taxonomy. Probably not the best way or creating groups of users - but seems to work without adding the complexity of organic groups.

faqing’s picture

Status: Active » Closed (fixed)
faqing’s picture