UBB.Dev
Posted By: Gizmo [7.5.6] Shareaholic Bar v0.2 (2013.11.27) - 11/24/2013 3:19 PM
Author: Gizmo (James of VNC Web Design)

Requirements:
Valid UBB.Threads 7.5.6 install (though this could be adapted relatively easily for previous releases) and license as well as a Shareaholic account as you'll need to setup your site for use with their bar.

About:
I rather detest the built in Facebook/Twitter "like" buttons, so I poked around for a replacement and stumbled on Shareaholic which is a service which lets you display a listing of "share" buttons for content (which you can see running here above the "Quick Reply" box and on A Gardeners Forum).

Note: The "Thread View" portion of this modification is in the stock version of UBB.Threads 7.5.8 (13 days as a mod before being put in the stock product lol). If you're looking for the version for expanding v7.5.8 look here.


In the Control Panel (CP -> Display Options -> General -> HTML Includes Tab -> Header Insert) add:
Your "Shareaholic" setup code for your site.

To add a Shareaholic Bar to the "Forum Index" page:
In templates/default/cfrm.tpl:
Find:
Code
{include file="forum.tpl" type="cfrm" catrow=$catrow forum=$forum}

Add After (replace "YourKey" with your key from your channel setup):
Code

<br />
<div style="margin-bottom: 4px">
<div class="shareaholic-canvas" data-app="share_buttons" data-app-id="YourKey"></div>
</div>

To add a Shareaholic Bar to the "Viewing Forum" page:
In templates/default/postlist.tpl:
Find:
Code
<br />

{if $modlist}{$lang.USER_MOD}: {$modlist}{/if}

Add Before (replace "YourKey" with your key from your channel setup):
Code

<br />
<div style="margin-bottom: 4px">
<div class="shareaholic-canvas" data-link="{make_ubb_url("ubb=postlist&Board=$Board&page=1", $forum_title, false)}" data-app="share_buttons" data-app-id="YourKey"></div>
</div>

To add a Shareaholic Bar to the "Viewing Thread" page:
In templates/default/showflat.tpl:
Find:
Code

{if $facebook || $twitter}

Add Above (replace "YourKey" with your key from your channel setup):
Code

<br />
<div style="margin-bottom: 4px">
<div class="shareaholic-canvas" data-link="{$facebookURL}" data-app="share_buttons" data-app-id="YourKey"></div>
</div>

Other Pages:
This code can also be appended to other various pages:
Active Topics (activetopics.tpl)
Portal Page (portal.tpl)

As
Code

<br />
<div style="margin-bottom: 4px">
<div class="shareaholic-canvas" data-app="share_buttons" data-app-id="YourKey"></div>
</div>

Please leave your thanks below so we can know that we've helped you!
Posted By: Pilgrim Re: [7.5.6] Shareaholic Bar v0.2 (2013.11.27) - 11/26/2013 9:54 PM
Call me ignorant, and I am in regard to social networking sites, but what exactly does this "Shareholic" thing do; how does it work???
Posted By: Gizmo Re: [7.5.6] Shareaholic Bar v0.2 (2013.11.27) - 11/27/2013 3:50 AM
It lets people share a thread on Twitter, Facebook, Google+, EMail, etc; free advertising basically. Ultimately it's what I envisioned the Facebook/Twitter "like" buttons that we've had in 7.5 being when I approached Rick about it several years ago.

When a user "shares" the link (just by clicking the button) it shares it on the social networking site and adds +1 to the tally on the counter for each service (I clicked the Facebook one, see how it shows a number next to it? If you click it then it'll increase accordingly).

How does it work, well, you slap their code into your forum as per the directions above; how does it work on their end, I have no clue.
Posted By: Gizmo Re: [7.5.6] Shareaholic Bar v0.2 (2013.11.27) - 11/28/2013 3:39 AM
I have an update planned when I get a little more time that will force all URLs in a thread to have the parent post (initial post) as the ID; this will make all pages that a share is clicked on to record to the same parent.

Example; I click "share" on page 5 of a thread, someone clicks share on page 2, someone else clicks it on page 1; all are regarded as different pages. The planned update will have all posted to the primary page. I just need to figure out the logic for each page I've recommended this to be installed on (above).
Posted By: Gizmo Re: [7.5.6] Shareaholic Bar v0.2 (2013.11.27) - 11/28/2013 1:01 PM
Ok, as of the current posted script (now above) the mod will always link to page 1 of a thread or a forum.

Code for the Thread view hijacked from the Facebook like button, code for the forum view hijacked from the breadcrumb bar.
Posted By: StanCA Re: [7.5.6] Shareaholic Bar v0.2 (2013.11.27) - 12/01/2013 11:24 AM
Please type slow when responding... smile

When I went to register for Shareaholic it seems like they want to install something in my browser, am I doing this correct? I thought this was for my forum... and it really looks classy...

Thanks
Posted By: Gizmo Re: [7.5.6] Shareaholic Bar v0.2 (2013.11.27) - 12/01/2013 11:29 AM
They have a browser bar and a utility for your site; both are independent.

What you're looking for is in their "Publisher Tools" section of their site.
Posted By: StanCA Re: [7.5.6] Shareaholic Bar v0.2 (2013.11.27) - 12/01/2013 12:44 PM
Quote
Other Pages:
This code can also be appended to other various pages:
Active Topics (activetopics.tpl)
Portal Page (portal.tpl)

After which line?

AND thanks this is working so far smile
Posted By: Gizmo Re: [7.5.6] Shareaholic Bar v0.2 (2013.11.27) - 12/01/2013 4:24 PM
Originally Posted by StanCA
After which line?

AND thanks this is working so far smile
Wherever you want it to display; likely just toss it at the bottom with the same code from the cfrm step.
Posted By: StanCA Re: [7.5.6] Shareaholic Bar v0.2 (2013.11.27) - 12/05/2013 7:46 PM
thanks,, wondering if others are seeing a slow load? I have one on top and it loads after the rest of the forum is loaded.

???
Posted By: Gizmo Re: [7.5.6] Shareaholic Bar v0.2 (2013.11.27) - 12/06/2013 3:40 AM
If properly coded all javascript should load after the page content; otherwise if it would hang your site wouldn't load until the javascript finished...
© UBB.Developers