1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.2 Permalink Share issue

Discussion in 'Troubleshooting and Problems' started by jayramfootball, Aug 2, 2013.

  1. jayramfootball

    jayramfootball Active Member

    Hi, when sharing a thread via permalink option I have lost all the share buttons since upgrading to 1.2..

    Untitled.png

    Is there an option that I need to reinstall for this... I used to use this a lot for posting to twitter..
     
  2. russoroni

    russoroni Active Member

    You've got to be kidding me. I finally find somebody that has the exact same problem as me and not one reply. Did you ever figure this out?
     
  3. Mike

    Mike XenForo Developer Staff Member

    It's an issue the second time you load it on the page. Unfortunately, it appears to be a bug in the AddThis JS (as that's what generates that).
     
    russoroni likes this.
  4. russoroni

    russoroni Active Member

    @Mike I emailed support over at addthis and explained the problem. They replied immediately and after a little discourse this was the last email:

    It's a little disheartening that they'd just say it's a bug on our end without actually talking to us about it.

    I think there's some issues with how they're loading the script and rendering the buttons because the first Share link that's clicked will always show up. I've got our best JavaScript developer looking into it to see why their code doesn't work. As soon as he's figured it out I'll let you know, and I'll email Xenforo to have them implement a fix.
    --
    Regards,
    Paul
    Tech Support Lead
    AddThis.com
     
  5. Mike

    Mike XenForo Developer Staff Member

    Last time I looked into this, I couldn't find a workaround and then ended up forgetting about it (ages ago). I played around with it again and looked at the docs and appear to have found a workaround. It will be included in the next release.

    This seems to sort it:
    Code:
    <xen:if is="{$xenOptions.addThis.enabled}">
    <!-- AddThis Button BEGIN -->
    <div class="addthis_toolbox addthis_default_style addthis_32x32_style">
        <a class="addthis_button_preferred_1"></a>
        <a class="addthis_button_preferred_2"></a>
        <a class="addthis_button_preferred_3"></a>
        <a class="addthis_button_preferred_4"></a>
        <a class="addthis_button_preferred_5"></a>
        <a class="addthis_button_preferred_6"></a>
        <a class="addthis_button_preferred_7"></a>
        <a class="addthis_button_compact"></a>
        <a class="addthis_counter addthis_bubble_style"></a>
    </div>
    
    <script type="text/javascript">
    
    var addthis_share = {
        url: "{xen:jsescape $url}",
        templates: {
            twitter: "{{title}} {{url}}{xen:if {$xenOptions.tweet.via}, ' via @{$xenOptions.tweet.via}'}"
        }
    };
    var addthis_config = {
        services_exclude: 'print'
    };
    
    // handle AddThis on AJAX-loaded page           
    if (!window.addthis)
    {
        XenForo.loadJs("//s7.addthis.com/js/250/addthis_widget.js#domready=1{xen:if {$xenOptions.addThis.pubId}, '&pubid={xen:jsescape $xenOptions.addThis.pubId}'}");
    }
    else
    {
        addthis.toolbox($('.addthis_toolbox').get());
    }
    
    </script>
    <!-- AddThis Button END -->
    </xen:if>
     
    Sasa likes this.
  6. russoroni

    russoroni Active Member

    Wow fantastic. Thanks mike
     

Share This Page