Using Zombaio with WordPress, A WordPress Plugin

Zombaio Logo

Building on my work at Your Members, specifically the Adult Payment Gateway Zombaio, I’ve finally gotten around to building a better “recommended WordPress Plugin”.
As the one on Zombaio’s site is little more than a nasty hack sitting in front of WordPress without using any WordPress functions or its Database Abstraction Layer, (it’s using Raw Database functions and is not very WordPress’y at all).

It has now been released (current version at time of writing is V1.0.4) and made available via WordPress extend called WP-Zombaio.

What does the Plugin do?

Logs

Essentially the plugin listens for ping backs for the Payment Gateway and responds accordingly, creating or deleting the user, using the details passed back from Zombaio, and logging the full result for later reference.

Installing the plugin first guides you thru a easy to use install procedure, meaning no fiddly file editing, or trying to setup and understand ZScript.

Just download, unzip, upload and activate.
Nip thru the (optional) four step quick start wizard and away, you, go!

It’s a Wizard Harry
Settings all Done

In addition to the quick setup and user create/delete, the plugin provides a few short codes and widgets, to direct the user from your site off to the Zombaio Join Form and back again.

ShortCodes and Widgets!

Guide

Included in the plugin is a guide, which describes how to setup and use all the features as well as general information about running a Membership Site and getting the most out of the plugin. Especially the Zombaio Seal, which can be a little fiddly to get the code for.

Getting the Seal Code

Security and Access Control

On top of the basic functionality, is included a method to block non members from accessing the site and providing a Splash Page/adult content warning page, meaning no need for additional plugins required to do this, saving you overhead. All guests are redirected to this page, so content is protected!

A Basic Landing Page

As well as this, included in the plugin is the ability to create a menu to show to logged out users that is different to logged in users, in case your theme doesn’t provide this.

Menus

To top it all, the plugin is designed to run your WordPress site with “Anyone can Register” disabled, meaning the only way users can join is via the Zombaio Payment Form, and this means users/members have paid for access.

What is Coming Next?

I’m currently working on a update, which includes credit purchase, and the spending of credits on access to posts/pages, (this can be configured to be timed access, for Live Broadcasts/Webcam Events, or permanent access, like a image gallery), again helpful instructions and information is included in the guide on how to setup and use these features.

(The update is currently in beta testing to a couple of users who have contacted me about the plugin, but you can always grab the SVN trunk/current build and give the current credits implementation a go! You can grab this from Extend, no guarantee that it is stable or safe to use in production/live, you can get it from the WP Zombaio Developers Tab)

Suddenly Graphs

In addition I’m adding graphs and reporting data, to supplement the Zombaio Graphs and reporting to help Admins set how their site is doing. And showing what users are spending their credits on, and how many unspent credits are in the user kitty!

During the development of the next version, to fully support credit purchase in a admin easy to setup and use method, further development time is needed to create a little form builder, as there are several options, which can be difficult to easily describe using just WordPress short code Arguments, hence this blog post is talking about the current release and not about the next release including credits!).

So I shall finish this blog post off quickly and get back to finishing off the next version!

Can I see more Screenshots?

Sure, just pop over to the WordPress Extend page, there are a few more there!

Where can I get it

You can check out the Plugin here on the site, or over on Extend.

I need Help!

If you have any suggestions, feature requests or need help setting up and using the plugin, please do not hesitate to drop me a line, and I’ll be able to give you a hand and get you up and running!

I’d like to Donate

Cool! I put a quick an easy PayPal button on the local WP Zombaio Page for you!

LinkDAQ

Photo credit - petrick : http://www.flickr.com/photos/petrick/70924598/sizes/z/in/photostream/

From the Desk of Dom “The Hodge” Hodgson comes something he built in a day, LinkDAQ.

Like the old BBC Celebdaq, its a “Stock” Trading Game, but instead of trading stocks and shares, you are trading links.

In this case the Cost to invest in a link is linked to the number of other sites that link to that site.
So a site such as Facebook.com and Twitter.com, which are linked to from lots of other sites, rank highly and cost more, in comparison to other sites, such as my own.

It’s using data provided by Majestic SEO. To quote the site:

We use the top 50,000 websites from the MajesticSEO Million dataset, this lists the top sites as ordered by links from unique i.p. addresses, we take this information and use a simple formula to give each domain a daily price.

Going to play it for a couple of days to see where it goes, and how things pan out, come and join me if you fancy it! So far I’m down about $600 on my initial investments, but we shall see what happens tomorrow!

For something built in a mere 24 hours its rather good, and it uses Twitter Bootstrap for it’s Framework, and it has a legitimate use of the good old HTML Marquee tag! And Dom should be pushing out updates and things to the site, and tweaking the algorithm.

You can also follow the developments on Twitter @linkDAQ and @TheHodge

There is also a TimeLapse video of the code being written:

My CV and some other Updates

Just a quick post to say hello.

I’ve updated my CV and tidied it up a little.
So any feedback on it would be useful! (Drop Me a Line rather than a Comment please)
Link in the SideBar on the right!

I should really write on my blog some more, but not a lot to write about of late.
JetPack Extras is doing OK, but JetPack core decided to implement the main feature I added, that being Pinterest but, Extras has evolved, it still of course has the ability to control button placement and has the extra Twitter Via/Related options, and the ability to share the WP.me shortened URL, makes a nice Twitter Card, embedding a short Preview of the Post with the Tweet, (check this Meta Tweet for an example) works with any wp.me url you share on Twitter by the way!

Most useful, mainly updated to keep up with JetPack core and use the new shiny hooks they have.
You can check it out on extend. Feedback/request are always Welcome!

Made a couple of tweaks and updates to the Blog in the background, added a better 404 page and updated the .htaccess rules, I have all subdomains pointing to the here, (unless their is a separate to show), so its a good idea to redirect non sites to here, rather than duplicating the content.
Also tweaked the Root .htaccess to have a Error Document (404) since it was just standard Apache Error, bit nasty, but now better, LOLCATS TO THE RESCUE! 😀

Heres a extract of the rules, if you find it useful/handy:

RewriteEngine on

RewriteCond %{HTTP_HOST} !^barrycarlyon.co.uk  
RewriteRule ^(.*)$ http://barrycarlyon.co.uk/%{REQUEST_URI} [R=301,L]
ErrorDocument 404 http://barrycarlyon.co.uk/wordpress/404-2/
ErrorDocument 403 http://barrycarlyon.co.uk/wordpress/404-2/

Next thing to do, is probably update and replace the MineCraft Server Site probably using Twitter Bootstrap as a new basis. It’s now a whitelisted server for Armchair Heroes or on Facebook, but of late I’ve been getting my MineCraft fix playing over at PhantomCraft, like a lot of open Servers I tend to get robbed/cleaned out and griefed a lot, but then again I am a little close to spawn. It’s a fun server to play on and the regulars are quite nice.

Hopefully moving further away when I get a chance to play some more, thinks are pretty busy at the moment between Magento fun at Day Job and Freshers Fun at the Union.

Then I really should get the Portfolio page on the Blog fixed up to showcase what I’ve done before, since I am a Freelance Web Developer (you got any work going or want a quote for? (Drop me a line)

So a couple more weeks and we’ll be back to the usual grind.
Hopefully I will have more to write about soon!

Extra Jetpack!

So recently I’ve been mucking about with JetPack, for various bits and pieces.

Mainly the first thing done is just to make the sharing buttons appear above and below a post.

But from browsing the JetPack Support Forum over on extend I thought I’d make my changes available.

So, attached to this post, is my modified version of JetPack 1.4.2.

Which includes the following additions:

  • Ability to control button placement, above, below, or both of the post content
  • A Pinterest PinIt Button as requested on the forum, it will attempt to use the Post/Page Featured Image as the Image to Pin
  • Additional Twitter button elements/arguments, for recommended Twitter account following (via and related)
  • Ability to turn on/off the DNT Twitter button mode: see the docs, about what this is and does
  • Hope you find it useful.

    If using JetPack 1.6.1 use the Extend Version
    [download#4] Pre JetPack 1.6
    [download#3]

    Feedback and requests in the comments please 😀 or hit me up on Twitter: @BarryCarlyon

    (On a side note, I need to fix some theme glitches on here, hence a double featured image on the home page….)

    Update: Make sure your theme is using a recent version of jQuery. As otherwise the [+ Share] won’t pop up (for extra hidden sharing buttons)

    Update: Created a new Plugin, that doesn’t replace JetPack, it extends and runs as a separate plugin.
    So more Core JetPack update friendly. Upload and activate like a normal plugin.
    Includes a suggestion from @SkipTweets Option to use the WP.me link instead of the permalink for Twitter Sharing

    Update: The plugin is now available on extend!

    Update: JetPack Core has now updated to 1.6.1 which adds a Pinterest Button to Core. They also updated the entire ShareDaddy plugin. It looks like they are adding Twitter Via Support to.
    I’ve just released a Maintenance Fix as if you Update JetPack, it WhitePages, due to conflicting Pinterest Buttons.

    Update: Check out the Special Plugin Page

MineCraft Math

So, I tend to now and again do random bits and pieces to MineCraft Servers.

Of late I have been working with ZimDoorCraft, took the existing relatively static site, and flipped it over to a Mini PHP Powered Content Management System, that I wrote and roll out to smaller sites.
Couple of MySQL powered bits to make updates easier (Staff list and the like).

In time more complex and interesting things will be added (it was for a while running a Login with Mojang/MineCraft account, but that means you type your MineCraft login into the site…), how that works is a subject for another post. As is what ever I build next 😀

The MineCraft server in this case is running a derivative of Bukkit, which means it supports plugins, so we are using the JSON Api plugin, and making a call to the getWorld() data resource.
Which passes back information about the world in a nice handy format.

Heres an example

    [world] => stdClass Object
        (
            [remainingWeatherTicks] => 14670
            [hasStorm] => 
            [time] => 4964
            [environment] => normal
            [isThundering] => 
            [name] => world
            [fullTime] => 2903932964
        )

If your running Vanilla you can grab the same information just by decoding the level.dat file in the World Directory, however opening a file currently being written to, is not often a good idea, and the level.dat is written to a lot.

Like a lot of games, Minecraft uses ticks, in this case operating at 20 ticks per second, and running to 24000 ticks per Minecraft day, which means a Minecraft day is about 20mins.

Just to be interesting 0 ticks is Sunrise, rather than midnight. And midnight itself is 18000 ticks.

Also contained in the data packet is a count down to when the weather changes, in this case there are 7500 (ish) ticks to go.

Which works out as

14670 / 20 to get Real Seconds = 733.5 Seconds, and then its arbitrary to flip this to a human readable time. We have about 12 minutes, or half a MineCraft day, until the weather changes.

Reading out a more recent packet

    [world] => stdClass Object
        (
            [remainingWeatherTicks] => 7339
            [hasStorm] => 1
            [time] => 3827
            [environment] => normal
            [isThundering] => 
            [name] => world
            [fullTime] => 3902379827
        )

Looks like there is a storm on…. But its only Rain no Thunder and Lighting. With 6 mins to go.

On a side note!, watch out for FullTime, as its likely to run away, on a long running server, to something a 32 bit system might not be able to handle! Refer to my Post on Facebook and the Order ID on some thoughts about dealing with that.


Using Tick to Seconds math, means that it is also possible to display the current server time and weather on the website.

I’m using a bit of CSS, and the MineCraft time piece (craftable in game) to show the current time visually. In this case I’ve taken the 16×16 PNG’s and expanded them (by hand) to 32×32, finally converting the time from ticks to the relevant chunk of 360 degrees, offsetting as needed to account for the fact that Sunrise is 0 instead of Midnight.

I do this by adding 6000 ticks and from there treating the ticks complete as a percentage and scaling to meet 360 degrees. Some of the code involved needs a little tweaking and tidying to improve efficiency, but the angle is being calculated by a CRON Job powered script and stored with the full World JSON packet, in an extended object and cached in a file on the file system ready to be read by the web server when a request comes in. So it’s not a top priority to clean up yet.

I was finding that after taking into account the addition 6000 ticks to offset for Sunrise, the whole Sun Moon picture was upside down. So I just added 180 degrees, and corrected it when the angle was greater that 360. Since why bother rotating thru a whole 360 degrees?


$time = $world->time;// grab from data packet from JSON Api Call
$time += 6000;// add 600 for sunrise

// work out the scale factor 360 degrees / ticks in a Minecraft day
$scale = 360 / 24000;
$angle = $scale * $time;// calculate the <span class="hiddenGrammarError" pre=""><span class="hiddenGrammarError" pre=""><span class="hiddenGrammarError" pre="">angle
$angle</span></span></span> = number_format($angle, 0);// clean up
// correct
$angle = $angle + 180;// the image is upside down :-(
if ($angle >= 360) {// clean up again
	$angle -= 360;
}

The rotation component was quite difficult to initially decide how to do, PHP wasn’t quite cutting it so switched to a CSS Transform.
HTML wise it consists of a pair of divs, a pair of images, and a chunk of CSS.

<div class="worldtime"><div class="inner"></div></div>


WorldTime being the one behind contains the Sun Moon Picture as a background image.


And Inner contains the Watch overlay also as a background image.

Apply the CSS transformation to rotate the Sun Moon Picture is just a little nasty, because in rotating the Sun Moon picture it also rotated the overlay (inner).
I decided to apply rotation to the overlay, in the reverse direction (so just sticking a negative sign in front).
Works quite well, but if you can think of a better way to spit out this with the rotation please comment below.

Heres my current Style Code

<style type="text/css">
	.worldtime .inner {
		width: 32px;
		height: 32px;
		background: url('large_watch.png') left top no-repeat;
	    /* CSS3 then proprietary code */
	    rotation: -336deg;
	    -webkit-transform: rotate(-336deg);
	    -moz-transform: rotate(-336deg);
	    filter: progid: DXImageTransform.Microsoft.BasicImage(-rotation=4);
	}
	.worldtime {
		float: left;
		width: 32px;
		height: 32px;
		margin: 0 10px;
		background: url('large_inner.png') left top no-repeat;
	    /* CSS3 then proprietary code */
	    rotation: 336deg;
	    -webkit-transform: rotate(336deg);
	    -moz-transform: rotate(336deg);
	    filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=4);
	}
</style>

The whole WorldTime Div is then wrapped in another Div and jQuery used to once per minute go and fetch the updated time, weather and CSS rotation.

At first I did try using the PHP function to rotate the image, but the quality drop off when rotating by an angle not divisible by 90 was shocking.
So ended up resorting to CSS, which does work a hell of a lot better.

This only covers how to do this using the JSON API, in a future post I’ll talk about decoding level.dat and other Minecraft Files.