CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • Facebook and Twitter icons on CiviMail
Pages: [1]

Author Topic: Facebook and Twitter icons on CiviMail  (Read 4382 times)

LoganBear

  • I post occasionally
  • **
  • Posts: 44
  • Karma: 1
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
  • MySQL version: 5.1.67
  • PHP version: 5.3.28
Facebook and Twitter icons on CiviMail
June 11, 2013, 07:49:08 pm
I'm sure that people have accomplished this, but I've been bashing my head against the wall.  For example, I used:
Code: [Select]
<a href="https://www.facebook.com/sharer/sharer.php?u={mailing.viewUrl}" target="_blank">
<img alt="Facebook" src="location/to/facebook/icon" /></a>
but, since the parameters of mailing.viewUrl are ?reset=1&id=##, Facebook reads only the reset and loses the id #.

And, for Twitter, when I use
Code: [Select]
<a href="http://twitter.com/share?text=Main%20Subject%20&url={mailing.viewURL"><img alt="Twitter" src="location/to/the/twitter.gif" /></a>the editor replaces & with &amp; and it's ignored by Twitter.

Has anyone gotten these two buttons to work?

friendswoodtech

  • I’m new here
  • *
  • Posts: 28
  • Karma: 1
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7
  • MySQL version: 5.1.56
  • PHP version: 5.3.6
Re: Facebook and Twitter icons on CiviMail
August 13, 2013, 01:42:43 pm
The only way I figured out how to make it work is to not use tokens and manually input the address of the newsletter, replacing the & with %26.  Honestly, this is just something that I started digging into.  Would love to figure out how to use the permalink token and have the & automatically replaced with %26.

friendswoodtech

  • I’m new here
  • *
  • Posts: 28
  • Karma: 1
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7
  • MySQL version: 5.1.56
  • PHP version: 5.3.6
Re: Facebook and Twitter icons on CiviMail
August 14, 2013, 04:35:30 am
Short-term solution for me is a hack (working through creating a custom token vs. hacking civicrm core), but what I found to work is to create a new token called {mailing.viewUrlSS} (or whatever you want it to be), identifying it in CRM/Utils/Token.php  and adding the following:
Code: [Select]
      case 'viewUrlSS':
        $value = CRM_Utils_System::url('civicrm/mailing/view',
          "reset=1%26id={$mailing->id}",
          TRUE, NULL, FALSE, TRUE
        );
        break;

This allows me to use {mailing.viewUrl} for my permalink and this additional token for social sharing.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • Facebook and Twitter icons on CiviMail

This forum was archived on 2017-11-26.