Atlanta WordCamp
So the Atlanta WordCamp that went down this past weekend was interesting. I didn’t look into attending until last minute, and registration was closed. I ended up attending as a volunteer with the “Genius Bar” setup they had. The volunteer route got me in for free, and gave me the opportunity to see a couple sessions in addition to helping out a myriad of people with various WP related problems. The WordCamp was held at the Atlanta SCAD campus, which gave me the opportunity to browse through some really great student artwork in my spare time! The entire event seemed to be executed with extreme efficiency, as every detail was planned out. I hope to see more Atlanta WordCamps in the future with Matt and other speakers in attendence (including myself!).
The weekend also brought the opportunity to hang out with my Buddy CC and his lovely lady Jen! We had a great time at Taco Mac with Jarrett, and at the Darkhorse Tavern/10 High Club with Metalsome karaoke. I was also afforded the opportunity to spend some time with my family. It’s been a while since I’ve visited with them on their own turf. My cousins Hannah, Libby, and Abby are growing up so fast!!! Needless to say, the weekend was a much needed escape.
-Phenix
WP Post Scheduling Mishap
I recently had to help someone I host a site for solve a very strange issue with post scheduling after an upgrade to 2.9 on his WP site. I’ve hosted many WP sites over the years and have never had this problem personally, so I had to dig around a bit.
The Issue:
When the time allotted for a scheduled post to be published occurs, the post is not published, and a message within the Admin panel only says “Missed Schedule.”
After perusing around the WP forums for a bit, I came to realize that this is a hot topic for many 2.9 early adopters. After looking deeper into the forums, I found that this has been a potential issue with Wordpress versions since the release of 2.7. Some say the “Missed Schedule” mishap can be caused by a temporary “hiccup” with a site’s DNS. As I manage the DNS for the particular site I host, I knew this to not be the case. Further research did indeed provide me with a solution.
The Solution:
Apparently with all the new fancy upgrades to the WP core, a significant amount of time (in the web world this means milliseconds!) has been added to the time it takes to run the job that actually publishes a post. From what I can tell this is due to the number of hooks that data has to be run through to make it from the edit page as a draft, to the front page of your blog as a live post. The addition of running it through the scheduling cron job pushes it too far. Can’t we just extend the allowable time to publish a post you say? Here you go:
The time limit is set around line 230 in the /wp-includes/cron.php file. The default line will appear as such:
230 | wp_remote_post( $cron_url, array('timeout' => 0.01, 'blocking' => false, 'sslverify' => apply_filters('https_local_ssl_verify', true)) ); |
As you can see, the limit is set to 0.01 seconds by default. I tried increasing the value in increments, and finally decided on 20 seconds. You may find that this can very from server to server, so play around with it for a bit to optimize it for your setup. So here’s the updates line:
230 | wp_remote_post( $cron_url, array('timeout' => 20.0, 'blocking' => false, 'sslverify' => apply_filters('https_local_ssl_verify', true)) ); |
So there you go! If you’ve found yourself upgrading to a new version of WP and you are unable to successfully publish a scheduled post, try this out!
ZebluePrime Gets New Digs!!!
So ZebluePrime got new digs last night…….errr maybe he just washed them really! I helped him setup his own domain (zeblueprime.com) to get him off of a sub-domain i let him borrow (previously evan.phenixblue.com). Along with the domain setup there were a few changes to make within his wordpress install to make everything go smooth.
I try to keep a directory structure similar to this within my webroot:
WEBROOT/
/domain1.com
/domain2.com
/domain2.com/sub1.domain.com
/domain2.com/sub2.domain.com
/*********************DISCLAIMER***********************************/
PLEASE BACKUP YOUR DATABASE AND FILES BEFORE PERFORMING ANY OF THE FOLLOWING!!!
Step 1: Migrate files from old sub-domain to new domain directory
- Create new directory
#sudo mkdir /WEBROOT/zeblueprime.com- Change to old directory
#cd /WEBROOT/phenixblue.com/evan.phenixblue.com/- Copy files from old dir to new dir
#sudo cp -R * ../../zeblueprime.com/- Change to new directory, verify your files (including .htaccess) exist, and have proper permissions and ownership
#cd ../../zeblueprime.com/
#ls -laBatch Script for IE & Firefox proxies
So, in the many endeavors I pursue at work for needless reasons, here’s something I hope someone else benefits from. We tend to lock down access on machines that are in public places, or have more than a few users. As we’re not quite fully migrated over to Microsoft Active Directory, and can’t manage Group Policy, theres no easy way to centrally manage browser proxy settings. We use browser proxy settings to limit the websites end users have access to on a machine ( to circumvent many wasted hours of cleaning up virus, spyware, and other junk). Browser proxy setting are super easy to mange with a .PAC file. IE can be managed by both a .INS and a .PAC file, but I’ve found the .PAC is more compliant throughout the majority of mainstream web browsers. We store a “restrict.pac” file on a web server to serve out proxy settings for IE and firefox to minimize the need to touch individual machines to add url’s to the the exception list. We just edit the one .PAC file and all machines configured to read that file are automatically updates (once the browser is restarted!). The problem is, we still have to touch each machine to setup the initial configuration to read the “restrict.pac” to auto configure the proxy settings. I recently developed a batch file that will setup both (IE and Firefox) browsers to use the “restrict.pac” file for proxy auto config settings. I haven’t had time to add conditionals if files already exist, but the script has been tested, and it doesn’t really matter if the files already exist in our environment. Feel free to use the code, and modify it in any way. If you find yourself needing something a little different, please comment. If you add to it, let me know! Here you go:
restrict.pac contents:
/Store info in variables for clean code var ALLOWED = "DIRECT"; //set the proxy server you want to redirect to var DISALLOWED = "PROXY services.valdosta.edu:80"; function FindProxyForURL(url, host) { //Add all exceptions for pages users need to hit here //all VSU pages if (shExpMatch(url,"*valdosta.edu/*")) {return ALLOWED;} //1Card online card office if (shExpMatch(url,"*blackboard.com/*")) {return ALLOWED;} //Bookstore e-commerce stuff if (shExpMatch(url,"*collegestoreonline.com/*")) {return ALLOWED;} //Off campus housing forum if (shExpMatch(url,"*freeforums.org/*")) {return ALLOWED;} //ADP related links if (shExpMatch(url,"*gafirst.esg.edu/*")) {return ALLOWED;} if (shExpMatch(url,"*adp.com/*")) {return ALLOWED;} //VSU Athletics if (shExpMatch(url,"*vstateblazers.com/*")) {return ALLOWED;} else { //redirect to proxy server for all other requests return DISALLOWED; } } // end of function
browserProxy.bat contents:
::Store info used to create user.js in variables
set var1=# Mozilla User Preferences
set var2=user_pref("network.proxy.autoconfig_url", "http://services.valdosta.edu/restrict.pac");
set var3=user_pref("network.proxy.type", 2);
set var4=user_pref("pref.advanced.proxies.disable_button.reload", false);
::concat each variable to create the user.js
echo %var1%> c:\\apps\user.js
echo %var2%>> c:\\apps\user.js
echo %var3%>> c:\\apps\user.js
echo %var4%>> c:\\apps\user.js
:: determine current user's firefox profile and set it to "var5"
for /f %%a in ('FINDSTR /r ".\.default" "%AppData%\Mozilla\Firefox\profiles.ini"') do set var5=%%a
set var5=%var5:~14%
:: Copy "user.js" to Firefox profile directory
COPY "c:\\apps\user.js" "%AppData%\Mozilla\Firefox\Profiles\%var5%\" >nul
:: create IE Proxy
Reg ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v "AutoConfigUrl" /d "http://services.valdosta.edu/restrict.pac" /f
WP Dynamic Highlight Menu
OK, so I have a major problem with brainstorming and researching a certain item, function, procedure, trick, hack etc for the current project I’m working on, never writing it down, and having to re-learn it all over again the next time I need to use the same thing. Since I’ve been trying to keep content churning out on this site, I figured I could start posting stuff here to at least serve as a repository for all the stuff I will never remember off the top of my head [since no one really reads the site anyways]. Anywho, I found myself working on a WordPress project recently that had the simple need of a dynamic menu that highlighted the current page. Most people choose to go the easy route and use code similar to this:
<ul id="nav">
<li<?php if ( is_home() ) { echo 'class="current"'; } ?>><a href="#">Gallery</a></li>
<li<?php if ( is_page('about') ) { echo 'class="current"'; } ?>><a href="#">About</a></li>
<li<?php if ( is_page('submit') ) { echo 'class="current"'; } ?>><a href="#">Submit</a></li>
</ul>
<li<?php if ( is_home() ) { echo 'class="current"'; } ?>><a href="#">Gallery</a></li>
<li<?php if ( is_page('about') ) { echo 'class="current"'; } ?>><a href="#">About</a></li>
<li<?php if ( is_page('submit') ) { echo 'class="current"'; } ?>><a href="#">Submit</a></li>
</ul>
Whereas this will do the trick for a finite menu where the names will never change, it’s not what I wanted for my client. With a little research in to some of the changes in the past couple versions of WP, I was able to get the desired results with a few lines of code:
<div id=”menu”>
<!–Main navigation menu–>
<ul>
<?php wp_page_menu(’show_home=1′); ?>
</ul>
</div><!– menu –>
You might ask “How does it know what the current page is?” I say…..”WordPress is awesome and takes care of it for you these days! When using the wp_page_menu() function, the “current_page_item” class is automatically added to the current selected page. The end result will be this:
<li class="current_page_item">
Rather than:
<li class="page_item page-item-2">
So the accompanying CSS would just apply the “current” styling to the “current_page_item” class, and you’re done!!!
The way I chose to do it makes for less code on the developer’s side, and also allows menu items to be updated dynamically when a user adds a new page, deletes and old one, updates a pages name, or changes the order. While I appreciate WP’s addition of the wp_page_menu() function, I wish they would add the options to specify what item the class is attached to (list item or link), as well as the option to specify your own class name in place of “current_page_item.” I hope someone else finds this to be useful. As always I encourage comments and discussion!
-Phenix



