PDA

View Full Version : Facebook like button in first post


ROTPAR
03-01-2013, 08:00 AM
Hi, I would like to put the facebook like button on top of the first posting, so beneath the title or at the end of the first post instead of having it on top of the whole thread. How can I do that?

ROTPAR
03-02-2013, 09:15 PM
nobody?

ROTPAR
03-05-2013, 09:41 PM
ok, last try....can nobody hlep me out with this?

findingpeace
03-06-2013, 12:42 AM
Hi ROTPAR - looks like a template edit to me. In SHOWTHREAD, find:

<vb:if condition="$show['fb_likebutton']">
{vb:raw fblikebutton}
</vb:if>

And put it in postbit. You'll probably need a conditional for post # in thread == 1, otherwise it'll show in/under every post

ROTPAR
03-06-2013, 09:10 AM
Hi there, thank you :) What do you mean with the condition? What do I have to write? Thanks a lot :)

findingpeace
03-06-2013, 10:49 AM
Hmm, this may sort of be like the blind leading the blind, but let me give it a shot :)

Try this in postbit_legacy and let me know how it works:

<if condition="$post[postcount] % $vboptions[maxposts] == 1">

<vb:if condition="$show['fb_likebutton']">
{vb:raw fblikebutton}
</vb:if>

</vb:if>

Within postbit_legacy, just search around for a good spot (like maybe after the infractions link?) Or maybe after this part:

<vb:if condition="$post['title'] OR $show['messageicon']">
<h2 class="title icon">
<vb:if condition="$show['messageicon']"><img src="{vb:raw post.iconpath}" alt="{vb:raw post.icontitle}" /> </vb:if>{vb:raw post.title}
</h2>
</vb:if>

By the way, there is another conditional called <vb:if condition="$post['isfirstshown']">, but I think that's going to repeat for each page, so try the first one and let me know if that works okay

ROTPAR
03-07-2013, 01:40 PM
<if condition="$post[postcount] % $vboptions[maxposts] == 1">

<vb:if condition="$show['fb_likebutton']">
{vb:raw fblikebutton}
</vb:if>

</vb:if>

THX :) After placing this code in postbit_legacy vbulletin tells me that the code is not ok... can'T translate it. Any ideas?

findingpeace
03-07-2013, 01:53 PM
Hmm, can you try this instead:

<vb:if condition="$post['isfirstshown']">

<vb:if condition="$show['fb_likebutton']">
{vb:raw fblikebutton}
</vb:if>

</vb:if>

This will show on the first post of each page, but I'm sure we can figure out a way to ensure only page 1 :) I just want to make sure it's the conditional breaking, not anything else. So let me know if that works!

If it doesn't, we may need to register fblikebutton to postbit_legacy, in which case you're going to want the help of someone who understands hooks :)

ROTPAR
03-07-2013, 02:16 PM
To get it on the first port, I tried this:
http://www.vbulletin.com/forum/forum/vbulletin-4/vbulletin-4-questions-problems-and-troubleshooting/423148-easiest-waay-to-add-fb-like-button?

but placing the likebutton code in there, shows just nothing

--------------- Added 1362670983 at 1362670983 ---------------

the problem seems to be this code:

<vb:if condition="$show['fb_likebutton']">
{vb:raw fblikebutton}
</vb:if>

This code does not work in postbit_legacy....how could I get it to work there?

Lynne
03-07-2013, 03:32 PM
Unless you write a plugin to register the variable $fblikebutton to the template postbit_legacy, it isn't going to spit anything out.

Cellarius wrote a really good article that you may be interested in - [vB4] Rendering templates and registering variables - a short guide (https://vborg.vbsupport.ru/showthread.php?t=228078)

ROTPAR
03-08-2013, 06:05 AM
Thank you Lynne, the problem is, that I am not that good in programming, I can copy and paste some stuff but that's it. Is there anybody who could explain how to register this variable?

Lynne
03-08-2013, 05:49 PM
He tells you the line right at the end of the article.

vB_Template::preRegister('postbit',array('fblikebu tton ' => $fblikebutton));

ROTPAR
03-08-2013, 06:11 PM
Thank you for your help Lynne and please don't mind but I just don'T understand where I have to put this code, I am not a coder :( Sorry for bothering.

Lynne
03-09-2013, 07:00 PM
You would need to put it in a plugin - one that is right after the variable is defined - perhaps the showthread_complete hook location would work.

ROTPAR
03-11-2013, 02:13 PM
Hmmm, can anybody tell me step by step what I have to put where please?

Simon Lloyd
03-11-2013, 03:01 PM
Why not just use the ad location template for first post?

Lynne
03-11-2013, 05:55 PM
The manual talks about plugins here - http://www.vbulletin.com/docs/html/plugin_system?manualversion=40200603 And more specifically, adding a plugin here - http://www.vbulletin.com/docs/html/add_plugin?manualversion=40200603

ROTPAR
03-11-2013, 09:41 PM
OK I hope I can do that, Thank you Lynne.

@Simon
it doesn't work with the vbulletin variable in the ad location and I don'T want to use an own iframe solution what works independent from the boards options.

--------------- Added 1363075622 at 1363075622 ---------------

I give it up. Can anybody tell me please what I have to put in the plugin to get this done? I guess there are just some lines of code. I am not a programmer and I really need this :(