Seriously hackers, don’t you have better things to do?
Just logged on to my dashboard to see what the hell is going on with this blog and erm… yeah ok.
Really? Why are you wasting your time 😉
Random Shite
Just logged on to my dashboard to see what the hell is going on with this blog and erm… yeah ok.
Really? Why are you wasting your time 😉
I’ve been working on an internal IT support board and after moving it from the local test server to a remote live server sending the URL out for test, we noticed how damn slow it was, for example, it was taking 10 seconds on every page to connect to a clicked link.
As it was Active Directory secured, changing it to the local AD controller to the server didn’t speed it up as much as I had hoped.
Someone then suggested changing the DB_HOST
in the wp-config.php to 127.0.0.1
instead of localhost
.
Much to my amazement, the 10 second delay disappeared in an instant. So there you go, a quick fix to the problem and another reminded why I hate using IIS!
“Howdy, Mark Hall!” Oh please WordPress.
I changed it to ‘Hi, Mark Hall’ on the corporate web site, while looking through the functions.php for the IT Support Board, I decided to enhance it a little. What about a random selection?
[code]
/**
* Replace ‘Howdy’ with a random welcome message… because I can 😉
*/
function replace_howdy( $wp_admin_bar ) {
$my_account = $wp_admin_bar->get_node(‘my-account’);
$welcome_text = array(
‘Hi ‘, // So boring!
‘Well hellooooo there ‘, // too creepy
‘Ding dong! Hellooooo ‘, // Leslie Thomas
‘Another visitor, stay awhile. Stay FOREVER! ‘, // Impossible Mission
‘Howdy-doodly-do ‘, // Talkie Toaster
‘LTNS! HRU ‘, // chat room b*llocks
‘Uh oh, here’s trouble ‘, // no reason
‘Ah I’ve been expecting you ‘, // thanks Mark 🙂
‘Hello! is it me you’re looking for? ‘, // Lionel
‘You say goodbye, and I say Hello, hello hello ‘, // Hello goodbye
‘Sorry I can’t do that… Daisy, Daisy… ‘, // HAL
);
// could use array_rand(), but that would be too easy
$welcome_message = $welcome_text[mt_rand( 0, count($welcome_text) – 1 )];
$newtitle = str_replace( ‘Howdy,’, $welcome_message, $my_account->title );
$wp_admin_bar->add_node(
array(
‘id’ => ‘my-account’,
‘title’ => $newtitle,
)
);
}
add_filter( ‘admin_bar_menu’, ‘replace_howdy’,25 );
[/code]
Well that killed a couple minutes of working day 😉
Our website uses the WP Job Manager plugin to manage the recruitment side of the web site, and after much hacking of the template, we’ve got it nailed now for the different job types in different job categories.
When asked to submit an RSS feed to AllTheTopBananas.com it came back as a fail as they need the salary and location fields. Hmmm, ok no problem. Add an action to put those custom fields into the RSS like this.
add_action('rss2_item', 'add_salary_location_to_job_rss'); function add_salary_location_to_job_rss() { // if the post_type is a job_listing... if (get_post_type()=='job_listing') { // add these custom fields with the XML namespace $fields = array( '_job_salary' => 'salary', '_job_location' => 'location', ); $post_id = get_the_ID(); foreach($fields as $field => $xml_key) { if ($value = get_post_meta($post_id, $field, true)) { echo "" . $value . "n"; } } } }
What could possibly go wrong?
Hmmmm guess who forgot how picky XML validation is and forgot to encode the $value. Schoolboy error, so wrap the string with wptexturize():
echo "" . wptexturize($value) . "n";
And bingo. Validation finally. Maybe I should have checked with the W3C XML Validator first before sending it off again.
I’m writing a custom filter in WordPress today for an internal support board powered by AD and WordPress user roles/capabilities.
The logic in the spec (such as it is) is along the lines of Is user posting isn’t an admin, find the admin of the user group (business support, technical support or integration) and send them an email to publish the article.
It’s taken hardly anytime to do this, but Googling for it before I started, I came across some misinformation from uninformed tossers on WordPress.org who looked at the codex and saw is_admin() function and assumed that’ll do the trick.
According to these idiots:
if (is_admin()) { echo "Hello administrator"; } else { echo "Hello lesser mortal"; }
is the solution to the problem of finding out if the logged in user is an administrator.
No it doesn’t you cretin. Quote WordPress Codex:
is_admin() is not intended to be used for security checks. It will return true whenever the current URL is for a page on the admin side of WordPress. It does not check if the user is logged in, nor if the user even has access to the page being requested. It is a convenience function for plugins and themes to use for various purposes, but it is not suitable for validating secured requests.
And if don’t understand what that means, it translates as a check to see if you are in the admin SCREEN!
This is why the internet is full of crap WordPress themes and crap WordPress plugins, because people believe shit like this posted on the forums without double checking first.
If you want to find out if the user is an administrator, try this:
# guess what? this gets the current user information $current_user = wp_get_current_user(); # is 'administrator' in this users roles? if (in_array('administrator', $currentUser->roles)) { echo "Hello administrator"; } else { echo "Hello lesser mortal"; }
On my daily check list, I go to the work’s web site, log in to the Wordpress admin and… WOAH! What the f… no mustn’t swear in the office.
Really WordPress?
To the hackers in Ukraine, Russia, Vietnam and China who are trying to hack my site… WHY?
I’m lucky to get 10 visitors a day, so I’m a little puzzled why you’d bother. I’m not sure what kudos you’ll get from the hacking fraternity by taking down this shitty web site, but thanks for noticing me.
P.S. As a WordPress developer, do you seriously think I’d have a user called admin as a user on this site? Or even as user ID 1? Or /wp-admin folder?
Good luck anyway.
But as @Teaandstrumpets pointed out, that’s never stopped me writing shite posts before.
I’ve updated this blog to the Mystique theme since I was sick of the default twentyten one, more so since I made so many alterations and then clicked to receive an update. Silly of me to expect it to backup the old files. And yes I did have a backup but unfortunately it was on one of my USB keys that wife successfully destroyed when she sucked it up with a vacuum.
Quite quiet on Twitter as well, helping a few people with HTC Desire issues and hoping to push people away from buying shite phones like the Samsung Galaxy 🙂
Just as I typed that, as arse appeared in the form of @JoeCienkowski
Or is that nothing worth writing?
I’ve got the rest of the week off so looking forward to two days with the wife, though one of those is going to Totnes which is going to be an experience I’m sure. Then again she is working this weekend so I get 12 hours to myself and no matter how good my intentions are on planning to do things, bugger all ever happens.
Like this blog for example, I don’t like this default theme but every time I go to design a new one, I lose interest so I’ve set myself the slightly more achievable aim of just “enhancing” it. I’m sure I can manage a decent background and change the god awful typefaces used, no offence to WordPress of course, but Georgia of all things!
Still struggling for a category name of all the posts that aren’t in the other ones. Hmmm, “Reaction”? “News?” Ah sod it, too much thinking for one day.
Oh god, Howard Jones has just come on my mp3 player, that isn’t going to make this any easier to write! Next please. Ah, Harry Up Harry Camel! Music to think to
Edit: Actually I’ve just done the background, just inverted one I did two years ago but never used anywhere so that’s one less thing to do now.