Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Facebook / Open Graph (og:description) / (og:title) tag fixes for VB 4.1.10+ by BOP5 Details »»
Facebook / Open Graph (og:description) / (og:title) tag fixes for VB 4.1.10+ by BOP5
Version: 1.2.0, by BirdOPrey5 (Senior Member) BirdOPrey5 is offline
Developer Last Online: Aug 2023 Show Printable Version Email this Page

Category: Show Thread Enhancements - Version: 4.1.10 Rating:
Released: 11-28-2013 Last Update: 12-10-2013 Installs: 69
Supported Uses Plugins
 

Brought to you by BirdOPrey5 / Qapla.com.

For some reason vBulletin 4.x does not use the thread's meta description when populating the open graph "description" tag that is read by Facebook and other social networking sites. Instead by default vBulletin uses your site default meta description that is set in Admin CP -> Settings -> Options -> Site Name / URL / Contact Details.

This default description is usually very generic whereas the thread description is the first few sentences of the thread and therefore usually far more useful to describe the page actually being shared than your generic site description.

Also even with the Facebook Platform enabled vBulletin doesn't provide an open graph title tag at all- while in practice this isn't a big deal as Facebook will default to the page title, as a matter of good practice it should be explicitly provided.

This mod fixes both issues. It will override the generic description with the thread's meta description which is based on the text of the first post. It also adds an explicit og:title tag.

New In Version 1.2.0 - The mod now also greatly improves the open graph tag description tag for blog entries. By default the description tag is the blog title followed by the username of the blog poster. With this mod the description becomes up to a 300 character preview of the actual blog entry instead. And the open graph title tag provided takes the form of blog title Posted By username.

Blog Demo: http://www.totallycommercials.com/en...ckbuster-Video
Thread Demo: http://www.totallycommercials.com/sh...how-Commercial
(View page source or better yet, share on Facebook to see the differences. )

This mod is only for people with VB 4.1.10 or higher and only if you have the Facebook Platform enabled in your settings. It will do nothing if both of those do not apply to you.

There are no settings- just install the product and the mod is active.

To see the difference use the Facebook Debugger to look at the content scraped off a thread page before and after instillation-
Facebook Debugger is here: https://developers.facebook.com/tools/debug

------------------------------------------------------

Please "Mark as Installed" if you use this.
Donations always appreciated. :up:
Nominate MOTM if you LOVE it!

Download Now

File Type: xml product-ogdescriptitlegfixbop5.xml (1.8 KB, 316 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
5 благодарности(ей) от:
elsa23, fxdigi-cash, ozzy47, RichieBoy67, synseal

Comments
  #12  
Old 12-07-2013, 05:10 PM
sv1cec sv1cec is offline
 
Join Date: May 2004
Location: Athens, Greece
Posts: 2,091
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, I solved my Connect button issue and I made a small change to this hack, so that it covers all pages of the site. Here is the code I used.

Code:
if (THIS_SCRIPT == 'showthread')
{
  global $thread;
  $og_array['og:description'] = $thread['meta_description'];
  $og_array['og:title'] = $thread['title'];
}
else
{
  $og_array['og:title'] = "Enter the title of your site here";
}
Reply With Quote
Благодарность от:
BirdOPrey5
  #13  
Old 12-07-2013, 06:40 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by sv1cec View Post
OK, I solved my Connect button issue and I made a small change to this hack, so that it covers all pages of the site. Here is the code I used.

Code:
if (THIS_SCRIPT == 'showthread')
{
  global $thread;
  $og_array['og:description'] = $thread['meta_description'];
  $og_array['og:title'] = $thread['title'];
}
else
{
  $og_array['og:title'] = "Enter the title of your site here";
}
That may be OK for people with just the vB 4.x forum, but I would not recommend it for people with the VB 4.x Suite as Blog and CMS articles will then lose their custom titles.
Reply With Quote
  #14  
Old 12-10-2013, 08:12 AM
sv1cec sv1cec is offline
 
Join Date: May 2004
Location: Athens, Greece
Posts: 2,091
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Obviously Joe is right about this (not using my code shown above, if you are using vBSuite.

However, being the stubborn person I am, I keep trying to figure out how to fill the og: array with the proper values.

So far, here is what I have come up with:

Code:
if (THIS_SCRIPT == 'showthread')
{
  global $thread;
  $og_array['og:description'] = $thread['meta_description'];
  $og_array['og:title'] = $thread['title'];
}
if (THIS_SCRIPT == 'entry' OR THIS_SCRIPT == 'blog')
{
  global $blog, $bloginfo;
  if ($blog['message'] != "")
  {
  	$og_array['og:description'] = $blog['message'];
  }
  else
  {
	$og_array['og:description'] = "BBB";
  }
  $og_array['og:title'] = $bloginfo['title'];
}
So far, the og:title parameter is filled by the $bloginfo['title'] variable and that's a good thing. However, the og:description doesn't seem to get updated from $blog['message'].

I am using the blog_show_entry template as a guide line, and in there, it appears that the proper variable to use is indeed $blog['message'], but that is obviously not set, when the script above loads?? I do not understand.

Interestingly enough, the vbcms articles automatically get the proper og:description (the article text itself, but their title comprises of the site title and then the title of the article. I wonder if there is a way to use only the article's title.
Reply With Quote
  #15  
Old 12-11-2013, 06:29 PM
ZUCCO ZUCCO is offline
 
Join Date: Feb 2009
Posts: 241
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Looks cool, thanks
Reply With Quote
  #16  
Old 12-11-2013, 08:46 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

sv1cec, and everyone-

I went ahead and upgraded this to version 1.2.0- it now adds full support for a blog description (limited to 300 characters if need be) and a better blog title.

The blog title is now formatted "blog title Posted By username"

And the "Posted By" uses the default vBulletin phrase so it will translate to whatever language your forum uses.

I did a lot of research on using it for Articles- it does not appear worth the effort- the way Articles are coded you simply can't get the title or preview text where the facebook open graph text is built. It could be done but would likely need additional plugins- but besides that Articles have a meta description option that you can fill in yourself and if available vBulletin does use the meta description as the open graph description on Article pages.
Reply With Quote
2 благодарности(ей) от:
RichieBoy67, tbworld
  #17  
Old 12-14-2013, 12:01 PM
Spangle Spangle is offline
 
Join Date: Jun 2011
Posts: 520
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've got a 4.2.2 forum, and have just installed this, but it doesn't seem to be working, I've gone from the Thread title to the URL and from the generic meta description to nothing !

https://www.facebook.com/groups/footballounge/
Reply With Quote
  #18  
Old 12-14-2013, 02:12 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Spangle View Post
I've got a 4.2.2 forum, and have just installed this, but it doesn't seem to be working, I've gone from the Thread title to the URL and from the generic meta description to nothing !

https://www.facebook.com/groups/footballounge/
The Facebook Debugger says the problem is your Facebook Image-

https://developers.facebook.com/tool...Carroll-regret

The image must be a full absolute URL, with the http at the front, not the relative path you have.
Reply With Quote
  #19  
Old 12-14-2013, 02:39 PM
Spangle Spangle is offline
 
Join Date: Jun 2011
Posts: 520
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BirdOPrey5 View Post
The Facebook Debugger says the problem is your Facebook Image-

https://developers.facebook.com/tool...Carroll-regret

The image must be a full absolute URL, with the http at the front, not the relative path you have.
Thats fixed it thanks !
Reply With Quote
Благодарность от:
BirdOPrey5
  #20  
Old 12-14-2013, 02:39 PM
Dilldogs Dilldogs is offline
 
Join Date: May 2006
Location: Wilmington, IL
Posts: 99
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am using vb 4.1.7 is there anyway you could get this to work for 4.0 and higher?
Reply With Quote
  #21  
Old 12-14-2013, 04:59 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dilldogs View Post
I am using vb 4.1.7 is there anyway you could get this to work for 4.0 and higher?
The problem is the hook this runs on does not exist in the code until 4.1.1.0.

If You want I suppose you can add the hook manually.

You'll need to edit 2 things.

First, edit your includes/functions_facebook.php file

Find the line:
Code:
return $og_array;
And directly ABOVE that add the line:
Code:
($hook = vBulletinHook::fetch_hook('fb_opengraph_array')) ? eval($hook) : false;
Then save and re-upload the file. I suggest you rename the original on your server so you have a backup before you upload the changed file. Rename if to something like functions_facebook_old.php (make sure you keep the .php extension)

Then edit this product's .xml file before you import it to product manager.

Find:
Code:
4.1.10
and change it to

Code:
4.0.0
and save the file and import it.

It *should* work.

Also note- you'll never be able to edit the plugin in plugin manager because your vBulletin version doesn't know the hook exists and won't let you re-save the plugin in the correct hook. Not that you should have any reason to edit the plugin, just keep it in mind.
Reply With Quote
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 06:32 PM.


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.06055 seconds
  • Memory Usage 2,363KB
  • Queries Executed 28 (?)
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
  • (7)bbcode_code
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (9)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)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
  • 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_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete