Welcome!

It appears that you've stumbled across my website in one way or another. In that case, welcome to my home on the internet. My name is Bay Phillips and I'm a web developer based out of Troy, New York. Please feel free to learn more about me, view my previous work or contact me if you think we should work together.

The Blog  Subscribe! 

Fried Porkchops, Roasted Broccoli and Sweet Potato Fries

And a Brooklyn Brewery Summer Ale of course ;)

Posted in Food | Leave a comment

Oh how I missed my childhood

I just picked up the Roller Coaster Tycoon 2 Triple Thrills pack at Good Old Games. I used to be really good at this game when I was younger, making some pretty ridiculous coasters. Here’s one (3 of them) that I was able to make today.

Posted in Games | 1 Comment

Working on an Android App

After a day of failing miserably, I have something to show for my first ever attempt at coding an Android Application:

Working classes and it imports an XML file of cigar brands, cigars and sizes. So the structure is there for a pretty easy to use cigar log…

More to come while I’m bored.

Posted in Android, Cigars | 2 Comments

Already Used Variable Names in WordPress

Last week I handed over a somewhat completed plugin over to Kyjen, and I was pretty proud of it. I knew it wasn’t 100% done; however, it was a good first step. Earlier today, I got an email from them with a screenshot of a very weird bug:

All of the messages in my plugin were showing up in the admin/user-new.php within the WordPress Admin… Pretty weird, right?

After a lot of investigating, and trying to figure out where the hell my custom messages were being called, I came across this part within the admin/user-new.php:

 

if ( ! empty( $messages ) ) {
	foreach ( $messages as $msg )
		echo '<div id="message"><p>' . $msg . '</p></div>';

Turns out, in the custom messages in my plugin, I had declared the array that held all of my messages as $messages, thus overriding the WordPress core.

Now I know to be more careful in my plugin variable naming. Previously, I had been careful with just my function names, but I guess it can’t hurt to be as explicit as possible.

Posted in PHP, Web Design | 3 Comments

Reverted DohGames back to Splash Page

Yesterday I decided that I’d had enough with trying to rebuild DohGames (for the time being). I had set up new forums for DG a while back; however, I didn’t have anything to offer for the community to actually flourish. I found myself checking it about once a week and having to deal with spammers.

That said, I’m not giving up hope on DG any time soon. I have to dedicate my time to my other projects, finishing up my last semester of college, and starting my full time job in the Summer.

Maybe once I get everything set up, and if I find myself with more time on my hands, I’ll be able to refocus my efforts. For the time being, I’ll still be looking for anyone interested in purchasing DohGames or anyone who has ideas and is willing to work on them.

Posted in DohGames | Leave a comment

Custom WordPress Admin Menu Pages

Today, while I was doing some work for Kyjen, I came across a situation that I wasn’t too sure how to handle: correctly utilizing the add_menu_page and add_submenu_page functions.

I couldn’t figure out how to have the first submenu item be a different name than the parent’s name. Let me clarify what I mean.

When you want to add a new menu item in the admin backend of WordPress, you call the function add_menu_page. It looks something like this:

add_menu_page( 'Plugin Home', 'Plugin Home', 0, 'myplugin_pagename', 'myplugin_functionname');

This results in a new menu item called “Plugin Home” that you can now click on that will call the myplugin_functionname() function that you’ve delcared in your plugin. In order to add items within your new menu, you’d simply use the add_submenu_item, like this:

add_submenu_page('myplugin_pagename', 'My Menu Item', 'My Menu item', 0, 'myplugin_mymenuitem', "myplugin_menuitemfunction");

You would expect to only see one menu item, right? We’ve only declared one submenu item, “My Menu Item”, so it should be pretty straight forward… Well it isn’t. You actually end up having two menu items: “Plugin Home” and “My Menu Item”.

I understand this default functionality; however, I didn’t want it with what I am doing. I couldn’t find anything that explained how to change the first item that is listed under a custom admin menu. Even changing the two string parameters in the add_menu_page doesn’t work, as the first parameter is for the page’s title that is displayed on the actual page and the second parameter is what shows up on the actual menu. Changing the second parameter ended up changing the header, as well as the menu item.

I was able to finally figure out what the hell was going on by guessing at what other plugins had done, even then it wasn’t exactly apparent (at least not to me.)

In order to replace that first menu item with different text, declare a submenu item that uses the same page name. For example:


// Add the menu header
add_menu_page( 'Plugin Home', 'Plugin Home', 0, 'myplugin_pagename', 'myplugin_functionname');

// Add the submenu item. Notice how they both use the myplugin_pagename page
add_submenu_page('myplugin_pagename', 'New Item Text', 'New Item Text', 0, 'myplugin_pagename', 'myplugin_menuitemfunction');

This caused me a bit of confusion, but let me know what you all think. Maybe there’s a more correct way of accomplishing this.

Posted in PHP, Web Design | Leave a comment