Hi all,

I have searched these forums for a better part of a day, but I cannot find a solution for this.

I'm trying to make links within the 'author pane' module look like buttons via css. This has worked great so far as every link (Send PM, etc) has the anchor text wrapped in 'span' tags like so:

<a href="/messages/new/20" class="author-pane-link" title="Send Andreas a private message"><span>Send PM</span></a>

However, the 'Email' link doesn't have the span attribute wrapping the anchor text.
I have found this pre-process within the author pane module files. I'm trying to figure out how to add the attribute via here. I don't want to modify my template file, as I'm sure it can be done within the module files.

The code in the module pre-process is:
The: array('attributes' => array('class' => array('author-pane-link')))); is also required, as it gives the link a css class.

/**
 * Implements hook_preprocess_author_pane().
 *
 * @see _contact_personal_tab_acces()
 */
function contact_preprocess_author_pane(&$variables) {
  // Check if this preprocess needs to be run given who's calling it.
  if (!author_pane_run_preprocess('contact', $variables['caller'])) {
    return;
  }

  if (_contact_personal_tab_access($variables['account'])) {
    $variables['contact'] = l(t('Email'), 'user/' . $variables['account']->uid . '/contact', array('attributes' => array('class' => array('author-pane-link'))));
  }
}

/**
 * Implements hook_author_pane_allow_preprocess_disable().
 */
function contact_author_pane_allow_preprocess_disable() {
  return array('contact' => 'Contact');
}

I have tried to add a second line, add to the existing line etc. My php skill level is still shocking at best, but I'm learning as I go.

Any wisdom would be greatly appreciated. :)

Comments

AusJohn’s picture

I figured it out thanks to a simular pre-process in the private message module.
I kept the privatemsg_recipient_format to simply have a title associated like on the PM link. I will change that call if I have to ever disable private message. It's probably dirty but it works splendidly.

function contact_preprocess_author_pane(&$variables) {
  // Check if this preprocess needs to be run given who's calling it. 
  // WARNING(For updating, this script is modified to add a span wrap to anchor text and title. Check changes before updating this module.)
  global $user;
  $account = $variables['account'];
  if (!author_pane_run_preprocess('contact', $variables['caller'])) {
    return;
  }

  if (_contact_personal_tab_access($variables['account'])) {
	$variables['contact'] = l('<span>' . t('Email') . '</span>', 'user/' . $variables['account']->uid . '/contact', array('attributes' => array('class' => array('author-pane-link'), 'title' => t('Send @name an Email', array('@name' => privatemsg_recipient_format($account, array('plain' => TRUE))))), 'html' => TRUE));
  }
}