ShareThis 6.x-1.8 wasn’t working for me and I didn’t want to install the extra dependency of 6.x-2.x. The 7.x branch it looks like a much more elegant approach and uses the current ST API.

I’ve backported the D7 version to D6 and it seems to be working, I thought it could make a nice 6.x-3.x branch. I’ll post a patch.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dboulet’s picture

Status: Active » Needs review
FileSize
22.95 KB

Here’s a patch against 7.x-1.x. It includes a basic update function to migrate from 6.x-1.8.

mhedstrom’s picture

This sounds great! I tried to get it to patch, but it failed on me (it kept asking what file to patch). Is there a different way I should be applying this?

dboulet’s picture

Hi mhedstrom, make sure that you are patching against 7.x-1.x. Try the following command in the module’s root directory:

patch -p1 < sharethis_d7_backport-1253794-1.patch
mhedstrom’s picture

I see the problem. The 7.x-1.x version you patched against was from the end of May. The current dev version is from June. I patched it against the released 7.x-1.x version which I guessed was the same one, and I was right. It seems to work! Thanks! Now I just need a patch that has Google+ in it. :)

dboulet’s picture

The patch applies to the latest 7.x-1.x from git. Not sure what is needed to implement integration with Google+, that should probably be a filed as a separate issue.

mhedstrom’s picture

I found a thread about it, so I'm all good to go! Works great, thanks!

dboulet’s picture

Fixed a small update bug.

pirog’s picture

patch worked for me.

i needed more functionality for a project i am working on so i added in a theme function and very basic views integration. looks like we aren't really putting a lot of focus into this issue but thought i would post my patch just in case someone else was looking for this.

also, you need to apply patch from 7 first

pirog’s picture

would second making #7/#8 the basis of a 6.x-3.x branch and would also help maintain/develop if desired.

Media Crumb’s picture

is there a full release without a patch. I'm really not sure how to go about patching. :\

pirog’s picture

I've added the 6.x-3.x branch to the below repo for now so that people can download it. Make sure you extract the contents of the download into a folder called "sharethis"

https://github.com/gotham-city-drupal/ShareThis

kbell’s picture

++1 making #7/#8 the basis of a 6.x-3.x branch.

Media Crumb’s picture

I got this after trying to install:

User warning: Column length too big for column &#039;st_value&#039; (max = 255); use BLOB or TEXT instead query: CREATE TABLE st_table ( `st_option` VARCHAR(100) NOT NULL DEFAULT &#039;&#039;, `st_value` VARCHAR(2000) NOT NULL DEFAULT &#039;&#039;, PRIMARY KEY (st_option) ) /*!40100 DEFAULT CHARACTER SET utf8 */ in _db_query() (line 148 of /V3/includes/database.mysql.inc).

User warning: Table &#039;doodi_v32old2play.st_table&#039; doesn&#039;t exist query: INSERT INTO st_table VALUES (&#039;widget&#039;, &#039;st_multi&#039;) in _db_query() (line 148 of /V3/includes/database.mysql.inc).

User warning: Table &#039;doodi_v32old2play.st_table&#039; doesn&#039;t exist query: INSERT INTO st_table VALUES (&#039;buttons&#039;, &#039;stbc_large&#039;) in _db_query() (line 148 of V3/includes/database.mysql.inc).

User warning: Table &#039;doodi_v32old2play.st_table&#039; doesn&#039;t exist query: INSERT INTO st_table VALUES (&#039;services&#039;, &#039;&quot;Tweet:twitter&quot;,&quot;Facebook:facebook&quot;,&quot;ShareThis:sharethis&quot;&#039;) in _db_query() (line 148 of /V3/includes/database.mysql.inc).

User warning: Table &#039;doodi_v32old2play.st_table&#039; doesn&#039;t exist query: INSERT INTO st_table VALUES (&#039;nodeType&#039;, &#039;news&#039;) in _db_query() (line 148 of /V3/includes/database.mysql.inc).

User warning: Table &#039;doodi_v32old2play.st_table&#039; doesn&#039;t exist query: INSERT INTO st_table VALUES (&#039;viewMode&#039;, &#039;1&#039;) in _db_query() (line 148 of /V3/includes/database.mysql.inc).

User warning: Table &#039;doodi_v32old2play.st_table&#039; doesn&#039;t exist query: INSERT INTO st_table VALUES (&#039;publisherID&#039;, &#039;&#039;) in _db_query() (line 148 of /V3/includes/database.mysql.inc).

User warning: Table &#039;doodi_v32old2play.st_table&#039; doesn&#039;t exist query: INSERT INTO st_table VALUES (&#039;weight&#039;, &#039;10&#039;) in _db_query() (line 148 of /V3/includes/database.mysql.inc).
pirog’s picture

can you provide more details on how i can go about recreating this error?

lessurluck’s picture

I think he is having the same issue as me. I am guessing that this is not creating a new table in the database.

my error=
user warning: Table 'mydatabasename_drupal.st_table' doesn't exist query: SELECT st.st_option, st.st_value FROM st_table st in ...sites/all/modules/sharethis/sharethis.module on line 324.

Not sure what to do so I am going to try adding in the code to tpl. I hope you guys can fix this, it would be so much better to have this available then the other social media modules.

lessurluck’s picture

I should probably add:
downloaded 3x from your link
installed like any other module
deleted 6x sharethis
renamed 3x to sharethis

hope that helps

lessurluck’s picture

spoke to soon... I went to admin/reports/status and under update database run that and it works great. thanks for making this available!

dmendo11’s picture

Hi,

I am installed this from the link and it did work. But is not working on the node-product.tpl.php page. Do I need to add a code to make sure it works?

Great module, I was looking for something like this for a while.

David

pirog’s picture

if you are upgrading from 6.x-2.x you will have to run update.php to make sure the database is set up properly. If you are installing a fresh copy it should install all of that stuff when you enable it but please speak up if that is not the case.

#18, are you selecting the product content type in the sharethis config page? Where is the product type coming from? custom? ubercart? commerce?

If there is a custom theme template file for that content type its possible that it is not including the $links variable which is the default location for the sharethis icons.

dmendo11’s picture

Hi Pirog,

I am currently using Ubercart and it is a custom template. So what I did is copy the code from the ShareThis both Javascript and code and place it in my node-product.tpl.php file. This made the logos appeared into the product page. I guess it is a long way to doing so, but it worked. I will have to check the node page to see if I can look the $links variable and make the adjustments correctly to the template and see if this is faster.

Thank you guys for this module and thank you for doing a backport to D6.

David

pirog’s picture

thanks @dmendo11!

while im not officially part of the sharethis team im sure they would also appreciate your words! i really only provided some additional functionality and a downloadable package of the back port work done by @dboulet. would love your support in trying to make this an official 6.x-3.x branch!

if you are interested in my thoughts on your solution please read further. a basic function of the module is to provide the code that you pasted into your template file so while your solution "works" it is actually just replicating what the module already does. this is generally not considered best practices nor is pasting that kind of code directly into a template file but you can certainly do it. id be i liar if i said i never hacked something before :)

if you want you can paste the template file you are using into this issue queue and i can try to help you figure out what is happening.

Media Crumb’s picture

Tried again and I'm still getting an error

User warning: Table &#039;doodi_v32old2play.st_table&#039; doesn&#039;t exist query: SELECT st.st_option, st.st_value FROM st_table st in _db_query() (line 148 of /home/public_html/includes/database.mysql.inc).

Is it an issue with MySQL version?

dboulet’s picture

Media Crumb, are you installing from scratch, or did you update from another version of ShareThis?

dmendo11’s picture

<?php
// $Id: node-product.tpl.php,v 1.5 2010/09/17 21:36:06 eternalistic Exp $
?><head>
  <title><?php print $head_title; ?></title>
  <?php print $head; ?>
  <?php print $styles; ?>
  <?php print $setting_styles; ?>
  <!--[if IE 8]>
  <?php print $ie8_styles; ?>
  <![endif]-->
  <!--[if IE 7]>
  <?php print $ie7_styles; ?>
  <![endif]-->
  <!--[if lte IE 6]>
  <?php print $ie6_styles; ?>
  <![endif]-->
  <?php print $local_styles; ?>
  <?php print $scripts; ?>

<script type="text/javascript">var switchTo5x=true;</script><script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script><script type="text/javascript">stLight.options({publisher:'47f1ad53-e387-49bf-8ec3-2a6cc09f29cb'});</script>
</head>


<div id="node-<?php print $node->nid; ?>" class="node clear-block <?php print $node_classes; ?>">
  <div class="inner">
    <?php if ($page == 0): ?>
    <h2 class="title"><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
    <?php endif; ?>

    <?php if ($submitted): ?>
    <div class="meta">
      <span class="submitted"><?php print $submitted ?></span>
    </div>
    <?php endif; ?>

    <?php if ($node_top && !$teaser): ?>
    <div id="node-top" class="node-top row nested">
      <div id="node-top-inner" class="node-top-inner inner">
        <?php print $node_top; ?>
      </div><!-- /node-top-inner -->
    </div><!-- /node-top -->
    <?php endif; ?>

<table align="center" cellpadding="0" cellspacing="0"  class="product">
  <tr>
     <td align="left" valign="top" class="product_image">
     
        <?php print $fusion_uc_image; ?>   </td>
   <td align="left" valign="top"  class="product_info">
        <?php $product_details = $fusion_uc_weight || $fusion_uc_dimensions || $fusion_uc_list_price || $fusion_uc_sell_price || $fusion_uc_model || $fusion_uc_cost; ?>
        <div id="product-details" class="clear" align="left">
          <div id="field-group">
            <?php print $fusion_uc_weight; ?>
            <b><font size="2">Model Number: </font></b><?php print $fusion_uc_model; ?>
            <br />
            <?php print $node->content['model']["#value"];  ?>
            <br />
            <br />
			<?php print "<font color='CC3333'>$fusion_uc_list_price</font>"; ?>
            
            Selling Price: <?php print "<b><font color='6699CC' align='center' size='4'>$fusion_uc_display_price</font></b>"; ?>
            <?php print $fusion_uc_sell_price; ?>
			<?php print $fusion_uc_cost; ?>
            <?php print $fusion_uc_dimensions; ?>          </div>

          <div id="price-group">
            <br />
            <?php print $fusion_uc_add_to_cart; ?>
            <br />
            <?php
 			 $stock = uc_stock_level($node->model);
 			 if ($stock > 0) {
    		 print "<b><font color='009100' size='2'>In Stock </font></b>" ;
  			 }else {
    		 print "<b><font color='CC3333' size='2'>Sorry, this item is out of stock</font></b>" ;
  			 }
  			?>
            <br />
            <b> Quantity in Stock: <?php print $stock ?> </b><br />
<br />
			<b><?php
            print $node->content['uc_lto']['#value'];
			?></b>
          </div>
          
        </div>
         <div id="product-details">
           <div align="center"> Rating Score: </div><br />
           <div align="left"><?php print fivestar_widget_form($node); ?></div>
         </div>
        <!-- /product-details -->
</td>
</tr>
</table>
</div>
</div>
<br />
<table align="default" cellpadding="0" cellspacing="0"  class="product">
<tr>  <td align="left" valign="top"  class="product_info">
<div id="product-details"> 
<b>Description: </b><br /><br>
<?php print $fusion_uc_body; ?>
<span  class='st_facebook_hcount' displayText='Facebook'></span><span  class='st_email_hcount' displayText='Email'></span><span  class='st_gbuzz_hcount' displayText='Google Buzz'></span><span  class='st_twitter_hcount' displayText='Tweet'></span><span  class='st_sharethis_hcount' displayText='ShareThis'></span><span  class='st_yahoo_hcount' displayText='Yahoo!'></span>
</div>
</td></tr>
</table>

<!-- /content --><?php if ($node_bottom && !$teaser): ?>
<div id="node-bottom" class="node-bottom row nested">
    <div id="node-bottom-inner" class="node-bottom-inner inner">
      <?php print $node_bottom; ?>
    </div><!-- /node-bottom-inner -->
  </div><!-- /node-bottom -->
  <?php endif; ?>

That is the code I am using. I am not using the $links on the template, but I did put it on and it didn't work at all.

It is working on the nodes perfectly, but not working on the products. I haven't touched the node.tpl.php file so there might be something there that the products file is missing.

Thanks,

David

pirog’s picture

Hey David,

just looked back through the code and it isn't $links where the chicklets go but $node->content['sharethis']. I think $links was used in the 6.x-2.x branch and that is where i was getting confused.

To confirm that this is the case add something like

print $node->content['sharethis']['#value'];

to the node product template.

If that is indeed the reason why this doesn't work i can help you create a custom template, if you aren't already doing that, for ubercart so that you aren't "hacking" ubercart.

dmendo11’s picture

Hi Pirog,

Yes, Yes it did work with that code. Just in case I just added that code with the code I had hacked the template. So if it work I was going to see 2 codes instead of just one. So it did! Then I just removed the code created by the sharethis.com and replaced with this:

<?php print $node->content['sharethis']['#value']; ?>

That is the correct code. Then it worked, it finally worked.

Thank you for all your help. This should be really added to the Drupal 6 version as it looks much better to have the more settings like in the admin section.

Great contribution Everyone.

David

pirog’s picture

@dmendo11,

im glad it worked!

do you know if you are using a custom template file for the product content type or the template that comes with ubercart? if you are using the ubercart one all the changes you made to get it to work would be wiped out if you ever upgraded ubercart.

in these scenarios it is best practice to put a "custom" template in your theme folder (or in a module in some cases) so that you can preserve this tweak upon upgrade. If you are interested in learning how to do this just let me know and i can either write or direct you to an article explaining the procedure.

Media Crumb’s picture

I'm installing from scratch. Do i need to install another version first?

User warning: Table &#039;doodi_v32old2play.st_table&#039; doesn&#039;t exist query: SELECT st.st_option, st.st_value FROM st_table st in _db_query() (line 148 of /home/public_html/includes/database.mysql.inc).

pirog’s picture

Title: Backport D7 version of ShareThis to D6 » http://investorshub.advfn.com/boards/emailupdate.asp?email=mike.pirog@gmail.comBackport D7 version of ShareThis to D6

@dboulet's original patch includes an upgrade path from 6.x-1.8... and i provided an additional update on top of that to bring it in line with the st_table architecture that was being used in the 7.x-2.x version. That architecture has since been removed in favor of the variables table... which is probably a good call and something we should match here at some point as well.

I would try to the upgrade method from 6.x-1.8 if a fresh install is not working. I am actually going to be doing a fresh install sometime in the next week so if you want to wait for that i can probably help you more.

dboulet’s picture

Title: http://investorshub.advfn.com/boards/emailupdate.asp?email=mike.pirog@gmail.comBackport D7 version of ShareThis to D6 » Backport D7 version of ShareThis to D6
Status: Needs review » Needs work

The original patch probably needs a reroll now that there have been modifications to the D7 version.

Media Crumb’s picture

Has anyone installed from scratch without an update? I just want to know if im the only one with this DB errors.

dmendo11’s picture

Media,

I installed from scratch, no problems on the db. You should uninstall the module to clear any db information . Then start all over. To be safe, delete directory on ftp server and reupload. Then enable the module. It should work. I had no issues other than the ones I listed above.

David

chrisjames911’s picture

I am new to Drupal from Joomla and I have been trying to get the Share This module working on a Drupal 6.20 install with no luck. I don't get any errors the app just dont show up. Can someone shed some light on the issue for me.

borfast’s picture

I'm experiencing the same as chrisjames911: no errors but no ST buttons either. All I manage to get is a small "ShareThis" link at the bottom of my posts, which links to the same post I'm already at.

Any idea on how to track this problem to its source?

rastarr’s picture

Just installed the backport from post http://drupal.org/node/1253794#comment-5138760

Great start and certainly the better interface.

Is there a way to add FB likes as well as Google+?
Any way to reorder the layout of the services?
It also seems to appear that the counters are not pulling the correct count info for each listed service either i.e. from my current buttons, I can see that counts for tweets, FB Shares/Likes etc aren't correct and the ShareThis buttons are typically showing '0'

Should this be a listed alternate download than hidden away in this thread?

dboulet’s picture

Should this be a listed alternate download than hidden away in this thread?

Yes, that is the goal here, it’s up to the project maintainers to decide whether or not to create a new branch using this code.

Once the backport is added, all feature requests can be added to 7.x first and then backported to 6.x. For now we are only concentrating on getting the backport committed.

rastarr’s picture

I noticed a lot of the issues I just posted about have already been committed to the v7.x port, in the last week.

Is there any possibility of getting another backport done to v6.x from the currently committed v7.x?

pirog’s picture

id be willing to help dboulet on backporting the 7.x branch's new features to D6 but it would be great to get this listed as an official 6.x branch first. although ive forked sharethis, added the new 6.x-3.x branch and placed it on github that was mainly for people who arent used to patching to easily download what we've done. id much rather maintain that code in a drupal.org repo instead of on github... we don't want the fork to get too far apart from the mainline.

rastarr’s picture

Thanks heaps for doing that too, pirog.

totally agree it would be far better for it to be official. Hopefully something will come of that soon.

Have you, by chance, updated your 6.x-3.x branch to include the latest commits by Rob Loach? I'd love to finally find a workable sharing module that also allows displaying within content - it's been a real chore thus far and ShareThis is the best I've come across, to date.

rastarr’s picture

Any update on an official D6 backport into a repo?

gsaha’s picture

i was able to install and get the github package posted by pirog.
however there is no block called sharethis.
Any way to have a block called sharethis?

afox’s picture

Status: Needs work » Needs review
FileSize
192.25 KB

I created a new port of the 7.x-2.x branch because there was so many changes in the branch after the initial port by @dboulet and @pirog. Only the 7.x-2.x branch had the ability to add ShareThis -buttons on a custom URL, which I needed. Also, I removed the requirement of needing to have node types selected.

I think this is a good starting point to keep the 6.x version at least relatively current. If @pirog wants, the github version can also be updated.

Comments and suggestions from the maintainers?

pirog’s picture

@afox, what is your github username? i can give you access to the github repo and you can update it if you wish.

it would be really great to get some access to the 6.x branch here so we don't stray too far!

roadie_jay’s picture

Hi,
I've installed the backport, but when I try to configure it, the "choose your services" feature doesn't seem to work. Clicking on the service and then on the arrow doesn't seem to do anything. Once you mouse off the service title it loses the highlight as well. Is there some underlying module required in Drupal 6 to make this selection feature work?

roadie_jay’s picture

As a follow up, in the Firebug console, I'm getting this error

_all_services[pickerDefaults[i]] is undefined
[Break On This Error]

...c='http://w.sharethis.com/images/"+pickerDefaults[i]+"_32.png'>

roadie_jay’s picture

running update.php resolved the issue

diego.pasc’s picture

It works for me (running update.php as roadie_jay).
Thanks a lot!

ps: the attachment in comment #43 seems to be broken, I downloaded the files directly on https://github.com/gotham-city-drupal/ShareThis/downloads

btw, what about the ShareThis block (to show the share buttons anywhere in the site and not only in nodes)? It was useful in 6.x 1.18 but now there is no hook_block implemented anymore.

afox’s picture

@diego.pasc I didn't have any problems with the attachment. The versions don't differ THAT much, except the one in Github doesn't support custom paths.

@pirog my Github is a-fox . Get me access and I'll update it. Hopefully we'll get the maintainers attention so we can get a new release. I asked Rob Loach to take a look,hopefully we'll have some progress.

pirog’s picture

@afox

should have access now: https://github.com/pirog/ShareThis

let me know if you ned anything else

afox’s picture

@pirog thanks, I updated Github with what we're currently using on our site. There were more changes than what I initially remembered from the 7.x-2.x branch. Can you check the code/module in a vanilla D6, since I have to check on other issues for couple days.

pirog’s picture

im pretty swamped for the next few as well but ill see what i can do! let me know if you have time to get to it first so we dont duplicate efforts.

paskainos’s picture

#43 worked for me here. Super awesome - thanks guys! So where are we at now since there are a few different reference points:

pirog’s picture

the gotham_city_drupal repo is an ancestor of the pirog repo.

afox, correct me if i am wrong but i think the package in #43 is just built from the pirog repo on github?

Dubber Dan’s picture

Thanks folks, I downloaded the module in #43 and it works fine for me at http://www.elementsforlife.co.uk

A shame that the previous 6.x version seems to have been ignored and abandoned, but it's given this one life so all good in the end.

Will this get a proper listing on the module page to make it easy to download for others?

Also, will there be further development to allow the other styles of buttons, such as floating on the side of the page in a column?

afox’s picture

I contacted Rob Loach on the issue in May i think, but he's a bit swamped. The pirog Github repo should be the main point of reference atm. The #43 package is based on the pirog repo with my mods.

Everybody interested, please contact the maintainers to check this out. We need more voice to get this committed.

minneapolisdan’s picture

Do any of these versions work with Views, so I can add ShareThis as a field with each node?

diego.pasc’s picture

@minneapolisdan: yes, ShareThis is integrated with Views: so you can add a field with ShareThis buttons.

minneapolisdan’s picture

diego.pasc, thanks for the reply. I'm not seeing any fields available in Views. I wonder what version of ShareThis you are using? I tried the 2 versions from post #50 and #43 and haven't seen anything. I may either go back to the version offered here on drupal.org, or end up embedding these manually. But if I can place them via Views, then great.

diego.pasc’s picture

FileSize
14.78 KB

@minneapolisdan: see attachment (Note that ShareThis field is under "Node" category)
Hope helps.
I use Views 2.16 and ShateThis patch in comment #43.

lhugg’s picture

Just a helpful hint if you have downloaded the tarball from #43. The extraction from the .gz file actually gives you a tarball ending in 'tar_' (emphasis on the underscore). My software would not recognize this as a .tar file and therefore would not extract it. I didn't catch it for a while, so bringing it to your attention to save you some time.

Just rename the file to .tar and you're on the way.

watsomic’s picture

Version: 6.x-1.x-dev » 6.x-1.8
FileSize
27.06 KB

For our site maintenance, we required a forward patch from version 6.x-1.8 to the updated version in comment #43. Thought it might also be easier for site maintainers to update the 6.x-1.8 version with this, as well. I have attached the patch.

Note: the images in the settings page for this module don't work with this patch.

dpalmer’s picture

i installed the targz from #43 on my site. It works great, except for the most important part, the share button in the modal dialog. When I click the share icon and it pulls up the window , I can fill out the form, but no matter what when I click share nothing happens. I've tried this with various roles & browsers with no luck.

I do notice this js log in the console

FB.getLoginStatus() called before calling FB.init().

I don't know if it is related.

subu.purohit’s picture

Hi minneapolisdan,

I am too getting the same problem, I am using views 2.16. Did you get any work around for this?

Sansui’s picture

subu - it appears that the views hook has been removed, and if you look a little closer, that's probably because there is no longer a theme function in this version and the views handler is looking for that function. I'm not sure what version diego is actually using, because this one definitely does not function with views

subu.purohit’s picture

Thanks Sansui,

Can you please assist me about this theme function. I have been tried to make it according to 6.x-1.8 hook functions but could not get success.

Thanks

Status: Needs review » Needs work

The last submitted patch, sharethis-d7backport-1253794-43.patch, failed testing.

apaderno’s picture

Version: 6.x-1.8 » 6.x-2.x-dev
Issue summary: View changes
Status: Needs work » Closed (outdated)

I am closing this issue, since Drupal 6 isn't supported.