Parsing WordPress URLs for fun and profit

I’m writing this post at Yvonne’s urging, as she suggested that this might be of broader interest than just me feeling pleased with myself and bragging to her.

What monumental achievement have I achieved? Only this: I’ve just made my grading easier, by figuring out how to parse WordPress URLs.

Oh BTW, by way of background: I use WordPress as my courseware platform, almost exclusively. About the only thing I don’t do in WP is give grades: for that I use Sakai, and provide a link on the course WP site to the course Sakai site. I’d like to use WP for grades, and in fact the admin of the campus WordPress instance and I spent some time last year trying to get KB Gradebook working, but we were never able to resolve a server-side permissions problem. But that’s neither here nor there. Point is: WordPress = course platform.

I have an assignment in my Digital Libraries course that I call Environmental Scanning: students are required to post to the course WP site at least once a week, on any topic having to do with DLs. This is actually kind of a gimme assignment, since once you start paying attention, almost everything in the ILS news (and half of the stuff in the mainstream news) has to do with DLs (or at least with collections of digital stuff, and the management thereof). But the purpose of the assignment is to get everyone contributing interesting stuff to the Great Conversation that is the course, and I’ve been pleased over the past several semesters in which I’ve used this assignment how well it works. I can only pay attention to so many news sources, blogs, Twitter feeds, etc. Distributing the effort brings in so much more interesting stuff than I could find on my own. In fact, if I have a criticism of this assignment, it’s that it works too well: students’ posts come in so thick and fast that I can barely keep up. And if I can barely keep up, I’m sure that many students are just ignoring many posts, and thus missing out on some interesting stuff. I’m thinking of changing the assignment to require bi-weekly posts instead of weekly. But anyway…

Now that it’s the end of the semester and it’s all grading all the time, I’m faced with the problem of having to figure out whether each of 24 students posted an Environmental Scan post at least once per week. (Yes, I should have been keeping up with this weekly all semester, and mostly I was… but I still need to check for the past few weeks, when I’ve let it slip a bit. Plus because I’m compulsive I feel the need to double-check the whole semester.) Of course the WP Dashboard gives you a list of users and the number of posts each has made. So I could just go through the list one student at a time, and count posts week by week. But really, let’s face it, that’s a total pain in the tuchus.

So I thought: There must be a better way. And so I decided to try to figure out how to parse WordPress URLs, to see if I could figure out a way to identify: posts by a specific student, within a specific week, tagged with a specific tag. And in fact there are two ways to do this: from the WP front end, and via the Dashboard. Like this:

http://{blog}/author/{username}/?tag={tag}&y={year}&w={week_number}

https://{blog}/wp-admin/edit.php?tag={tag}&author={author_number}&y={year}&w={week_number}

To provide a specific example: My DL course site is inls740.web.unc.edu (INLS 740 is the course number — not a very creative site name, but hey, at least it’s unique). Say I want all the posts by user jpom (me), made in the week of February 6 (the week of the iConference), with the tag iConference. Here are the URLs for that query:

http://inls740.web.unc.edu/author/jpom/?tag=iconference&y=2012&w=6

https://inls740.web.unc.edu/wp-admin/edit.php?author=308&tag=iconference&y=2012&w=6

Though of course you won’t be able to resolve that second URL if you’re not a member of the course site, since you have to be logged into web.unc to get access to the Dashboard.

That aside, let me break those URLs down. My username is jpom, & username is used on the front end. In the Dashboard, author number is used instead, & I’m number 308. (I dont know why it’s different on the front end & the Dashboard, but it is.) The tag in question is iConference. Year is 2012. Week is 6; that is, the 6th week of the year. (In the Settings, I have Week Starts On set to Monday; I haven’t experimented to see if w= changes according to this setting.)

As an aside, you can specify month using m=#, for something like this: …&y=2012&m=2 or more simply …&m=201202. To use categories instead of tags: replace tag={tag} with category_name={category}.

So now I just insert the usernames of my students, the tag environmental-scanning, and the appropriate week of the semester in the URL and voilĂ . Grading just got that little bit easier.

This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>