Simple "Like" button

Creating and modifying plugins.
Post Reply
perlnerd
Regular
Posts: 37
Joined: Mon Mar 27, 2006 11:02 pm

Simple "Like" button

Post by perlnerd »

I'd like to have a plugin that allows people viewing a blog post to "Like" it. This doesn't have anything to do with facebook. It would be internal to the blog.

I've looked at the Karma plugin, but it does way more than I need. What I want is the person viewing the post clicks "Like", total # of likes for an entry are stored in a DB table, and a cookie is set to discourage ballot box stuffing. Total number of "likes" are displayed at the bottom or top of the post.

Anyone got a similar plugin? Any tips on how I could trim down the Karma plugin to do what I want?

Thanks!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Simple "Like" button

Post by garvinhicking »

Hi!

Hm, you could use CSS to simply hide the other voting options from karma plugin so that only your "like" remains?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
perlnerd
Regular
Posts: 37
Joined: Mon Mar 27, 2006 11:02 pm

Re: Simple "Like" button

Post by perlnerd »

Thanks Garvin.

I have made a copy of the karma plugin and hacked it to simply display a "Like" button.

There are a couple of issues:

I'd like to put the button in a different spot on the page. Specifically at the top of the entry near the Title and author, etc. How would I do this?

I don't want to stop others from liking an article immediately after someone else so I set "Minimum Voting Interval" to 0. I have noticed though that if I reload the page immediately after voting it adds another vote. Is there a way to stop a visitor from flooding it in this way?

Thanks!
perlnerd
Regular
Posts: 37
Joined: Mon Mar 27, 2006 11:02 pm

Re: Simple "Like" button

Post by perlnerd »

Also, I've noticed that a non logged in user can "Like" an entry every time they visit it. Is there not something in place to stop this?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Simple "Like" button

Post by garvinhicking »

Hi!

You need to set the voting interval to something like "1". "0" effectively disables it I think.

The karma plugin should be positionable through a custom smarty variable; I don't have my testing environment online right now, but I believe there's a config option for it? Then you could edit the entries.tpl template to plate something like {$entry.properties.karma} or whatever where you like it. If there's no option, you can only move the whole {$entry.plugin_display_dat} to the place you need and maybe utlize CSS for final positioning.
perlnerd wrote:Also, I've noticed that a non logged in user can "Like" an entry every time they visit it. Is there not something in place to stop this?
This shouldn't happen; karma voting is saved inside a cookie. Check if your browser accepts cookies? Also maybe check with an unmodified karma plugin to see if your editing might have caused something like that?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply