Hello, basically this is a request for a step by step process on how to add variables to the Author Pane
Specifically I am trying add the user's Role displayed after the $account_name and before the $picture so that it gets shown in the forum. I realize that this might be simple for the pros but I am pretty clueless on how to get variables from core and contribute modules. I see that there are some indications about the process but still unclear. It would be nice to have 2 examples.

1. getting the Role of the user in the pane
2. getting the date of birth of the user which is found in custom date field placed in a secondary profile named "personal info" this profile was created using the Profile2 module.

Having these two examples will help me understand they logic used to access variables. Hope my request is clear.

Cheers.

Comments

Drunoober’s picture

Issue summary: View changes

correction... profile was created using the Profile2 module

Scyther’s picture

Drunoober’s picture

Hi thank you!! it worked however, there is a little issue that still needs to be addressed.
The issue is that all non anonymous users are Authenticated users if they have any other role assigned I would like the authenticated role text hidden unless that is the only role the user has assigned. Hope I was clear.

For the Profile2 case you linked me to a solution for a Fields module issue but not fields from the Profile module which is what I actually need. (I could have misunderstood your post so correct me if I am wrong)

Since you have been so kind I would like to ask you one more thing... if I want to change the date formatting of how $joined is displayed right now I have a date and a time in short format but I would like to have just the date in the following format: 30 May 2012.

thank you very much for your time.

Scyther’s picture

I missed that you used Profile2 in the #2. I do not know how to do that right now. But I will try to find out if it get some time for that.

This should work to not displaying the 'authenticated user' role. There might be a better PHP function to do this.
Don't know how it works in translated sites!

<div class="author-pane-line author-roles">
  <?php
    $roles = $account->roles;
    if ($key = array_search('authenticated user', $roles)) {
      unset($roles[$key]);
    }
    print implode(', ', $roles);
  ?>
</div>

If you using a Block to display the author pane, you have a settings for that block, "Join date, date type". There you can choose which date type. But first you might have to create a new one at /admin/config/regional/date-time and a format with d F Y

Drunoober’s picture

ok your script worked perfectly!!! Thank you.

For the profile issue take your time I am in no rush to know how to do it.

For the Date issue I am talking about advanced_forum not a block so I assume I need to hard code the wanted format into the
advanced-forum.naked.author-pane.tpl.php file If I am correct in my assumption how would I do it?

Thanks a bunch!

Drunoober’s picture

Issue summary: View changes

XD