When a list is referenced in a tweet (e.g., @sds52/political), only the twitter user ID is linked. The link should extend from the @ to the last character that's legal in a twitter list name.

Comments

toleillo’s picture

To allow list names in twitter.module we need change twitter_link_filter function and maybe allow open links in a new tab. We should discuss about if this is the best way to do it!

/**
 * This helper function converts Twitter-style @usernames and #hashtags into 
 * actual links.
 */
function twitter_link_filter($text, $prefix = '@', $destination = 'http://twitter.com/') {
  $matches = array(
    '/\>' . $prefix . '([a-z0-9\/_]+)/i',
    '/^' . $prefix . '([a-z0-9_]\/+)/i',
    '/(\s+)' . $prefix . '([a-z0-9\/_]+)/i',
  );
  $replacements = array(
    '><a href="' . $destination . '${1}" target="_blank">' . $prefix . '${1}</a>',
    '<a href="' . $destination . '${1}" target="_blank">' . $prefix . '${1}</a>',
    '${1}<a href="' . $destination . '${2}" target="_blank">' . $prefix . '${2}</a>',
  );
  return preg_replace($matches, $replacements, $text); 
}
davidneedham’s picture

Category: bug » feature

This is not currently available, but would make a wonderful new feature + patch.

dddave’s picture

Version: 6.x-3.x-dev » 7.x-6.x-dev
dddave’s picture

Version: 7.x-6.x-dev » 6.x-5.x-dev
damienmckenna’s picture

Version: 6.x-5.x-dev » 7.x-6.x-dev
Issue summary: View changes
damienmckenna’s picture

Component: Code » Text filters