An old drawing of an owl.

Simple Content Restrictor Plugin

Origin Story I had a number of emails from people trying to restrict content in various ways. One person wanted to restrict access because they were editing previously published content. Another person wanted more of a traditional membership-style option with the ability to restrict certain content based on user roles. I looked at some of the plugins out there but felt that building something a little less corporate1 would be pretty easy. It’ll likely evolve as I get some people using it but it’s here now if you want to mess with it. Making It This plugin uses the Advanced Custom Fields plugin as it saves me tons of hassle building custom field interfaces. ACF Stuff First, these two pieces enable me to sync up ACF field data without the drama of import/export or hard coding it into PHP.2 Now, I started off hand-writing the user levels as items. While easy, it felt wrong because there might be other user levels created by other plugins and they’d end up left out. I realized I could just add the user roles automatically like so. This will list all the user roles on the site as options. Filtering the Content My original idea was that I could just use use WP’s content filter. That is what I did but things got more […]

A screenshot of the WPlus layout. It's masonry and pretty minimal.

WPlus WordPress Theme

Origin Story There once was a group who really liked Google Plus. With the demise of the service, they were unhappy. With this request, I wondered if we might just build a very similar experience in WordPress. I think I ended up getting pretty close. The Look The theme is built using our normal pattern of bending Understrap so it uses Bootstrap at its core. The theme is here. I don’t know if this works decently or not (vertical slider gets kind of lost) but I took a shot at making the WordPress theme comparable to the Google Plus layout using juxtapose. If you’re anything like me, you have no real memory of what Google Plus looked like and I want you to appreciate this. Luckily I still have access to G+ through my VCU account for at least a while longer. The Masonry Grid I didn’t think too hard when I opted to make the initial masonry layout.1 I used what seemed like a really handy path. What I didn’t pay attention to was that this particular masonry-sort goes top to bottom and then left to right. Since that was brought to my attention, I’ve gone back to the G+ layout and tried to see more logic behind how they did it and what the sort order is but […]

12

Checkboxes exposing more content

The basic idea here is that if you check all the boxes, more stuff will be shown. Right now it’s set to need all 6 but it could be any number. Once again, it’s an ugly demo that we didn’t end up using but I can see this being useful in the future and it’s easier to find it on my own site than in Codepen’s dashboard. See the Pen build an online class form by Tom (@twwoodward) on CodePen.

Shows the question prompt following the first video. There's a bit of code and stuff in the background to try to give context.

YouTube Choose Your Own Adventure Interaction

This was a quick demo built to show how we could mix videos hosted on YouTube with viewer choices at the end of those videos that cause other videos to load. There’s a bit of work around what the visuals would be like for a user but nothing aggressive.1 If you play the first video (around 5 seconds),2 you’ll get a prompt that partially obscures the video and then loads a new video based on the button you click. The people ended up going with Story Line or something like that but I liked this enough to write this post and figure it’ll come up again some day. With interest from someone, it’d be something that could be pretty easily built into WordPress as a plugin. See the Pen youtube end event by Tom (@twwoodward) on CodePen. 1 That means it’s ugly but I don’t want you to judge me. 2 Which is pretty short but I still fast forward it.

Small red plastic toy shovel.

An Option for dealing with CORS

As we do more things with JSON, I run into CORS access issues. They can be solved in various ways but it’s often a hassle. It often irritates me as I build demos in COde After wanting a simple solution this AM, I made this tiny, insignificant PHP file that I think might be useful to others. Name this file cors.php.1 Put this file on a server. You can now append some JSON URL to that URL like so … https://yourserver.com/cors.php?url=https://someurl.com/data.json and it returns drama-free JSON for your use and enjoyment. Assuming you have HTTPs on your server it should also deal with HTTP/HTTPS conflicts as well which is very handy at times. 1 Or name it whatever you want. I’m going using bossiness as a shortcut to clarity.

The character Snarf from Thundercats rubbing its hands.

Sliders as Inputs

Origin Story There once was a worksheet that was meant to be used in a face-to-face scenario. The goal was indicate where you fell on a spectrum across a number cultural orientation of measures. The challenge was to transform that into something digital that could then be part of a larger conversations. Watch the video above to get an idea of what the experience is like or this will make even less sense. The Sliders I like sliders as interface elements for things like these.1 You can see the HTML below that builds them or check out the Codepen for more CSS etc. That’s all pretty straight forward. I did have to add the input tag to the KSES allowed list to keep WordPress from stripping it out. To do that I added the following to our KSES modifier file. Getting the Values Now I needed some javascript to look at these sliders and record the values as the sliders were . . . slid in various directions. This little bit gets our values once we loop through the sliders that exist. Simple. Gravity Forms Integration I did this via Gravity Forms because it’s fast and I’m overly comfortable with it. This is where things get a bit weird. We’re using a typical Gravity Forms to post scenario. Nothing odd […]

04

ANTH 101 – A Deeper Dive

It’s been a good while since I had the pleasure of working with Mike Wesch and Ryan Klataske on ANTH 101. I revisited the course recently to write a letter of support for an award submission for online courses. I am posting an extended version of that letter below because I think it paints a path with online courses that is rarely followed but is, nonetheless, replicable and worth considering. Bigger Picture? I see ANTH101 as a path forward that makes me hopeful in an online space that seems increasingly depressing.1 You have two races currently in online learning. There is a race to be the cheapest and easiest place to enroll.2 This article on Liberty “University” paints that picture pretty well. This world will be like the fast food industry in many ways. How uniform can we make things? How automated? What’s the least we can pay the fewest humans? The only path to profit will be through ridiculous scale. There will be very little difference between these providers. They will use LMS products that are very similar while following very similar online course rubrics and probably (poorly) paying many of the same adjunct/itinerant online course faculty. Additional sadness will occur when the same OPM is creating content, marketing etc. for multiple universities for the same courses and programs.3 […]

An old drawing of an owl.

Building an ACF-Based Grade Book Plugin in 30 Minutes or Less

Origin Story Kathy asked me if I had any grade book plugins that they could use with a faculty development course. The goal was to show faculty where they were in the course. I knew I did not wish to use Learn Dash for any number of reasons– grade book module costs extra, grade book module is super awkward, learn dash requires a fresh multisite install etc. I also had WPLMS from a few years ago when I think Jon asked to try it out. This felt pretty bloated for what we wanted and it wasn’t entirely obvious if it had a grade book in any case. The WordPress plugin repository shows three plugins and the most up to date has not been updated in 3 years. Not a cheerful landscape. I wondered what it would take to build an ACF-based grade book relying mostly on the repeater field and simple shortcode for displaying the grades to the user. I wasn’t looking to do math or anything. I just wanted a pretty simple interface and a way for users to see their information while administrators could see all the content. That does require people to have accounts and be logged in. A bit of hassle but there is no free lunch.1 This grade book isn’t adding up things or doing […]

23

H4 Widget Headers – Incorrect Nesting Fix

Nothing fancy here but I’m documenting it for the benefit of beginners or people who don’t do this at all. It seems most of the widgets in WordPress automatically give you h4 headers when you add them to the sidebar. That seems to go against the idea of nested and orderly headers that WCAG accessibility wants. Granted, I’m not an expert and reading their documentation seems more painful than it should be. I do know that the SiteImprove checker flags it on the site I’m working on so I turned to javascript for a fix. What I need to do is take the HTML below and remove the H4 element and replace it with a div. I add a class so it’s easier for me to repeat the style that the H4 element had. As is typical for me, I did it on one element first and then I move to see if I can make a more generalizable function. Now I need to repeat this for the other 3 or 4 widgets. I could just copy it over and replace it but I’m really only dealing with two variables so making a decent function makes sense. I need to select the specific ID of the widget and I need specific replacement text. That leads to a function like this. […]

An old newspaper ad showing an automatic printer.

Get the PDFs – Google Search to Google Folder

Here’s a neat little pattern that might interest others. We got a version of the question below yesterday. Is there a way to automatically get the links from the search linked below into a spreadsheet? https://www.google.com/search?q=site%3Aedu+filetype%3Apdf+syllabus+education&oq=site%3Aedu+filetype%3Apdf+syllabus+education Then, from there, is there a way to automagically get the pdf files into a Drive folder? Step 1: Get Google Search into Google Sheets At first it seemed this would be really simple. Amit1 had done this really well back in 2015. Unfortunately, Google has started blocking this . . . even when you do it within Google Sheets/Scripts. This made me sad. Browser emulators and Python were dancing in my head but it seemed a bit too complex for a one time action. Instead of over-complicating things, I opted to use a Chrome plugin called Scraper. I’ve had it installed for a long time. It lets you easily do xpath scraping of websites. You can see in action in the video below. I also used the search settings to change the number of sites per page up to 100. Once I captured the info to the clipboard I just pasted it into Google Sheets. Step 2: Save the PDFs Now I just needed to loop through the URLs and save the PDFs to a particular Google Folder. This google script gets my […]