Any module or theme can add to the variables available in the Author Pane template file by use of a preprocess function.

The function looks generally like this:

/**
 * Implementation of hook_preprocess_author_pane().
 */
function MODULEORTHEMENAME_preprocess_author_pane(&$variables) {
  // Add your variable(s) like this:
  $variables['MODULEORTHEMENAME_VARIABLENAME'] = MODULEORTHEMENAME_FUNCTION($variables['account']);
}

These variables are available to you:

  • $variables['account']: The full user object for the "author".
  • $variables['caller']: (optional) This is an ID passed in when the theme function is called that allows code in the preprocess to know who is using Author Pane. This is useful if you want to make some changes to Author Pane in one area and not in others.
  • $variables['picture_preset']: (optional) This is an imagecache preset that is passed in and will be passed on the the function that themes the user picture.
  • $variables['context']: (optional) This is usually a node or comment object and gives the context of where the Author Pane has been placed so information from that context is available to the template and preprocesses.
  • $variables['disable_css']: (optional) This option tells Author Pane not to load its CSS so it uses the CSS of the caller. It is used internally by Author Pane and not likely to be of use when preprocessing but is included here for completeness.

You can define whatever variables you like in this preprocess, but, if you are adding them in a contributed module, please keep them simple and compact as they will be used by people who may not be themers to customize their forums / profiles. You should use your module's name in the variable to avoid namespace issues. Also be aware of performance issues as this function may be called many times on a single page.

If using a module, you can include this function directly in your module code or put it in its own file named MODULENAME.author-pane.inc and drop it in the root of your module directory. Files that follow that naming pattern will be auto discovered by Author Pane. It's mostly a matter of personal preference, though there may be some benefit to putting it in the .inc as it will only be loaded if the site has Author Pane enabled.

If you are adding this preprocess to a contributed module, please file an issue with the variable name(s) you are providing so they can be documented in the Author Pane template files.

If you are doing the preprocessing in your theme, you can just put it in template.php.