There seems to be some incompatibility between the Add To Any module and the Page Title module.

When you try to use the Add To Any module to post a page on Facebook, or even to send a page as an email, the title that appears shows the Page Title tokens instead of their actual values.

CommentFileSizeAuthor
#3 AddToAny_Settings.png109.53 KBgregarios
#3 PageTitles_Settings.png161.14 KBgregarios

Comments

gregarios’s picture

Page Title module has an issue submitted for this too: http://drupal.org/node/651864
Maybe you guys can figure out who's module is at fault...

micropat’s picture

Hmm... I was not able to reproduce. If you could provide some details, how exactly do you have both modules setup?

gregarios’s picture

StatusFileSize
new161.14 KB
new109.53 KB

It seems to only happen when Taxonomy term pages are being viewed. Attached are screenshots of my settings.

siddhen’s picture

I have seen this issue when I add the AddtoAny block in the sidebar.
It works fine for nodes pages but for views pages the title that appears shows the Page Title tokens.

nicholasthompson’s picture

Status: Active » Needs review

The bug is in this module.

  if (is_object($node)) {
    $link_name  = rawurlencode($node->title);
  $link_url   = rawurlencode(url('node/'. $node->nid, array('absolute' => 1) ));
  } else { // Front page
  $link_name  = rawurlencode(variable_get('page_title_front', variable_get('site_name', '')));
    $link_url = rawurlencode(url('<front>', array('absolute' => 1)));
  }

So.. What if there is no $node? If you're on anything other than a node page, it falls back to the frontpage title (rather than the current page title). Not only that - it assumes Page Title is installed :)

My advice is for the $link_name either solely use drupal_get_title or (my preferred method)..

if (module_exists('page_title')) {
  $link_name = page_title_page_get_title();
}
else {
  $link_name = drupal_get_title();
}

This will use Page Title (if present) and therefore any overridden page titles and token patterns, falling back to drupal's core get title function if Page Title is not present. Hopefully this should work for you.

micropat’s picture

Assigned: Unassigned » micropat
micropat’s picture

Assigned: micropat » Unassigned
Status: Needs review » Fixed

Fixed in 3.0

dewolfe001’s picture

Status: Fixed » Needs work

On this page, http://sandbox.game-boyz.com/content/node/12818, when I had AddToAny active as well as CCK and the Page Title modules, there was a bad interaction.
As the theming iterated through the content fields, the $page variable gets reset. For page views, it begins as TRUE, then the call to get the $link_name for the AddToAny gets called. After this point, $page is not set to TRUE. After that, all of the display fields that are not set to display on teaser views will not display.
In looking through Page Title, I couldn't see where this was being reset.
My workaround was to kludge together similar functionality from AddtoAny widget and implant that directly in the theming output where I wanted it to appear and not use the AddToAny module.

		$link_name = $node->title;
		$link_url 	= url('node/' . $node->nid, array('absolute' => 1));				

		$addany = '<!-- AddToAny BEGIN --><a class="a2a_dd" href="http://www.addtoany.com/share_save?';
		$addany .= "linkurl=".urlencode($link_url);
		$addany .= "&amp;linkname=".urlencode($link_name);
		$addany .= '"><img src="http://static.addtoany.com/buttons/share_save_171_16.png" width="171" height="16" border="0" alt="Share/Bookmark"/></a>'."\n";
		$addany .= '<script type="text/javascript">'."\n";
		$addany .= 'var a2a_config = a2a_config || {};'."\n";
		$addany .= 'a2a_config.linkname = "'.$link_name.'";'."\n";
		$addany .= 'a2a_config.linkurl = "'.$link_url.'";'."\n";
		$addany .= 'a2a_config.onclick = 1;'."\n";
		$addany .= 'a2a_config.show_title = 1;'."\n";
		$addany .= 'a2a_config.num_services = 20;'."\n";
		$addany .= '</script>'."\n";
		$addany .= '<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>'."\n";
		$addany .= '<!-- AddToAny END -->';

		print $addany;
mcrittenden’s picture

Status: Needs work » Fixed

Please open a separate issue for #8.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.