Reddit style extension - Topic Upvotes

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
MedricCedric
Registered User
Posts: 23
Joined: Thu Apr 28, 2022 9:19 am

Reddit style extension - Topic Upvotes

Post by MedricCedric »

I am a beginner in mysql/php but feel tackling this extension could be great. As my site is now live but I feel it absolutely needs this add on.

So I am going to develop an add on but hopefully lean quite a lot on this community.
This is the end product I want to accomplish of being able to vote on Topics (not comments on threads just yet)
Untitled.png
To begin I believe I need to modify the topics table to the following

Code: Select all

ALTER TABLE phpbb_topics  
ADD topics_upvotes int default 0 ;
I would then need to create a table titled upvotes
with the following columns
id / topic_id / posts_id / state

Is that enough or is there something I've missed? The State would be an int with 0 representing not voted on, 1 representing upvoted and 2 representing downvoted.

Ok - presumably I've not missed anything from the SQL I'll move onto next bit.

For php I would create a class-function to echo the up arrow, the upvote number and the downvote arrow
$o_Upvotes = new class_Upvotes();
$o_Upvotes->Display_UpvoteArrow($State) ;
$o_Upvotes->Display_UpvoteNumber($State) ;
$o_Upvotes->Display_DownvoteNumber($State) ;

Upon calling Display_UpvoteArrow() function it would present the correct upvote arrow colour depending on the $State and then echo out a <div> tag etc.

I would then handle the function of cilcking the upvote/downvote arrow by a javascript script

My question is - is this method so far easy enough to turn into an add on for phpbb?
aknctn
Registered User
Posts: 126
Joined: Fri May 03, 2019 2:10 pm

Re: Reddit style extension - Topic Upvotes

Post by aknctn »

and then?
Post Reply

Return to “Extension Writers Discussion”