Email Social Share Button

Hi

I was just checking over my site last night and noticed that the email social share button no longer sends the link for the page in the triggered email and only has the page name in the email title.

Could yo offer any advice or a fix please. I have provided more details in a secure note

Hi There,

Thanks for writing in! Upon testing, I see script conflicts on your page. Could you please try disabling 3rd party plugins first and see if you can isolate the issue.

Let us know how it goes.
Thanks!

Hi I have disabled all there plugins and the issue was still present. I thought this may be the case as it has always worked and I’ve not added any new plugins recently.

Any support would be appreciated

Tim

Hi There,

Your email share is working fine on my end.

Please clean your browser cache and test it again.

If you are still facing issues after that, please provide which browser and device you are using while experiecing the issue.

Thank you

Hi It is not working on my iPhone or my iMac and it used to work fine. I cleared the cache and its still the same

HI there,

Another support here and it’s working as well on my end. Perhaps it’s blocked by your device? The email sharing will use the email app installed in your device, if there is no email app then it will not work.

Example, on my PC I have Outlook, if I click it it will then trigger Outlook so I could send it through email. Some setup uses Gmail, I tried it before and it opens my Gmail account but I don’t remember how I set it up before.

Please check your devices if it’s allowed to do that :slight_smile:

Thanks!

It’s always worked and has stopped working no settings have changes and its on several devices ? the email opens but it doesn’t include the link have you checked the link is in the email ??

Hi there,

Yes, it does have the link. Plus,below is the code of that sharing icon

It’s the same code from old and new versions and as you can see, the link is there.

Thanks!

Hi so if the code is there why has it suddenly stopped working on my apple devices ? the settings haven’t changed ?

Hi,

Please note that you need to double click it in mobile.

The first click serves as a hover and the second will follow the link.

For more information you may refer to the link below.

Thanks

Hi

It’s not just mobile its on my computers too and it was working fine until recently and no changes have been made so can you please help me to resolve this issue ?

Hi there,

I am another staff and unfortunately, I could not find the culprit either. One thing I see is that you used the Text Element to add the Share shortcode:

Would you please kindly use the Social Share element in Cornerstone instead?

See if it makes any difference.

Thank you.

Hi I have changed to the social share element on https://www.elasticlounge.com/our-acts/wedding-jazz-band-cornwall-johanna-graham

Unfortunately this has made no difference. I feel like I have been around the houses with this and asked the same questions alot. The ticket has been open for nearly 2 weeks now and no where close to finding a resolution.

Like I said the social share button for email opens up an email but it does not include the link of the page in it. This function worked fine since I put it on every page about 5 months ago. Now suddenly it has stopped working correctly on all pages. It does not work on my iPhone, iMac or laptop. Surely someone can look into this and find a solution its seems like a pretty basic function for the theme.

Thanks Tim

Hi there,

Sometimes it works, but mostly works on my end. I’ll continue check.

Thanks!

Hi Rad

Sorry but thats not really a solution sometimes it works at my end" I first contacted support 2 weeks ago and its not working on any of my devices at my end and it was. I would appreciate you looking into it further if possible.

Thanks

Tim

Hi there,

Yes, which is why I said I’ll continue checking :slight_smile:

But still, it works okay on my end. I’ll keep on checking and will let you know if I find something. The sharing through email is just a sample code executed by the device (there is no special coding).

<a href="mailto:?subject=Johanna%20Graham&amp;#038;body=Hey,%20thought%20you%20might%20enjoy%20this!%20Check%20it%20out%20when%20you%20have%20a%20chance:%20https://www.elasticlounge.com/our-acts/wedding-jazz-band-cornwall-johanna-graham" data-x-element="extra" data-x-params="{&quot;type&quot;:&quot;tooltip&quot;,&quot;trigger&quot;:&quot;hover&quot;,&quot;placement&quot;:&quot;bottom&quot;,&quot;title&quot;:&quot;&quot;,&quot;content&quot;:&quot;&quot;}" class="x-share email" title="" data-original-title="Share via Email"><span><i class="x-icon-envelope-square" data-x-icon=""></i></span></a>

That’s just that, especially this mailto:?subject=Johanna%20Graham&amp;#038;body=Hey,%20thought%20you%20might%20enjoy%20this!%20Check%20it%20out%20when%20you%20have%20a%20chance:%20https://www.elasticlounge.com/our-acts/wedding-jazz-band-cornwall-johanna-graham, the other aspect of that code is just for design.

And it’s based on common standard https://msdn.microsoft.com/en-us/library/aa767737(v=vs.85).aspx

Again, I’ll continue checking, as of now, I’m running out the devices as it works in my previous tests.

Thanks!

I am not sure why its working on your end as I have said its not working on any of my devices or my partners devices and I have had the button checked by 3 friends too and it is not including the link of the page in the shared email so I am to quite sure why your getting her link. Thank you I would appreciate this function to be working and as I have said repeatedly it used to work fine.

Hi there,

Can’t find anything on my end, though I think it’s related to HTML entities from the supplied information in the URL. Would you mind providing your FTP login credentials as well? I’ll try changing how the HTML entities are being passed.

Thanks!

The credentials are below in secure note

Hi there,

Yes, it’s due to HTML entities in the URL, I went ahead and added a temporary fix. I also forward this as a bug.

This is the temporary fix that I added to your child theme’s functions.php

add_action('init', 'fix_mail_share', 999999999999);
 
 function fix_mail_share () {
  remove_shortcode( 'x_share' );
remove_shortcode( 'cs_share' );
remove_shortcode( 'share' );

 add_shortcode( 'x_share', 'x_shortcode_share_v2' );
 add_shortcode( 'cs_share', 'x_shortcode_share_v2' );
  add_shortcode( 'share', 'x_shortcode_share_v2' );
 }
 
 function x_shortcode_share_v2( $atts ) {
  extract( shortcode_atts( array(
    'id'          => '',
    'class'       => '',
    'style'       => '',
    'title'       => '',
    'share_title' => '',
    'facebook'    => '',
    'twitter'     => '',
    'google_plus' => '',
    'linkedin'    => '',
    'pinterest'   => '',
    'reddit'      => '',
    'email'       => '',
    'email_subject' => ''
  ), $atts, 'x_share' ) );

  $share_url        = urlencode( get_permalink() );

  if ( is_singular() ) {
    $share_url = urlencode( get_permalink() );
  } else {
    global $wp;
    $share_url = urlencode( home_url( ($wp->request) ? $wp->request : '' ) );
  }

  if ( is_singular() ) {
    $share_title = ( $share_title    != '' ) ? esc_attr( $share_title ) : urlencode( get_the_title() );
  } else {
    $share_title = ( $share_title    != '' ) ? esc_attr( $share_title ) : urlencode( apply_filters( 'the_title', get_page( get_option( 'page_for_posts' ) )->post_title) );
  }

  $share_source     = urlencode( get_bloginfo( 'name' ) );
  $share_image_info = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full' );
  $share_image      = ( function_exists( 'x_get_featured_image_with_fallback_url' ) ) ? urlencode( x_get_featured_image_with_fallback_url() ) : urlencode( $share_image_info[0] );

  if ( $linkedin    == 'true' ) {
    $share_content    = urlencode( cs_get_raw_excerpt() );
  }

  $tooltip_attr = cs_generate_data_attributes_extra( 'tooltip', 'hover', 'bottom' );

  $id          = ( $id          != ''     ) ? 'id="' . esc_attr( $id ) . '"' : '';
  $class       = ( $class       != ''     ) ? 'x-entry-share ' . esc_attr( $class ) : 'x-entry-share';
  $style       = ( $style       != ''     ) ? 'style="' . $style . '"' : '';
  $title       = ( $title       != ''     ) ? $title : csi18n('shortcodes.share-title');
  $facebook    = ( $facebook    == 'true' ) ? "<a href=\"#share\" {$tooltip_attr} class=\"x-share\" title=\"" . csi18n('shortcodes.share-facebook') . "\" onclick=\"window.open('http://www.facebook.com/sharer.php?u={$share_url}&amp;t={$share_title}', 'popupFacebook', 'width=650, height=270, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false;\"><i class=\"x-icon-facebook-square\" data-x-icon=\"&#xf082;\"></i></a>" : '';
  $twitter     = ( $twitter     == 'true' ) ? "<a href=\"#share\" {$tooltip_attr} class=\"x-share\" title=\"" . csi18n('shortcodes.share-twitter') . "\" onclick=\"window.open('https://twitter.com/intent/tweet?text={$share_title}&amp;url={$share_url}', 'popupTwitter', 'width=500, height=370, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false;\"><i class=\"x-icon-twitter-square\" data-x-icon=\"&#xf081;\"></i></a>" : '';
  $google_plus = ( $google_plus == 'true' ) ? "<a href=\"#share\" {$tooltip_attr} class=\"x-share\" title=\"" . csi18n('shortcodes.share-google-plus') . "\" onclick=\"window.open('https://plus.google.com/share?url={$share_url}', 'popupGooglePlus', 'width=650, height=226, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false;\"><i class=\"x-icon-google-plus-square\" data-x-icon=\"&#xf0d4;\"></i></a>" : '';
  $linkedin    = ( $linkedin    == 'true' ) ? "<a href=\"#share\" {$tooltip_attr} class=\"x-share\" title=\"" . csi18n('shortcodes.share-linkedin') . "\" onclick=\"window.open('http://www.linkedin.com/shareArticle?mini=true&amp;url={$share_url}&amp;title={$share_title}&amp;summary={$share_content}&amp;source={$share_source}', 'popupLinkedIn', 'width=610, height=480, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false;\"><i class=\"x-icon-linkedin-square\" data-x-icon=\"&#xf08c;\"></i></a>" : '';
  $pinterest   = ( $pinterest   == 'true' ) ? "<a href=\"#share\" {$tooltip_attr} class=\"x-share\" title=\"" . csi18n('shortcodes.share-pinterest') . "\" onclick=\"window.open('http://pinterest.com/pin/create/button/?url={$share_url}&amp;media={$share_image}&amp;description={$share_title}', 'popupPinterest', 'width=750, height=265, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false;\"><i class=\"x-icon-pinterest-square\" data-x-icon=\"&#xf0d3;\"></i></a>" : '';
  $reddit      = ( $reddit      == 'true' ) ? "<a href=\"#share\" {$tooltip_attr} class=\"x-share\" title=\"" . csi18n('shortcodes.share-reddit') . "\" onclick=\"window.open('http://www.reddit.com/submit?url={$share_url}', 'popupReddit', 'width=875, height=450, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false;\"><i class=\"x-icon-reddit-square\" data-x-icon=\"&#xf1a2;\"></i></a>" : '';
  $email_subject = ( $email_subject != '' ) ? esc_attr( $email_subject ) : csi18n('shortcodes.share-email-subject');
  $mail_to     =  "mailto:?subject=" . get_the_title() . "&body=" . $email_subject . " " . get_permalink() . "" ;
  $email       = ( $email       == 'true' ) ? "<a href=\"{$mail_to}\" {$tooltip_attr} class=\"x-share email\" title=\"" . csi18n('shortcodes.share-email') . "\"><span><i class=\"x-icon-envelope-square\" data-x-icon=\"&#xf199;\"></i></span></a>" : '';


  $output = "<div {$id} class=\"{$class}\" {$style}>"
            . '<!--TEST--><p>' . $title . '</p>'
            . '<div class="x-share-options">'
              . $facebook . $twitter . $google_plus . $linkedin . $pinterest . $reddit . $email
            . '</div>'
          . '</div>';

  return $output;
}

Thanks!