Mochi arcade auto post plugin


The Mochi Arcade Auto Post Plu­gin was built out of neces­sity, it seemed to me that the plu­g­ins on the mar­ket were either designed to trans­form your blog entirely into an arcade, or to spam your blog with thou­sands of (mostly ter­ri­ble) games. Nei­ther of these fit my needs, I just wanted a plu­gin that would down­load game details when I clicked on the “post game to your site” but­ton at mochi, and then cre­ate a post with the game in it. Such a sim­ple require­ment, but to my dis­may I found noth­ing. I, how­ever, am well versed in web pro­gram­ming lan­guages (though not so much on design), and knew I could cre­ate a plu­gin to fit my needs. Some­how I doubt I’ll be the only one fac­ing this dilemma, so I’m also releas­ing this plu­gin to the public!

Cur­rent ver­sions of word­press don’t work with this plu­gin.  I’m no longer inter­ested in updat­ing it! I may return to it, but prob­a­bly not any­time soon.

Setup is simple, 

There’s a link that will bring you to the Mochi game’s pub­lisher set­tings, on the plu­gin set­tings page located under settings->Mochi Arcade Auto Post.  You’ll have to sign up for a pub­lisher account with Mochi if you haven’t already.  If you’re also a Mochi devel­oper you can just acti­vate pub­lisher fea­tures on your devel­oper account.  In the Mochi pub­lisher set­tings page you’ll find “pub­lisher id” sim­ply copy, and paste your pub­lisher id into the text box next to the link on the plu­gin page, and select how you want your game posts to appear (as the game, or as a link to the game).

You’ll also need to point Mochi to the plu­gin on your web­site, the address will be http://​www​.exam​ple​.com/​w​p​-​c​o​n​t​e​n​t​/​p​l​u​g​i​n​s​/​m​o​c​h​i​-​a​r​c​a​d​e​-​a​u​t​o​-​p​o​s​t​/​m​o​c​h​i​A​r​c​a​d​e​A​u​t​o​P​o​s​t​.​php

If your word­press instal­la­tion is in a sub­di­rec­tory (http://​www​.exam​ple​.com/​w​o​r​d​p​r​ess) remem­ber to add that sub­di­rec­tory appro­pri­ately eg. http://​www​.exam​ple​.com/​w​o​r​d​p​r​e​s​s​/​w​p​-​c​o​n​t​e​n​t​/​p​l​u​g​i​n​s​/​m​o​c​h​i​-​a​r​c​a​d​e​-​a​u​t​o​-​p​o​s​t​/​m​o​c​h​i​A​r​c​a​d​e​A​u​t​o​P​o​s​t​.​php

You’ll find this at the bot­tom of your Mochi pub­lisher set­tings page (linked to in the plu­gin settings)


And that’s it, that’s all you have to do to setup the plugin.


You can now click the “Post game to my site” but­ton on Mochi’s game pages, and it’ll add those games to your queue.

To access your queue, go to the dashboard->posts->Mochi games queue

This will show you a lit­tle about each game you clicked, and give you options for what to do with them (post, delete, edit, etc).  If you click post and pub­lish, the game will be inserted into a word­press post with appro­pri­ate cat­e­gories and tags, and imme­di­ately pub­lish that post.  If you click post, the gen­er­ated post will be set aside for your review.

A quick way to reach a game’s post is to click the “posted” but­ton (list­ing all games that have been posted), and click “edit”, this will bring you to that game’s post, with the edi­tor open.  You can also reach it the nor­mal way through wordpress.



You’ll notice that the posts only con­tain a short­code, and the descrip­tion, this short­code only pro­duces the embed code for the swf if the page is viewed directly (ie: you won’t have 5 swfs run­ning on your home page)  If you wish to cus­tomize it, or include games in other posts, you can use the short­code to do so.  There are a few options you can set.  I noticed that the games can some­times be wider than your word­press theme, block­ing some but­tons, so I added func­tion­al­ity to con­trol the game’s dimen­sions.  Some games respond well to this, some don’t.  I also added an option to out­put the game’s descrip­tion, as well as instruc­tions. All of those options are below.

the short­code is [[mochigame]], which requires a game_​tag, so [[mochigame game_tag=example]]

It will work even if the game hasn’t been posted, HOWEVER, you will not be paid for that game’s plays because the game’s files are not down­loaded to your site until you click one of the two post but­tons.  (the game MUST be in the queue, how­ever).  The actual post that is made by this plu­gin is what links the game tag to indi­vid­ual swf files, so if the post is deleted through the word­press posts page, using the short­code for that game will pro­duce an error.  This is likely to change in later ver­sions.  If you delete a post acci­den­tally, you can just click repost (this will always pro­duce an unpub­lished post)


  • width                  If set will resize the swf’s width, if height is not set, it will also set the height, keep­ing the aspect ratio the same (default: 0 (game default))
  • height                 Same as width, but swap width and height (default: 0 (game default))
  • over­ridewidth Accepts true or false, pre­vents the plu­gin from mod­i­fy­ing the game’s default size (but does not dis­able flashscreen)
  • flash­screen      (see flash­screen section)
  • instruc­tions    Deter­mines whether to dis­play instruc­tions, can be set to true or false  (default:false)
  • descrip­tion     Deter­mines whether to out­put a descrip­tion, can be set to true or false (default: false
  • author              Tells the plu­gin to dis­play the author’s name, can be set to true or false (default: true)
  • author­link      Tells the plu­gin to turn the author’s name into a link to his pro­file, can be set to true or false (default: true)


If both descrip­tion and instruc­tions are set to true, the descrip­tion will always appear above the instruc­tions, and if you set nei­ther width nor height the game’s orig­i­nal dimen­sions are kept.  The descrip­tion and instruc­tions are included in the post already if you’re post­ing the game via the post but­ton in the admin screen, which is why it defaults to false.


Since the 1.1.0 update, the short­code also posts screen­shots and thumb­nails based on plu­gin set­tings.  Any post with the excerpt m-​​DONT CHANGE:<game tag here> will also process the short­code in that game’s post (not the post the excerpt came from), includ­ing the text enclosed in the short­code as the post excerpt.  Basi­cally mak­ing the plugin’s games look bet­ter on archive pages that use the excerpt.  There will be a fall­back in the future should that game not have a valid post to pull from, or the game tag not be valid, for right now that behav­ior remains unde­fined. (expect strange, pos­si­bly error prone results if the game_​tag doesn’t link to a valid, posted game)


Flash­screenFlash­screen is some­thing I made so that users can “fullscre­enize” their flash, I’d hardly expect to be the first to do it, but it comes with a few draw­backs. Firstly, it acts dif­fer­ently depend­ing on what browser you have installed, and your set­tings. If you use chrome, with some exper­i­men­tal fea­tures turned on for instance, you’ll get REAL fullscreen out of it, and it works flaw­lessly (hit­ting esc will close it), if those fea­tures are turned off, or you use another browser, it’ll just fill your browser win­dow, and there will be a small but­ton at the top to make it smaller again. In most cases you can still use esc to clear the fullscreen, how­ever, Inter­net Explorer, and Fire­fox seem to have issues with that, hence why the but­ton exists.Firefox also has a ver­sion of the exper­i­men­tal fullscreen mode, and if your set­tings allow it, flash­screen will take advan­tage of it, but it isn’t as flaw­less, in fire­fox when you hit escape the first time, you’ll be greeted by the faux fullscreen mode shown to unsup­ported browsers, you can hit esc again, or click the but­ton to remove it.

Now all of this requires the flash to be embed with wmode=transparent, for two rea­sons, the first is that if you use direct, you won’t be able to click on the but­ton to remove the fullscreen in browsers that have trou­ble with the escape key code (they give flash the key­board input, and flash steals it away, not pass­ing it on to my javascript), and the sec­ond is that you get some strange bugs in the REAL fullscreen sup­ported by chrome and fire­fox. Now a lot of this all depends on the flash game as well, so really you’ll just have to play around with it. There are some short­code para­me­ters to help you here.

  • flashscreen=false – Removes the flash­screen option, wmode=direct
  • flashscreen=stage3d – Removes the flash­screen option, wmode=direct (really an alias for false)
  • flashscreen=deform – Will deform the flash movie to fit the screen size exactly, wmode=transparent
  • flashscreen=keep – Will keep the aspect ratio of the flash movie, wmode=transparent
  • flashscreen=stagescreen – WARNING: This set­ting is exper­i­men­tal, use at your own peril. Will keep the aspect ratio of the flash movie, wmode=direct

A note about game data

The data that is included with every game (descrip­tion, instruc­tions, image loca­tions, etc.) is set by the devel­op­ers of each indi­vid­ual game, as such some do not include all four images, and some have hor­rific mis-​​spellings and gram­mar issues in the descrip­tions.  It is for this rea­son that I rec­om­mend using the post but­ton, rather than the post/​publish but­ton, and review­ing the descrip­tion to ensure that it meets your standards.

Another note, but about alter­ing the size of the flash files

This plu­gin allows you (and your users) to alter the size at which flash objects are embe­ded into the browser, while some games deal with this flaw­lessly, oth­ers not so much, there are meth­ods avail­able for you to pre­vent this on a per-​​game basis, mostly using the short­code.  overridewidth=true will cause the game to be embe­ded at its default size regard­less of other set­tings.  And using flashscreen=false or flashscreen=stage3d will turn off the but­ton users have to expand the flash to fill their screen.  These also cause the game to embed with wmode=direct instead of trans­par­ent, since it isn’t nec­es­sary for html ele­ments to be lay­ered over them, and there is a per­for­mance gain by doing so.

Down­load the Mochi Arcade Auto Post Plugin

35 thoughts on “Mochi arcade auto post plugin

  1. I can not get images to show for the games I pub­lish. I’ve tried unin­stalling the plu­gin, game and even Word­Press and no mat­ter what I do the images do not dis­play for the Mochi Arcade Plu­gin. What could pos­si­bly be the problem?

  2. Cur­rently it sets the fea­tured image for the post, I hadn’t con­sid­ered themes that don’t use it. I’ll cre­ate a patch to address the issue.

  3. I just com­mit­ted the new ver­sion to the word­press data­base, it should be avail­able shortly. It adds an option to post the game thumb­nails in the actual post, as well as an option to include screen­shots, you’ll have to turn them on in the set­tings page.

  4. Well.….I set it all up again and now it won’t fetch the games. I hit the “post to my site” but­ton on Mochi Media game and it says that it was sent but when I check the queue it’s not there. I don’t know man, guess I’ll just for­get it and post games man­u­ally. I’m hav­ing trou­bles with every darned plu­gin I use.

  5. That does bring up a good point, I should have some sort of error log­ging so peo­ple can tell what’s wrong, guess that’s the next project.

  6. A new ver­sion is out that now logs WHY a request has failed under admin->tools->Mochi Log

    Should be much eas­ier to fig­ure out what’s going on now. It also con­tains a large num­ber of other refine­ments and addi­tions. (I’ll be doc­u­ment­ing the changes on this page in the com­ing days, but for now, they are doc­u­mented in the readme/​plugin change log.)

  7. Thanks for your plu­gin. I have set up every­thing accord­ingly but the games I auto­post would not come to the queue.
    I found two errors in my hosts error logs.

    PHP Warning: file_get_contents(http:///?game_tag=XXXXXXXX) [function.file-get-contents]: failed to open stream: operation failed in /home3/XXXX/public_html/XXXX/wp-content/plugins/mochi-arcade-auto-post/mochiArcadeAutoPost.php on line 121

    WordPress database error Unknown column 'screen2_thumb' in 'field list' for query insert into wp_mochi (key_mappings,screen2_thumb,popularity,video_url,rating,.....

    Please advise on how can I get it fixed. Also I believe the request URLs for mochi­ads have changed to ‘…/…’ sort of for­mat. I don’t know much about coding.

    Thanks in advance

  8. Does any­one else have com­ments show­ing up in their mochi game arti­cles? The game dis­plays fine for me, I’m just not get­ting the com­ments sec­tion to show up.

  9. Hello Felps, I get the fol­low­ing mensgame of Mochi “You should now see your game on your site or wait­ing in your queue.” But there is noth­ing in the direc­tory. “dashboard-​​> posts-​​> queue Mochi games”

    Can you help me?


    [11-​​Sep-​​2012 19:24:19] PHP Warn­ing: Mod­ule ‘zip’ already loaded in Unknown on line 0

    [11-​​Sep-​​2012 19:24:19] PHP Warn­ing: file_​get_​contents() [function.file-get-contents]: URL file-​​access is dis­abled in the server con­fig­u­ra­tion in /home/MY-SERVER/public_html/wpress/wp-content/plugins/mochi-arcade-auto-post/mochiArcadeAutoPost.php on line 121

    [11-​​Sep-​​2012 19:24:19] PHP Warn­ing: file_​get_​contents(http://​MY​-SITE​.com​.br/​w​p​r​e​s​s​/​?​g​a​m​e​_​t​a​g​=​b​a​d​0​3​2​8​b​7​3​3​c​f​3​9​8​&​a​m​p​;​m​a​a​p​p​w​=​t​e​s​t​p​ass) [function.file-get-contents]: failed to open stream: no suit­able wrap­per could be found in /home/MY-SERVER/public_html/wpress/wp-content/plugins/mochi-arcade-auto-post/mochiArcadeAutoPost.php on line 121

  11. The page with the games on it is a stan­dard word­press arti­cle, so the com­ments should show based on your word­press settings.

  12. Hello Felps, thanks for pub­lish this plu­gin.
    I’ve installed it but I can­not make it work. When I click on “Post game to my site”, mochi says “Suc­cess” but the game does not shows in the queue and there is noth­ing in Tools > Mochi Log (and I can­not see any error trace at server logs).
    Any idea?

  13. Appolo­gies for my inac­tiv­ity lately. going to field some of these sup­port issues.

    It seems that your server does not allow file_​get_​contents() (a com­mand I used to move some data around). The only fix for this is for me to find another way to do this that is more uni­ver­sally allowed on sites, for ref­er­ence, the plu­gin works per­fectly on Host­ga­tor (which was the only host I had the resources to test on).

    Junjo, hard to say really, I’d have to be able to repro­duce this one and poke around.

    Crashgames, It appears that the site is not prop­erly find­ing its own URL, I was unfor­tu­nately unable to use word­press for this step, which means indi­vid­ual host­ing will vary. I will attempt to resolve some of these issues in the next patch, which I’ll be work­ing on this com­ing week. Also planned is an option for the ori­en­ta­tion of the games, as the cur­rent default left-​​side is not very pretty.

  14. Alright, I have a rea­son as to why the games aren’t cur­rently being added to the queue for the folks with no obvi­ous rea­son why. This would be a wide­spread issue, and the fix is sim­ple. Mochi have added a data­base entry that is sent along with the game, which denotes wether or not the game uses stage3d. My pro­gram attempts to add ALL of the game data to it’s own data­base, which includes this stage3d, but the data­base does not have a stage3d col­umn. So a workaround for now (until I make a new ver­sion) is to use php­myad­min to add a col­umn called stage3d to the mochi­au­to­post table in your word­press data­base. (For those who know how to do this)

    In the long run I’m going to change the struc­ture of how the plu­gin works, and stores its data­base so that it can accept new columns cleanly, so there is never a repeat of this debacle.

  15. Great plu­gin & thanks for ‘stage3d’, just installed and thought i was hav­ing plu­gin con­flict but table tweak worked like a charm.

    only issue i have is that thumb­nail appears on index & archive pages but not in con­tent of actual post page — is there a way to force that in on the short­codes out­put page for content?

  16. Cur­rently there’s no way to do that, there’s a set­ting in the options that will force the thumb­nail to appear on list-​​type pages (archives/​index/​etc), but not in the actual game post. (I’m actu­ally mak­ing the next patch now in another win­dow, I’ll see about adding some­thing to that effect, prob­a­bly along with cen­ter­ing the games, not much pol­ish on this plu­gin right now I’m afraid)

    In a way the stage3d thing is nice, as I can make the plu­gin attempt to auto­mat­i­cally han­dle the issues I had with stage3D games and the fullscreen but­ton I made…

    On plu­gin con­flicts, shouldn’t hap­pen with this one, this plu­gin very pur­pose­fully doesn’t alter the way word­press func­tions in any way (as far as other plu­g­ins are con­cerned), and also the entire thing is com­part­men­tal­ized in its own class(es) with unique names, using no cus­tom global vari­ables at all… Basi­cally, it plays nice. Another thing I was very care­ful with, is the plu­gin will com­pletely remove all traces of itself from word­press, it won’t leave any data­base clut­ter like many plu­g­ins do “in case you decide to reinstall”

  17. The game’s aren’t cen­tered yet, and the option for post­ing the thumb­nail on the page may not work with all themes (the best place to put such a thumb­nail is next to the title, and appar­ently the_​title fil­ter in word­press applies to ALL titles shown on the page, not just the one for the post, but if the first title in the HTML is your post title, it should be placed prop­erly, then just hope it doesn’t bump your game down with­out bump­ing the div it’s in down too… You’ll have to uncom­ment a few lines to see the option though, it’s doc­u­mented in the change log, but search­ing for JPL-​​849 in mAAPOptions.php should find you the line.

    I may try to re-​​format how the games are placed to pro­duce a log­i­cal place for the thumb­nail some­where else, as I don’t think I’ll find a solu­tion that will work in all themes for this. There is a fil­ter called single_​post_​title that seems promis­ing, but it doesn’t seem to run at all in twenty-​​eleven (my test theme for really basic theme types) Other themes may call that filter…

    At any rate, I’m going to first give it one final test (upload­ing it here, my REAL site) to check if there are any neg­a­tive effects on a real-​​world blog, and then I’ll be upload­ing it to the word­press plu­gin database.

  18. The fix is now up on the plu­gin repos­i­tory, (well, it was yes­ter­day too) one other thing that I’ve found may pre­vent you from get­ting games in the new ver­sion, if you have a plu­gin like Bad Behav­ior, it may be block­ing Mochi’s attempt to access your site with the game data, as it is detected as a bot, you’ll just have to white-​​list Mochi’s IP addresses, which is detailed on the plugin’s set­tings page, along with two IP addresses for Mochi.

  19. can some­body tell me how to make plu­gin to pub­lish games on same cos­tume post type

  20. Well, the plu­gin doesn’t cur­rently use a cus­tom post type, instead rely­ing on a very spe­cific tag, and post cat­e­gory to sep­a­rate the games from the site, a cus­tom post type would be an improve­ment though. I’ll write it on the TODO: list.

  21. A quick google search for mAAPBS turns up quite a few sites (much to my delight) using my plu­gin, but at the same time it high­lights an error I’ve made, many of these sites use a tag cloud, and mAAPBS appears in giant, bold let­ters as a com­monly used tag, that’s not cool… So my next release is going to focus on remov­ing the use of this tag, most prob­a­bly by using a cus­tom post type mov­ing for­ward, retroac­tively fix­ing the pre­vi­ous posts might be tricky, but I’ll give it a shot.

  22. Anony­mous com­ments are now enabled on a trial run, if I get too much spam I’ll just turn them off. The idea here is to have a low bar­rier of entry for dis­cus­sion. With any luck, my non-​​invasive anti-​​spam mea­sures will hold up to such a test.

  23. Test2, same IP, same Wavitar?

  24. It doesn´t work in my Word­Press 3.5.
    In the Mochilogs can i read:
    Empty games array returned by mochi
    Invalid pub­lisher ID on options page

    But miy PubID is right. Felps, is there an fix or can you help me please?

    greets, spiele­hunter

  25. Hmm, not sure, it isn’t to do with word­press 3.5, just updated my own site and did a test (the game appeared in my queue, but I don’t really want to post it, it’s not that good :P), I’ll play around and see if I can dupli­cate the bug, most com­monly it would be the pub­lisher ID issue… But this could also be caused by a mal­formed request sent back to mochi. How it works: When you click add game to queue mochi sends your web­site (the plu­gin) a game tag, the plu­gin then sends a request for the infor­ma­tion on that game to mochi, which requires the game tag, and your pub­lisher id, it then adds all of the game infor­ma­tion to your word­press data­base, which it accesses to do the other functions.

    You’ve got a prob­lem either with the game tag (although it has a cou­ple basic checks to see if the game tag is valid), or the pub­lisher id…

    Off the top of my head, some­thing that might not be eas­ily seen by check­ing your pub­lisher ID page, and the plu­gin has no checks for… If there is a trail­ing space after your pub­lisher ID, it would cause the URL the plu­gin accesses to get the game infor­ma­tion to be mal­formed, caus­ing mochi to send a 404 instead of the game’s json. How would a trail­ing space get there? I’ve noticed when I work in win­dows (I usu­ally use Linux) that some­times when I copy from webpages/​emails, and paste there is a trail­ing space, which is a pain when you’re copy­ing some­thing like a pass­word. My the­ory is that it cap­tures some html for­mat­ting, and the clip­board inter­prets it as a space.

Leave a Reply

Your email address will not be published.

Connect with Facebook