Feddit

Feddit is a WordPress plugin meant to emulate the functionality of Reddit on a WordPress website.

Background

The idea came from the fallout of the first wave of Reddit censorship. Reddit had already banned subreddits before that were illegal like movie download subs and then in 2013/4 it started banning subs that were borderline illegal like /r/jailbait or /r/the_fappening. Then in 2015 they started banning a bunch of other subs that weren’t illegal at all, but rather just unsavoury and unprofitable. Reddit wanted to become the next big social media platform, and it couldn’t attract advertisers with the baggage that these communities brought with them.

So in response a lot of people moved over to Voat but it got promptly hugged to death by the massive influx of people wanting to discuss taboo subjects and trolls who wanted these discussions censored even on websites they never had to visit.

Because of this, I decided to make a WordPress plugin that converts the functionality of WP posts into something a bit more akin to how Reddit works, to use it as a website fallback in case these larger websites break down. It never really got to this point since Voat stabilised after a while and people lost interest in the project.

About Feddit

Feddit takes the WordPress post/comment structure and makes it mirror the Reddit post/comment structure. To do this, it creates a custom post type called a “Feddit”. These are WordPress posts that can have links, images and text, and most importantly, they can be voted.

A user can register an account and make a post. This post is then voted on and then ranked based on its vote count and its age. This makes it arrange posts in a chronological order that can be superseded by getting a lot of votes. The key to doing this is by using the right algorithm.

The Feddit algorithm

This image explains how the algorithm works:

Basically, it’s a horizontally flipped exponential function that decreases over time. When someone votes, the graph is shifted upwards. Eventually the time decay will overrun the even a large amount of votes, so there’s always a fresh batch of posts coming though.

Here’s the code that determines the algorithm. It’s a bit messy since it’s a SQL query that is interspliced with WP PHP calls.

function feddit_algorithm_order (){
	global $wpdb;
	$order = "(".get_option("alg_init_str", 100)."+(".get_option("alg_vote_str", 10)."*COALESCE(SUM(".$wpdb->prefix."votes.upvote),0)))";
	$order.="*";
	$order.= "(POWER(".(get_option("alg_decay", 100)/100).",".(-1/get_option("exp_buffer", 1000000))."*(UNIX_TIMESTAMP()-UNIX_TIMESTAMP(".$wpdb->prefix."posts.post_date_gmt))))";
	$order.=" DESC";
	return $order;
}

Simplified:

(initial_strength+vote_strength*vote_count)
*
decay_coefficient^(-1/exp_buffer * post_age)

Each of these variables can be modified by an admin to fine tune how posts start off and decay over time.

Gallery

Here are some admin pages showing the customisability.

Unfortunately, this is a pretty old plugin and it was giving me trouble to even display this, so I couldn’t get the front end of the Feddit application working. Especially considering that it’s on a completely different version of PHP and WordPress compared to 2015.

Source code

You can get the source code from my Gitlab page.

Search

Subscribe to the mailing list

Follow N64 Squid

  • RSS Feed
  • YouTube

Random featured posts