How to get number of total likes on post | blog ?

Play True Posted in General Discussion 6 months ago

I was trying to find this all day long, help please

us Bansh33 - Replied 5 months ago

php is not a strongly typed language, meaning you don't have to explicitly declare variables of type int, bool, char, etc.

in that example Arsalan gave, $likes is an object of the class OssnLikes (if you don't understand what this means, familiarize yourself with the basics of object oriented programming).

the OssnLikes->GetLikes() function returns a list of everybody who liked the item (and various other info) referred to by [guid]. you can output all the info with a var_dump() if you want to see exactly what's returned. if you just want the number of likes, use the OssnLikes->CountLikes() function instead (this function really just calls GetLikes() and and then counts the entries anyway).

you might want to look through components/OssnLikes/classes/OssnLikes.php to get a better idea of how it works. or, if you want to hire a coder to help you out with whatever you need to do, feel free to email me (info in my profile).

by Play True Replied 6 months ago

So , as i understood , this'll give me an ?boolean? , how can i convert this to a number. I have never work with php, until this moment, so i curious about this

German Arsalan Shah Replied 6 months ago

I am assuming you are a developer, ... blogs likes are based on entity so if you know blog_entity guid then

$likes = new OssnLikes();
$list  = $likes->GetLikes([guid], 'entity');