vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=246)
-   -   Show Thread Enhancements - Twitter - Tweet Button in SHOWTHREAD (https://vborg.vbsupport.ru/showthread.php?t=248569)

nick-harper 03-22-2011 11:12 PM

Try This:

Code:

<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="TWITTERNAME" data-url="{vb:raw vboptions.bburl}/{vb:link thread, {vb:raw thread}, {vb:raw pageinfo_newpost}, 'threadid', 'threadtitle'}">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>

BirdOPrey5 03-22-2011 11:26 PM

Quote:

Originally Posted by nick-harper (Post 2176359)
In 4.1.2 there is a template called "facebook_likebutton"

Just add it to the end of that template :)

Great Idea :up:

Quote:

Originally Posted by nick-harper (Post 2176366)
Try This:

Code:

<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="TWITTERNAME" data-url="{vb:raw vboptions.bburl}/{vb:link thread, {vb:raw thread}, {vb:raw pageinfo_newpost}, 'threadid', 'threadtitle'}">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>

That should work, my concerns are it will use the page number and the thread title. On many forums people's page numbers vary... For instance this is page 4 for me, it may be page 10 for someone else or page 2 for yet someone else. Therefore if you tweet the url with the page number the person following the link could very well end up on a different page.

For this reason I prefer to tweet the first page only no matter what page someone hits the tweet button on. Not to mention each page would have it's own tweet counter (so if someone tweets page 2, page 1 would be zero still).

For the same reason I don't like using the full title in the URL because if the title is edited the count will reset as well.

Eruantien 03-23-2011 07:20 PM

Anyone know why the tweet count resets to 0 when you refresh the page?

TWood 06-09-2011 04:24 PM

I used the code from Post 143 here and it works nicely to fix the dropped slash problem. Thank you!

How would that code be modified to Tweet a link to a single post? I'd add the button to the post header bar, next to the permalink. I assume it would use the permalink, but don't know how to code that.

Similarly, how would the code for the Facebook 'Like' button be modified to 'Like' a single post instead of the entire thread?

Thanx

(I'm using 4.1.3)

BirdOPrey5 06-09-2011 05:34 PM

Code:

<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="YOUR_TWITTER_USERNAME" data-url="{vb:raw vboptions.bburl}/showthread.php?p={vb:raw post.postid}#post{vb:raw post.postid}">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
That should work per post anywhere in the postbit templates.

In facebook or anything else use this URL per post:
Code:

{vb:raw vboptions.bburl}/showthread.php?p={vb:raw post.postid}#post{vb:raw post.postid}

andycaps 06-09-2011 06:08 PM

I installed this ok and it sends the thread out to my twitter page but the URL on the tweet does not take the reader back to the forum thread?

Its: Tweet to Twitter test http://t.co/vzi8yBF

Does anyone know why its creating the wrong link, what do i need to do to the code to correct this and auto post the correct URL back to the forum thread?

thanks guys
Andy

BirdOPrey5 06-09-2011 07:04 PM

There is so much wrong with the URL you pasted I don't know where to begin...

Exactly what code are you using for the twitter buttong- post it here.

Also post the URL to a thread that has the twitter button on your forum.

TWood 06-10-2011 12:48 AM

Thanks BoP -

BTW, I placed a bug report at Twitter regarding the missing / after the .com and they acknowledge the bug:

http://code.google.com/p/twitter-api...detail?id=2231

Quote:

Looking at your source code you have the following line in your <head> element:
<link rel="canonical" href="showthread.php?37-Welcome-to-78759-and-Surrounding-Areas">

Your canonical URL is relative and it looks like the concatenation of base url + canonical url is missing the joining '/'.

Letting the team know so they can look into it. Updating the title from:
Tweet button removes slash in vBulletin URL and breaks the hyperlink


Summary: forward slash is missing when a relative rel="canonical" is concatenated to the domain
Status: Acknowledged

BirdOPrey5 06-10-2011 11:49 AM

Cool. :up:

TWood 06-11-2011 04:40 PM

Heh,

I also submitted this as a bug report to vBulletin and they acknowledged the bug but downgraded it from my "Major" rating to "Minor". Not being able to let your Twitter users with a large number of followers share a link to your forum is minor?


All times are GMT. The time now is 01:00 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01209 seconds
  • Memory Usage 1,746KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete