Category Archives: Uncategorized

Theme Change

A new year, a new theme. I’ve changed to the Twenty Fourteen theme to see what’s great about the latest default theme from WordPress.

Advertisements

Ticket 18164

First contribution to core!!

http://core.trac.wordpress.org/ticket/18164

Jane Wells has recently mentioned on the WordPress Development blog that there are still many open tickets in WordPress 3.3 Beta 2. Poking around the trac report linked from that post, I found that ticket 18164 was still open.

This ticket has been around for some time but no one seemed to want to take it up. Network admins can add themselves to individual sites in a WordPress Network. They can also promote or demote themselves from the Network Admin screen. However, if they are in the User settings on an individual site’s Dashboard, they cannot demote themselves. They’ll get an error message now allowing them to do so because the new role does not have the “promote_users” capability. This makes sense for normal site admins. It would be disastrous if they lost admin access to their site through a misclick. Network admins can always give themselves admin access again through the Network Admin screen.

The fix seemed simple enough, the code just has to check that the user is not a super admin before giving the error message. My first attempt at a patch involved using current_user_can( 'manage_network' ). nacin responded very quickly and suggested using is_super_admin() instead. I updated the patch and submitted it again. In short order the ticket had been closed and set to fixed.

The actual code committed (Changeset 19024) is different from my original patch. The redundant brackets have been removed and the unnecessary user ID has been taken out from the function argument. However, this still marks my first contribution to the core code of an open source project 🙂