Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-26-2016, 06:39 PM
JamesAB JamesAB is offline
 
Join Date: Dec 2003
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Tweet button for every post?

Has anyone done a simple plugin or mod to add a tweet button for every post? Basically a button that open a new window so user's can tweet that post's URL and tread title from their own twitter account.

I need something that works with VB3.8

I don't want to start from scratch if this is already available.

Thanks,
James
Reply With Quote
  #2  
Old 05-26-2016, 10:11 PM
greigeh greigeh is offline
 
Join Date: Jan 2015
Posts: 113
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

<a href="https://vborg.vbsupport.ru/showthread.php?t=248568" target="_blank">https://vborg.vbsupport.ru/showthread.php?t=248568</a> came up in similar threads, this is dated back to 2012 so can imagine it is out of date, but using the correct twitter URL/if conditions can imagine this is easily done.
Reply With Quote
Благодарность от:
blind-eddie
  #3  
Old 05-28-2016, 11:00 AM
JamesAB JamesAB is offline
 
Join Date: Dec 2003
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks. That's a good start, however Twitter has changed their API so now I need to make some adjustments.

I guess fist I need to find a plugin location where I can grab the thread title and post URL and make these two variables URL encoded. Then I can form a valid URL to link to create a Twitter Tweet Web Intent link to place in the postbit template.

Any suggestions for the best place to create these two URL encoded variables?
Reply With Quote
Благодарность от:
greigeh
  #4  
Old 05-29-2016, 11:36 PM
PinkMilk PinkMilk is offline
 
Join Date: May 2010
Location: Earth
Posts: 193
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok so this is what I got...

Code:
<a href="https://twitter.com/share?url=$vboptions[bburl]/showpost.php?$session[sessionurl]p=$post[postid]&amp;postcount=$post[postcount]&text=$thread[title]" target="_blank">Tweet</a>

Add anywhere in postbit/postbit_legacy template should work.

Breakdown

The single post page link:
Code:
$vboptions[bburl]/showpost.php?$session[sessionurl]p=$post[postid]&amp;postcount=$post[postcount]
Thread title variable:
Code:
$thread[title]
target blank to open in new window:
Code:
target="_blank"
Attached Images
File Type: jpg On each post.jpg (129.4 KB, 0 views)
File Type: jpg Tweet page.jpg (107.6 KB, 0 views)
Reply With Quote
Благодарность от:
greigeh
  #5  
Old 06-22-2016, 10:51 AM
Mattwhf Mattwhf is offline
 
Join Date: May 2016
Posts: 190
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by PinkMilk View Post
Ok so this is what I got...

Code:
<a href="https://twitter.com/share?url=$vboptions[bburl]/showpost.php?$session[sessionurl]p=$post[postid]&amp;postcount=$post[postcount]&text=$thread[title]" target="_blank">Tweet</a>

Add anywhere in postbit/postbit_legacy template should work.

Breakdown

The single post page link:
Code:
$vboptions[bburl]/showpost.php?$session[sessionurl]p=$post[postid]&amp;postcount=$post[postcount]
Thread title variable:
Code:
$thread[title]
target blank to open in new window:
Code:
target="_blank"
If I put this in sidebar it can run for all forum pages?
Reply With Quote
  #6  
Old 06-23-2016, 06:38 AM
PinkMilk PinkMilk is offline
 
Join Date: May 2010
Location: Earth
Posts: 193
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No the above code is for individual posts, for a single link to showthread page you would need something like this:

Code:
<a href="https://twitter.com/share?url=$vboptions[bburl]/showthread.php?t=$threadinfo[threadid]&text=$thread[title]" target="_blank">Tweet</a>
This would normally be added to SHOWTHREAD template, however if you want it in a sidebar which I'm guessing is on everypage you would need to wrap it in a conditional so it only shows on a showthead page.

Code:
<if condition="THIS_SCRIPT == 'SHOWTHREAD'">
<a href="https://twitter.com/share?url=$vboptions[bburl]/showthread.php?t=$threadinfo[threadid]&text=$thread[title]" target="_blank">Tweet</a>
</if>
----------------------------------------------------

Update:

Just re-read you post and sounds more like you just want a basic tweet button this would be done using:
Code:
<a href="https://twitter.com/share?url=$vboptions[bburl]/&text=$vboptions[bbtitle]" target="_blank">Tweet</a>
However it will just post your forum url and title.
Reply With Quote
Благодарность от:
blind-eddie
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:16 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03959 seconds
  • Memory Usage 2,251KB
  • Queries Executed 14 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (11)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (4)post_thanks_box_bit
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (2)postbit_attachment
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_attachment
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete