Jump to content

vBulletin Like Button System


HelloKaty
 Share

Recommended Posts

It sounds like the new system probably isn't saving data the same way as the old system. I'm not sure if you're trying to do that, to have the new system use the old database, or if you're saving the data in a new place and then trying to update the statistics page to look in the new place. The template code doesn't really help though, those template tags get replaced with HTML and Javascript content that would do the actual work. The code from the template isn't what gets sent to the browser, it goes through a template engine to get converted to HTML first. If you're trying to get the new system to use the old database then you need to find out what this turns into:

 

{$vbphrase[dbtech_thanks_post_thanks_like]}

 

It's going to be a link or something, maybe something with some Javascript to send an ajax request. You'll need to figure out which PHP script that sends data to, and what data it sends, and update the new system to send the same data to the same place. Is that what you're trying to do?

Link to comment
Share on other sites

The easiest way would be to use your browser's developer tools to inspect the actual rendered element on the page, and see what it is. You can also look for ajax requests when you click it to see what data gets sent to the server (I assume it's an ajax request and that the page doesn't refresh). The request is the important part. It probably sends something like a post ID and the button type (like, dislike, etc). The PHP page that handles the ajax request would get the post ID and button type, look up the current user, and add the information to the database. Once you know which PHP page handles the request then you can look at the code there to see what it does with the data. The easiest way would be to set up your button to send the same data to the same page, then it will handle everything the same way.

  • Like 1
Link to comment
Share on other sites

require(DIR . '/dbtech/thanks/hooks/statistics.php');

That's just a require statement, that just includes the code in another file to execute. You can look in that statistics.php file if you want to see the code that it's running. A require statement itself doesn't do anything except run code from another file.

 

I would focus on emulating the buttons that they already use. The Javascript code attaches event handlers to dbtech_thanks_button, so you need to use the same name for your links. It looks like it has attributes for data-button that indicate what kind of button it is, and data-postid that has the post ID in it. If you create links with the same name and the same attributes with the button type and post ID, then it should work the same way. The ajax request submits to a file called thanks.php, so you can look at the code in there if you want to see what it does with the button type and post ID. That's the file that updates the database.

  • Like 1
Link to comment
Share on other sites

I doubt you need to edit the CSS rules, CSS just defines how things look. That particular rule is for the background image. I don't know if you want to change that or not, I guess you can change it if you want the button to look different. I can't really tell you exactly what to change, I'm not familiar with the software you're using. The end goal is to produce HTML that has the same names and attributes as the HTML you're trying to replace.

  • Like 1
Link to comment
Share on other sites

The tooltip text makes it seem like that's where the HTML would go, although the if statements don't really make sense with that. Maybe $post[likes] contains the HTML code for the like button rather than the number of likes, it looks like just a number though. You can try adding some HTML code to that section to see if it appears in the area with the like buttons though. If so, then that's the right place. There's another section lower down that uses $post[likeshtml] and things like that, but it looks like it only shows those if the post has likes, which wouldn't make sense for a button. You might want to add something to that area also and see where that shows up on the page.

  • Like 1
Link to comment
Share on other sites

The tooltip text makes it seem like that's where the HTML would go, although the if statements don't really make sense with that. Maybe $post[likes] contains the HTML code for the like button rather than the number of likes, it looks like just a number though. You can try adding some HTML code to that section to see if it appears in the area with the like buttons though. If so, then that's the right place. There's another section lower down that uses $post[likeshtml] and things like that, but it looks like it only shows those if the post has likes, which wouldn't make sense for a button. You might want to add something to that area also and see where that shows up on the page.

I've tried putting

 

ZXw96iV.png

 

beside some different places (including those you mentioned) and nothing seemed to change. :(

Any other suggestions?

Edited by HelloKaty
Link to comment
Share on other sites

You'll need more than just that, you might not see that do anything on the page, it's just the start of a link element. Just add some regular text that you can look for on the page, you can even test the post ID. e.g.:

 

<span style="font-weight: bold; font-size: 200%;">Test for post ID {$post[postid]}</span>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...