Using WordPress As A Pay-For-Access System

If you use WordPress, and are looking for an easy way to make your site pay-per-access, or subscription based, there is a handy, built-in way to accomplish this using only a few lines of code! If you don’t use WordPress, you should, because it is such an adaptable CMS that it can be used for almost any situation.

Recently, I was looking for a way to start charging a monthly fee for my schoolwork reference site, using my fantastic payments processor 2Checkout. Using just built-in WordPress functions, I now have a working credits system that automatically gives new users a five-day trial, after which they are automatically directed to a billing page, which then grants them unlimited access upon successful payment. All of this was accomplished using the update_user_meta and get_user_meta functions, without having to fool around with any database connections or SQL. All it takes is one include statement in your theme, and a bit of PHP magic to call the meta functions.

It’s quite simple really, but it saved much time from having to create the system from scratch. WordPress even has excellent built-in user management and roles, so managing access from different users is a breeze! If anyone is interested, the entire site is up on GitHub (interesting bit here). There is also an example below.

On another note, this is similar to the method I used recently setting up a complete client-consultant video chat system for Mohamedali Urology, using WordPress and the OpenTok API for the video infrastructure.

Hopefully someone finds this useful!

3 Comments on “Using WordPress As A Pay-For-Access System

  1. Pingback: SATs, MIT, jTwitterScraper and... Victorian Twins? - Yasyf Mohamedali's Blog

  2. very good Mr. Yasyf…really clean and nice code. Thanks! I love the good indentation in the many if-then loops; makes it much clearer (I am new to php).

  3. Really nice write-up with great info.

    I was wanting to check out your site on GitHub but the link directs to a 404 page.

Leave a Reply

%d bloggers like this: