WordPress Hello Dolly -> Rick Roll

For a little bit of fun a number of months ago I edited the default hello dolly wordpress plugin and changed it to a rick roll.

Personally, I’m not of the Hello Dolly generation and it didn’t interest me at all, whilst Rick Rolling all the other WordPress users is fun!

<?php
 /**
  * @package Rick_Roll
  * @version 1.5.2
  */
 /*
 Plugin Name: Rick Roll
 Plugin URI: http://wordpress.org/#
 Description: This is a modified version of Hello Dolly, it symbolizes the hope and enthusiasm of the online generation. When activated you will randomly see a lyric from <cite>Rick Astley</cite> in the upper right of your admin screen on every page. You've been Rick Rolled by Michael Kubler -- June 2010.
 Original Author: Matt Mullenweg
 Version: 1.5.2
 Original Author URI: http://ma.tt/
 */
 
function rick_roll_get_lyric() {
 /** These are the lyrics to Hello Dolly */
 $lyrics = "We're no strangers to love
 You know the rules and so do I
 A full commitment's what I'm thinking of
 You wouldn't get this from any other guy
 I just wanna tell you how I'm feeling
 Gotta make you understand
 Never gonna give you up, never gonna let you down
 Never gonna run around and desert you
 Never gonna make you cry, never gonna say goodbye
 Never gonna tell a lie and hurt you
 We've known each other for so long
 Your heart's been aching but you're too shy to say it
 Inside we both know what's been going on
 We know the game and we're gonna play it
 And if you ask me how I'm feeling
 Don't tell me you're too blind to see
 Never gonna give you up, never gonna let you down
 Never gonna run around and desert you
 Never gonna make you cry, never gonna say goodbye
 Never gonna tell a lie and hurt you
 Never gonna give you up, never gonna let you down
 Never gonna run around and desert you
 Never gonna make you cry, never gonna say goodbye
 Never gonna tell a lie and hurt you
 (Ooh give you up)
 (Ooh) never gonna give, never gonna give (give you up)
 (Ooh) never gonna give, never gonna give (give you up)
 We've known each other for so long
 Your heart's been aching but you're too shy to say it
 Inside we both know what's been going on
 We know the game and we're gonna play it
 I just wanna tell you how I'm feeling
 Gotta make you understand";
 
// Here we split it into lines
 $lyrics = explode("\n", $lyrics);
 
// And then randomly choose a line
 return wptexturize( $lyrics[ mt_rand(0, count($lyrics) - 1) ] );
 }
 
// This just echoes the chosen line, we'll position it later
 function rick_roll() {
 $chosen = rick_roll_get_lyric();
 echo "<p id='rick_roll'><a href='http://bit.ly/defcon' title=\"Never Going to Give You Up\" target='_blank'>$chosen</a></p>";
 }
 
// Now we set that function up to execute when the admin_footer action is called
 add_action('admin_footer', 'rick_roll');
 
// We need some CSS to position the paragraph
 function rick_roll_css() {
 // This makes sure that the posinioning is also good for right-to-left languages
 if(function_exists('is_rtl')) {   $x = ( is_rtl() ) ? 'left' : 'right';}
else {$x = 'right';}
 
echo "
 <style type='text/css'>
 #rick_roll {
 position: absolute;
 top: 4.5em;
 margin: 0;
 padding: 0;
 $x: 215px;
 font-size: 11px;
 }
 #rick_roll a{
 text-decoration: none;
 }
 </style>
 ";
 }
 
add_action('admin_head', 'rick_roll_css');
 
?>

To install it you can go into the Plugin->Editor and paste it over the top of the Hello Dolly script, however that will get over-ridden each time you upgrade WordPress to a new version. You are better off creating a new rickroll.php file in the /wp-content/plugins/ folder, or maybe install one of the many Rick Roll plugins.

Credit goes to the original Hello Dolly author, Matt Mullenweg, plus Rick Astley for making such an enjoyable song!

About admin

Australian Network for Art and Technology [ANAT] e: [email protected] | ph: +61 8 8231 9037 www.anat.org.au | www.filter.org.au | www.synapse.net.au Twitter: __ANAT | Facebook: http://bit.ly/bF9fXl The Australian Network for Art and Technology (ANAT) is supported by the Visual Arts and Craft Strategy, an initiative of the Australian, State and Territory Governments; the Australian Government through the Australia Council, its arts funding and advisory body, and the South Australian Government through Arts SA.
This entry was posted in Code. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *