I'm trying to figure out how to list the authors roles in the user-info section of each forum post and reply. So for forum admins, it should display 'Admin'. Also, i'd rather not display the default 'authenticated user' role.

Does anyone have a solution for this?

Comments

michelle’s picture

This is off the top of my head and untested. Try this in advf-forum-user.tpl.php:

foreach ($account->roles as $role) {
  if ($role != 'authenticated user') {
    print $role;
  }
}

Going offline for a while now.

Michelle

dbirider’s picture

Status: Active » Fixed

Thanks Michelle, that worked perfect :-D

zet’s picture

It works but outputs an error:

* warning: Invalid argument supplied for foreach() in /var/www/html/drupal5/sites/all/themes/zen/zen_zetnetpd/advforum/advf-forum-user.tpl.php on line 52.
* warning: Invalid argument supplied for foreach() in /var/www/html/drupal5/sites/all/themes/zen/zen_zetnetpd/advforum/advf-forum-user.tpl.php on line 52.

zet’s picture

Status: Fixed » Active
Soggydoughnuts’s picture

Is there any way to do this for 6.X?

-Donuts

michelle’s picture

Status: Active » Fixed

As far as I know, it's the same for D6. If it's not, investigate the changelog for D6 to see what affected it. This really has nothing to do with the module and I don't have more time to invest in it.

Michelle

psicomante’s picture

Thanks to Themer Info (Devel Module)

Take this

foreach ($accountid->roles as $role) {
  if ($role != 'authenticated user') {
    print $role;
  }
}

PS. We need a Bueditor here on d.org. :D

psicomante’s picture

i hope Michelle would integrate this as option on official release. It's useful.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

rafaeldwan’s picture

how could I do this for all content, not just forums? where would I stick the snip?

zet’s picture

Good question. Not very apropiate posted here, but hope someone knows the answer.