Upvote/downvote hook?

Solved3.33K viewsCore
0

Hello, could you please advise how can I add an additional action towards the end of the upvote/downvote action? I.e. I have created a custom field for each user, Guru Points (different from reputation points), and when someone upvote (Anspress default function) an answer under some pre-defined question categories, Guru Points will be added.

Thanks in advance.

0

Hello,

All you need is this action hook:

https://github.com/anspress/anspress/blob/master/includes/votes.php#L512

commented on answer

Hello Rahul,

Sorry, what if I just want to apply the action to answer’s upvote (exclude question upvote)?

Got the answer to my question. Just need to get ‘post’ object and check for post_type.