Monthly Archives: December 2010

Looking back at 2010

2010 was a wild year for me, one that I’ll look back on as a turning point in my professional and personal life. For that reason I thought I might take stock of the past year. (Here’s 2009’s post.) If you are one of those snobs who think that year-end retrospectives are schlocky, feel free to get the hell out of my blog.

As 2010 opened, I was working full-time as the educational technologist by Queens College. I believed strongly (and continue to believe) in the importance of the work I was doing there, but I already knew a year ago that I wouldn’t be able to stay at the job for much longer. I identified as an ed tech, and part of the (really great) ed tech community, but it was a label that never really felt right. When people asked what I did for a living, I hesitated. I left the job near the end of May.

Since then, I have been supporting myself doing custom web development, almost exclusively using BuddyPress. In the last six months, I’ve transitioned from an uneasy edtech to a confident (though still n00bish in many ways) developer. It’s a classification that feels better in many ways. Moving into development has allowed me to be personally productive in ways that the structures of my old career simply couldn’t support. I produce a lot of software that is used by a lot of people; moreover, I am moving toward a position where I get to select only those projects that are of independent interest to me. Measured like this, 2010 was the most productive year of my life, made possible by the career move (and the new self-identification that came with it).

My move into development is not without misgivings. As an educational technologist, working in the confines of a traditional university, there were always connections (sometimes tenuous, but always discernable) between my day job and my identity as a graduate student. Granted, in the time I was at Queens – first as a graduate fellow and then as a full-timer – I made next to no progress on my dissertation. But the fact that I was in a university, and enabling teaching and learning in a hands-on way, kept me in constant communication with my inner philosopher: drawing on my teaching experience, speaking in academic tones with faculty members, engaging in debates on the goals and methods of educational technology in ways that never strayed far from the kinds of discourse I learned in the seminar room. My work as a developer, in contrast, is much less explicitly academic; while some of my projects (notably, the CUNY Academic Commons) have sustained my contact with the university, mostly I am paid to think about software and websites rather than anything else. In the short term, this will undoubtedly be a good thing – I attribute the progress I’ve made on my thesis in the semester since I left Queens College to the fact that my day job provides me with some much-needed release from the mental anguish of the university life. But the more I make a name for myself as a developer, where ‘developer’ is unqualified by ‘academic’ or any similar modifier, the more I have to make conscious decisions about how (and whether) I want my paying gigs to connect with my academic interests. It’s an issue I’ll continue to wrestle with in 2011.

Paralleling my move into a development career has been an increased participation in the WordPress world. In July I was made a moderator on the buddypress.org support forums. In October, I was brought on as a committing developer for the BuddyPress project. I spoke dozens of times through 2010 on WordPress and BuddyPress, at WordCamps, meetups, conferences, THATCamps, and various other fancy places. At the beginning of 2010 I felt like I’d staked out a position on the outskirts of the WordPress community; at the end of 2010, I feel like I’m much closer to its center. And while I could live without the occasional drama, tunnel-vision, and personality cultishness of some WordPressophiles, for the most part it has been a real treat getting to know, and getting to work with, so many of the best WP developers. It’s broken me out of that other echo chamber I come from (academia), made me a much better coder, and introduced me to some really fabulous folks.

In 2010, I also got more and more tangled up with the digital humanities community. In July, I spent a week at the Center for History and New Media for the One Week | One Tool project, where I was on a team that built Anthologize. I attended a number of THATCamps and was witness to a number of Twitter arugments of truly epic proportions. And while I could live without the occasional drama, tunnel-vision, and personality cultishness of some DigitalHumanitiesophiles, for the most part it has been a real treat getting to know, and getting to work with, so many of the best digital humanists. (Is there an echo in here?) My intellectual connection with DH is such that it is hard for me not to put scare quotes around ‘digital humanities’ every time I write it: I am an academic, and I do extensive work with digital technology, but the connection between the two is not manifest in my own work. Still, DH in 2010 has been an exciting place to locate oneself, with cool projects, smart people, and the occasional Big Idea rising to the top over the course of the year.

I continued being a dork in 2010. I came in 66th at the American Crossword Puzzle Tournament (breaking 50 in 2011! You read it here first!). I switched from QWERTY to Dvorak. I visited the Googleplex. I wrote a lot about pizza and barbecue. I made the decision to stop buying Apple products. I completed Angry Birds. I wrote 45 blog posts on Teleogistic, with a smattering of posts elsewhere. Teleogistic got 960 comments. I wrote many tens of thousands of lines of code, much of which was terrible, and much of which is sadly hidden forever on client servers, but some of which is free and helpful to many.

On June 5, 2010, I got married. I mention this last not because it is the least important event of the year but because it is the most. The process of preparing for a wedding, with the help and support of so many friends and loved ones, was something I will never forget. The wedding day was the most perfect day I can remember. And the girl I married – well, duh, she is the best part of 2010, or of any year.

The changes of 2010 were more significant for me than any year since I was in college. Nearly all of those changes have been for the better. I have some exciting plans for 2011, but for now I am happy to reflect on the year that was. For me, it was a good one.

Wildcard email whitelists in WordPress and BuddyPress

Cross-posted on the CUNY Academic Commons Development Blog

WordPress (and before that WPMU) has long had a feature that allows admins to set a whitelist of email domains for registration (Limited Email Registration). On the Commons, we need to account for a lot of different domains, some of which are actually dynamic – but they are all of the form *.cuny.edu. WP doesn’t support this kind of wildcards, but we’ve got it working through a series of customizations.

These first two functions form the heart of the process. The first one hooks to the end of the BP registration process, looks for email domain errors, and then sends the request to the second function, which does some regex to check against the wildcard domains you’ve specified. This is BP-specific, but I think you could make it work with WPMS just by changing the hook name.


function cac_signup_email_filter( $result ) {
	global $limited_email_domains;

if ( !is_array( $limited_email_domains ) )
		$limited_email_domains = get_site_option( 'limited_email_domains' );

$valid_email_domain_check = cac_wildcard_email_domain_check( $result['user_email'] );

if( $valid_email_domain_check ) {
		if ( isset( $result['errors']->errors['user_email'] ) )
			unset( $result['errors']->errors['user_email'] );
	}

return $result;
}
add_filter( 'bp_core_validate_user_signup', 'cac_signup_email_filter', 8 );

function cac_wildcard_email_domain_check( $user_email ) {
	global $limited_email_domains;

if ( !is_array( $limited_email_domains ) )
		$limited_email_domains = get_site_option( 'limited_email_domains' );

if ( is_array( $limited_email_domains ) && empty( $limited_email_domains ) == false ) { 
		$valid_email_domain_check = false;
		$emaildomain = substr( $user_email, 1 + strpos( $user_email, '@' ) );
		foreach ($limited_email_domains as $limited_email_domain) {
			$limited_email_domain = str_replace( '.', '.', $limited_email_domain);        // Escape your .s
			$limited_email_domain = str_replace('*', '[-_.a-zA-Z0-9]+', $limited_email_domain);     // replace * with REGEX for 1+ occurrence of anything
			$limited_email_domain = "/^" . $limited_email_domain . "/";   // bracket the email with the necessary pattern markings
			$valid_email_domain_check = ( $valid_email_domain_check or preg_match( $limited_email_domain, $emaildomain ) );
		}
	}

return $valid_email_domain_check;
}

Before WP 3.0, this was enough to make it work. The latest WP does increased sanitization on the input of the limited_email_domains field, however, which makes it reject lines like *.cuny.edu. The following functions add an additional field to the ms-options.php panel that saves the limited domains without doing WP’s core checks. (Beware: bypassing WP’s checks like this means that there are no safeguards in place for well-formedness. Be careful about what you type in the field, or strange things may happen.)


function cac_save_limited_email_domains() {
	if ( $_POST['cac_limited_email_domains'] != '' ) {
		$limited_email_domains = str_replace( ' ', "n", $_POST['cac_limited_email_domains'] );
		$limited_email_domains = split( "n", stripslashes( $limited_email_domains ) );

$limited_email = array();
		foreach ( (array) $limited_email_domains as $domain ) {
				$domain = trim( $domain );
			//if ( ! preg_match( '/(--|..)/', $domain ) && preg_match( '|^([a-zA-Z0-9-.])+$|', $domain ) )
				$limited_email[] = trim( $domain );
		}
		update_site_option( 'limited_email_domains', $limited_email );
	} else {
		update_site_option( 'limited_email_domains', '' );
	}
}
add_action( 'update_wpmu_options', 'cac_save_limited_email_domains' );

function cac_limited_email_domains_markup() {
	?>

<h3><?php _e( 'Limited Email Domains That Actually Work' ); ?></h3>

<table class="form-table">
	<tr valign="top">
		<th scope="row"><label for="cac_limited_email_domains"><?php _e( 'Limited Email Registrations' ) ?></label></th>
		<td>
			<?php $limited_email_domains = get_site_option( 'limited_email_domains' );
			$limited_email_domains = str_replace( ' ', "n", $limited_email_domains ); ?>
			<textarea name="cac_limited_email_domains" id="limited_email_domains" cols="45" rows="5">
			<br />
			<?php _e( 'If you want to limit site registrations to certain domains. One domain per line.' ) ?>
		</td>
	</tr>
	</table>

<?php
}
add_action( 'wpmu_options', 'cac_limited_email_domains_markup' );