In Panels 3, when creating a new page, one can let tge page title be generated automatically by tokens. Two available tokens are:
(1) %user:realname,
(2) %user:realname-link

Unfortunately, (1) generates nothing but an empty string; (2) generates the correct realname yet wrapped in a link which I do not need.

Comments

spikeerob’s picture

I am having the same problem. Seems like something is affecting the token called 'realname' after it has been set but not affecting differently named tokens. As a workaround creating a new token with a different name seems to work.

I put a slightly modified version of token_realname.inc into a custom module and used the new token it created instead:

function realname_fix_token_list($type = 'all') {
  $tokens = array();
  switch ($type) {
    case 'user':
      $tokens[$type]['realname-fixed'] = t('The fixed RealName for the user.');
      return $tokens;
  }
}

function realname_fix_token_values($type, $object = NULL, $options = array()) {
  global $user;
  $tokens = array();
  if (!$object) {
    $object = $user;
  }
  switch ($type) {
    case 'user':
      if (!isset($object->uid)) {
        return;
      }
      $tokens['realname-fixed'] = realname_make_name($object);
      return $tokens;
      
  }
}

Hope that helps someone. :)

wxman’s picture

Thank You! You definitely helped me, and saved me from pulling more hair out.
I have it working now with Panels in the APK.

mckeen_greg’s picture

You should rather use: realname-node-author

switch ($type) {
    case 'user':
    case 'node':
      // If there's a nid, then create a token with the realname of
      // author of the node.
      if($object->nid && $object->uid) {
        $tokens['realname-node-author'] = db_result(db_query("SELECT realname FROM {realname} WHERE uid = %d", $object->uid));
      }
hass’s picture

Issue summary: View changes
Status: Active » Closed (outdated)
nwom’s picture

Version: 6.x-1.3 » 7.x-1.x-dev
Component: Tokens » Code
Status: Closed (outdated) » Active

This also occurs on D7. If you add the field to a pane, it will always show up with the label and as a link. Disabling the link and hiding the label is not possible.