TechLifeWeb

Exploring the digital life

A Google+ Share With Attribution Button for Any Site

The other day i saw this article on The Next Web about adding a Google+ share icon to your WordPress blog.  It is based on the original article from Alex Moss.  The main limitation is that it uses the mobile version of Google+ to make it work. Not a big deal just not that pretty.

So I thought this is pretty handy and while WordPress is huge among bloggers, there are still tons of other sites and blogs that might want a sharing button.  Then I thought I could take it a step further and include a way to add attribution.

On Google+, you give someone attribution or address someone by putting a + in front of their name. For example +George Washington.  Google Plus then turns these into links and notifies the person they have been mentioned in a post. The problem is, if you “+” some one that isn’t in one of your Circles it doesn’t always work. Unless you know the little known secret: you can “+” a user number and it should work everytime. This also ensures your are attributing the right +John Smith! My code below will take advantage of this feature since people outside of your circles could be sharing from your site.

So, how do you get your user number? Just go to Google Plus and click on your profile. Your user number is that big bunch of numbers up in your url

gplus_usernumberright after plus.google.com.
Below is the code to place anywhere in your site where you want the share button to show up.

Note: If you want to use attribution, replace the numbers after via + with the numbers from YOUR user number. Be sure to leave the “+” there!

If you do NOT want to use attribution, delete everything between the quotes after attrib=. So it should read: attrib=’ ‘

<a href=”javascript:var d=document,w=window,attrib=’ via +123456789012345678901‘,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f=’https://m.google.com/app/plus/x/’,l=d.location,e=encodeURIComponent,u=f+’?content=’+e(d.title)+e(‘ – ‘)+e(l.href)+e(attrib)+’&v=compose&hideloc=1′;a=function(){if(!w.open(u,’gplusshare’,'toolbar=0,resizable=1,scrollbars=1,status=1,width=450,height=295′))l.href=u;};if (/Firefox/.test(navigator.userAgent)) setTimeout(a, 0); else a();void(0)”><img class="scale-with-grid" src=”http://dl.dropbox.com/u/118970/plus-share.png” width=”55″ height=”22″ alt=”Share this post on Google+” title=”Share this post on Google+”></a>

Here is the same code in a text file that should make it easier to use since these kinds of things with quotation marks can get confused by browsers.  share.txt

You shoud be able to use this code on any site that lets you add html. Google may have something else in the works to make this easier. But for now, this should fill the gap.

How to fix spam getting through Akismet on WordPress

Many people who run WordPress blogs, including this one, use the Akismet plugin to help fight comment spam. On this blog alone, Akismet has stopped 15,666 spam comments! Today, something went wrong. I’m still not completely sure what caused the break down but spam began getting through the net. The first thing to do in these cases is Google it. That isn’t always fast enough in the case of real time problems so the next best thing is TwitterSearch. Actually, in this case, it is the first best thing because as I monitored results coming in over a twitter search on the term Akismet, I spotted someone who tweeted a solution.

Jill Olkoski of Aldebaran Website Design posted an easy solution to the problem. She noted that the when going to moderate the spam it was consistently coming from certain IP addresses. The addresses are from somewhere in Amsterdam.

The fix*:

  • Go into your the Dashboard on your WordPress blog.
  • Click Settings (on the top right-hand side)
  • Click Discussion
  • Scroll all the way down to the section that says Comment Blacklist
  • Paste in the following IP addresses:
  • 94.102.60.150
  • 94.102.60.151
  • 94.102.60.152
  • 94.102.60.153
  • Scroll all the way down to the bottom and click the Save Changes button
  • *This is not perfect. If the spammers move around and change IP addresses  they won’t be blocked by this list. Fortunately it is easy to add or change addresses in your WP settings so for now it gives us a way to fight back.

    Thanks Twitter!