Category Archives: Portfolio

20Mar/14
the-plugin-generated-x-characters-of-unexpected-output-during-activation

The Plugin Generated xxx Characters of Unexpected Output During Activation

the-plugin-generated-x-characters-of-unexpected-output-during-activation

While developing a custom WordPress plugin I saw this error when activating it. 

The Plugin Generated xxx Characters of Unexpected Output During Activation

I did a little Googling and found that there are a few most common causes:

  1. A white space before or after the PHP opening or closing tags
  2. A file encoded in UTF-8
  3. Another issue when something is called at the wrong time, or a call that cannot be resolved without intervention
  4. Using the WordPress add_option function. Switching to update_option instead can resolve the problem.

In my case it was #1 that blew it up for me.  Who woulda thunk a blank line would be so horrible?  

Anyway, hope this helps someone down the road who is pulling their hair out like I was.

p5rn7vb
22Nov/13
Https-150x150

HTTP / HTTPS fix for WordPress

***UPDATE***
So, one of those pesky LaneCC blog network users had a problem with a syndicated blog post that included an iframe embedded YouTube video losing the HTTPS today.  I looked into it and found an additional filter to add to the plugin, so we’re up to v1.1.  Woo Hoo!  Anyway, you can still get it on GIT.


If you have a WordPress website hosted on a secure server (HTTPS) and you try to put a YouTube video in a post or page, the video stopped showing up about 3 months ago.  This is because web browsers started to recognize that showing non-secure content (HTTP) on a secure web page makes the secure web page not secure anymore.  It used to be that you would just get a little warning in your browser saying that a page had mixed content and you could continue on at your own risk.  Apparently that wasn’t good enough, so the browsers just started blocking the non-secure content.  Bummer.

HttpsIn my day job at Lane Community College, one of my duties is to manage a blog network built around WordPress MU.  Luckily I’m just the guy that handles updates and things like that.  Some other guy has to field the several hundred potentially irritated people that can’t get videos to show up on their blogs.

So, here’s the tech version of what happened.  WordPress uses something called OEMBEDs.  This allows you to simply copy and paste the URL of a video on the YouTube website into a WordPress page or post and have that video show up.  Rather than having to use shortcodes, or plugins, or some other intermediate step, you just use the address of the movie.  Pretty slick, when it works.  As I mentioned above, it breaks when you’re on a secure server though.  What happens is that WordPress, as of about v3.6, looks at the OEMBED for YouTube and recognizes of you’re trying to embed an HTTPS link.  Then it sends a request to YouTube with the address of the video.  What breaks is when YouTube sends the video back it uses HTTP, even though you requested it using HTTPS.  Stupid.  

So, after that long, but very informative explanation, here’s the fix.  You simply install a plugin that adds a filter to WordPress.  When it sees something coming in with an HTTP address, it rewrites it as HTTPS.  Kind of a brute force way of dealing with a silly problem, but it’s working.

The plugin I wrote isn’t available on wordpress.org, but you can get it here on GIT.  

 

11Jul/13

Require Login For Single WordPress Page

By default, anyone who comes to your WordPress website can see any page on that website.  What if you want your website to be open to everyone, except you really need to have a page or two that only registered, logged in users see?  Example?  A company intranet, a calendar that’s only for family or a contact info page that’s only for family.  Whatever the reason, there are only a few ways to make sure a page isn’t open to the world.

Make the page private

You know what I mean.  When you’re editing your page you look over on the right side just above the Publish/Save button an see a “Visibility” option.  You can make that private and the page is hidden from the public, but it’s also hidden from all other registered users.  When set to private a page also doesn’t show up in the main menus or anywhere else.  It’s basically hidden from everyone from the one who made it private.

Password protect the page

Under that same “Visibility” section you can also choose “Password protected”.  This is good.  The page shows up in the menus and all that, but this option asks for a password for this particular page.  Basically, you set a password for this page and then you have to share that password with anyone you want have access to the page.  That’s not quite what I’m after.

Create a new page template

So, to recap, I wanted a page that shows up in the menus just like any other page but whose content can only be seen by users who have an account on the website and have logged in.  For all others, I want the page content hidden.  Here’s what I came up with because I couldn’t find a plugin that accomplished this without annoying upgrade messages or adding a lot of bloat for no reason.

  1. Create a new page template by making a copy of your theme’s existing page.php template.  I named mine “page_logged_in.php”.
  2. Once you have your page you need to edit the file in whatever editor you like.  I use Dreamweaver, but any text editor will work just as well.  The first bit of code you need to add names the template so you can find it later.  (This is what you’ll select in the WordPress admin when creating your new page.)  Just add the following code to the very top of the code.  There will most likely be something similar already there.  If so, just replace it.
  3. Now you need to add a little code to see if the user is logged in.  This is pretty easy.  WordPress has hooks built in for this.  The following can be added directly below the Template Name code above, also at the top of the page before any of the standard WordPress stuff.

     

  4. Now, go to the very bottom of the page and add the following code.  This will call wp_die() to halt WordPress and display a notice to the visitor saying they need to log in to view the page.

     This little snippet does a couple things.  If it runs (if the user isn’t logged in) then it halts the page and displays a message that says “To view this page you must first log in.”  The words “log in” are a link created by wp_login_url() which is another WordPress hook.  You may notice get_permalink() embedded in wp_login_url().  What this does is gets the address of the page you’re on so that when the user clicks the link to log in, they come back to your password protected page once they log in.  You can forward them pretty much anywhere you want, but I like to bring people back to where they started to minimize confusion.

  5.  

    Now just save the page template and upload it to your web server where your template files are.  Hopefully you simply duplicated page.php where it already lived, so this is a no brainer.

  6. Next, go to WordPress and create a new page.  Under “Page template”, select the new page template we just created.

  7. Save your new page and that’s all there is to it. That page will now appear just like any other page in your menus, but when a user who is not logged in tries to visit it, they will receive the notice you included above.

Hope this helps.  I looked for a way to do this for about a half a day.  This seems to be a simply way to go about it.

 

07Jun/13

WPMU LDAP plugin fixes

So, one of the little projects I’ve been asked to help with at Lane is to move a number of WordPress websites from an old WordPress Multi-User installation to a fancy new server with a WordPress Network (basically the same thing, just called a network since 3.something).  Anyway, they wanted to make it really slick, so the network admin set up a plugin to authenticate WordPress users against the school’s LDAP server.  In other words, each person (student, staff, faculty…) has a master user name and password for all things having to do with Lane.  Rather than have WordPress outside this, we use the WPMU LDAP plugin to allow users to log into their WordPress sites using their Lane credentials.  Pretty cool.

Couple issues came up though.  The servers at Lane are really tied down so they stay squeaky clean.  Little things that developers often don’t worry about display errors here.  What that does is just makes you, as a developer, really consider what you’re doing with variables.  Here’s what I saw…

Anyway, the WPMU LDAP plugin had a couple minor issues like using deprecated WordPress functions.  If you have found this post because you’re having the same problem, you can download the fixed plugin here.

Please remember that this is for wpmuldap_4.0.2, so check the plugin page on WordPress’s website to see if there isn’t an updated version of the plugin.  I’m about 5 minutes away from contacting the developer to see if he would like to fork my fixes.

28May/13
Halfshell-150x150

Music on the Half Shell

FINALLY!  After about 3 years of talking to the Half Shell Committee about taking over the website, I have it.

If you’re not from Roseburg, OR, Music on the Half Shell (MOTHS) is a local deal where live bands play in a half-shell erected in a local park (Stewart Park).  The concerts are free to the public and are usually pretty popular.  Sometimes to the tune of (excuse the pun) 9,000+ people.  Kind of  a big deal.

Anyway, the original website was done by one of the sponsors who also does the posters and much of the printed materials.  While they do an awesome job on the printed materials, the website just wasn’t being maintained the way it deserved.  Anyway, they made me the offer and I jumped on it.  Fun website to work on.

 

Halfshell

What I’ve done so far is to use the artwork from Creative Images (great artwork, by the way) and build the website around it.  Or, to be more specific, on top of it.  The home page has an accordion script that shows the current season’s shows in a pretty cool way and links to a concert details page with links to the artist’s website, YouTube channel, Facebook page and Twitter feed.  There is also a button to create a downloadable .ICS file so you can import the concerts into your electronic calendar.  

This last weekend I also added a F.A.Q. to answer some of the most common questions that come up, like Can you bring your own food? and When do the concerts start?  

Upcoming work is to get the list of vendors (food mostly) and sponsors on the website (just waiting on those lists) and a few other upgrades like making the website responsive so that it works on mobile devices as well as your desktop computer and possibly adding a text message option so you can opt-in to receive text reminders of upcoming concerts.  Pretty cool stuff, I think.

So, check out the website, come to a concert and have a great summer!  

Oh, and let me know if there’s anything you would like to see on the website.  I want to make it useful for the community at large. 

01Apr/13
section508-150x150

Section 508 (Website Accessibility)

Section 508Working with Lane Community College I have to make sure my work conforms to Section 508.  Very big deal for education, and anyone who wants their website available to the widest possible market, really.  It used to be that blind folks and people with certain disabilities were just kind of ignored as far as the web goes.  That’s not the case anymore.  Screen readers have come a long way.  Just for fun I used the accessibility functions on my iPad last week.  It’s pretty amazing just how clear of a picture you can get of a web page without your eyes assuming all the proper “stuff” has been done.  Doing the audit on the DQP website really opened my eyes (no pun intended). 

Officially the law only requires government agency web sites to be accessible, but, if you have a web site, why would you not want those who need assistive technology to be able to use your website.  Even if the only thing on your website is your name, phone number and address, you still want the blind guy across town to spend money at your place of business, right?  Imagine if all your competitors don’t have the forethought to do the work on their website and yours is the only one the aforementioned blind guy across town can read…

Anyway, here’s some official stuff about Section 508.

In 1998, Congress amended the Rehabilitation Act of 1973 to require Federal agencies to make their electronic and information technology (EIT) accessible to people with disabilities. Inaccessible technology interferes with an ability to obtain and use information quickly and easily. Section 508 was enacted to eliminate barriers in information technology, open new opportunities for people with disabilities, and encourage development of technologies that will help achieve these goals. The law applies to all Federal agencies when they develop, procure, maintain, or use electronic and information technology. Under Section 508 (29 U.S.C. ‘794 d), agencies must give disabled employees and members of the public access to information that is comparable to access available to others. It is recommended that you review the laws and regulations listed below to further your understanding about Section 508 and how you can support implementation.

Section 508 of the Rehabilitation Act (29 U.S.C. ’794 d), as amended by the Workforce Investment Act of 1998 (P.L. 105 – 220), August 7, 1998

(original source in uscode.house.gov)

If you would like an audit done on your website, and a quote on making sure those with disabilities can use it, shoot me an email.  I’m happy to spend a little time.

22Mar/13

Google ChromeFrame

In my new day job, I came across a problem today that I had never seen.  The application I’m working on requires an inordinate amount of JavaScript (in the form of jQuery).  Basically I’m display large amounts of data from a database in a graphical form using jQuery Spidergraphs.  The problem I ran into is that large institutions, such as LCC, are still using Internet Explorer 8 on Windows XP machines because of other software limitations.  The particular jQuery that I’m using needs the <canvas> HTML5 tag in order to display the data, and IE8 doesn’t even know what the <canvas> tag is about.  

After a couple hours of beating my head against the wall and trying different DOCTYPE declarations, I finally figured out that it was in fact the lack of <canvas> that was my problem.  A co-working pointed me to ChromeFrame.  This nifty little script looks at the browser that’s loading a page and, if it’s IE that doesn’t support <canvas> (and other things) it throws up a warning and offers to install a little utility to help you out.  Once you say ok, everything works just like it’s supposed to.  Pretty good time saver.  Not sure why everyone doesn’t just install it.

 image

18Mar/13
screenshot_16-150x150

DQP (The Degree Qualifications Profile)

The DQP Project in Oregon is a joint effort of all seven Oregon University System (OUS) institutions and the state’s seventeen independent community colleges to develop the Degree Qualifications Profile for Oregon. The DQP Project in Oregon will provide a descriptive curricular framework for describing institutions’ degree outcomes across the state, both in their unique characters and in their shared aspects. The project relates directly to the missions of each institution to support their students’ success during college, upon graduation, and in transitions within the Oregon educational system. This statewide partnership of educational institutions has the active support from both the Oregon University System (OUS) Chancellor and the Oregon Community Colleges and Workforce Development (CCWD) Commissioner.”

Now that we have the “official explanation”, here’s why I’m talking about it.  I have been hired for the duration of the DQP grant to act as DQP Web Applications Developer working on-site at Lane Community College.  The project is pretty cool.  Lots of technology and lots of awesome people in the IT department at Lane.  

I started full time with them early in December 2012 and will be there until sometime mid-2015 working on this and other related projects.  The DQP is my core responsibility, so that’s what I’ll talk about here.  I’m going to break it up by section though.  Otherwise this would be one really long post.  

The website itself is set up so that member institutions have one place to go to get and store information on the DQP program.  There is a public side (with public data for everyone to see) and a secure side (where the institutions go to input data that feeds the public side).  

screenshot_16

The design of the site is pretty basic.  Logo, mega-menu, breadcrumbs, custom PHP stuff, footer menu…  The entire site layout is CSS with tables being used ONLY for tabular data.  Just the way it’s supposed to be.  I took a lot of time to make sure it loads properly in recent browsers (back to IE 8) and loads quickly considering how much “stuff” is going on behind the scenes.  

Stay tuned for posts about specific areas of the website.  It’s pretty cool stuff.  

If you want, you can check out the DQP at http://www.oregondqp.org

25Oct/12
Mercy-Hospital-Nampa-Idaho-Custom-Calendar-150x150

Mercy Medical Center – Nampa, ID

Mercy Hospital in Nampa Idaho is a client of BBG Marketing.  Mercy wanted a calendar created for their website so they could input events and have them come up in order with certain details, like time, duration and location.  At the time there just weren’t any open source applications to install, so I wrote them custom application to suit their needs.  It was pretty cool.  They could add, edit and duplicate events with a few clicks and they would display through the day of the event, then disappear.  

Mercy Hospital - Nampa Idaho - Custom Calendar

For the events that recurred every week, the calendar would display the single event with multiple dates, but as the date passed, it would disappear leaving the rest of the dates for that month.  Seems simple, but it was quite the ordeal.

I always liked working for Mercy Nampa.  A couple years ago their parent corporation, or whatever you call the big group a hospital belongs to, changed hands and the new company had internal web guys.  They had me help with the transition and even had me take care of a few things before the final change, but I haven’t worked on their stuff in a while now.  I’ll have to check out the current site.  See if it’s as good as the work I did.  :)

23Oct/12
Brent-Gunter-E-Commerce-and-Contact-List-Integration-150x150

Brent Gunter (Musician)

Brent is a musician from the Portland area.  He spends a big chunk of the year traveling around doing concerts and needed a way to sell tickets on his website.  He already had the website, but had no idea how to integrate PayPal and a shopping cart.  He called me and I took care of him.  Not a huge project, but it was a pleasure listening to his CD while I worked.

Brent Gunter - E-Commerce and Contact List Integration

He also had an email list he needed to be able to manage through his website.  Pretty easy stuff these days, but it used to require some javascript editing to get those list managers to look like your site.  I think it came out really well.