WordPress gets complex as a multisite get bigger. Things that worked at smaller scale start dying. I’ve long wanted to be able to run a report on all the active plugins on our multisite but it always timed out before it would complete. This script will spit out 1001 sites at a time into a table and list any active plugins. It’ll also add pagination to go forward below the table. That same pagination can be manipulated directly in the URL by changing /?id=1 to whatever number you’d want. I was attempting to do this with MYSQL and OFFSET but ran into timeout issues when I hit LIMIT 4000 and OFFSET 3200 (displays 800 records but starting at the 3200th record). It was an awkward and inefficient and ultimately broke. I learned some things though. This was the WordPress.com post that got me moving in the right direction. I’d searched for ways to batch call MYSQL statements but wasn’t quite getting what I wanted. Looking at it now, it makes sense and I feel like I should have seen that path sooner but it’s now a pattern I understand and will be using in some other ways as well. I should be able to roll all the results into one big variable and spit it out, or write it incrementally […]
flickr photo shared by The Library of Congress with no copyright restriction (Flickr Commons) The title just rolls off the tongue, yes? But what it does is kind of interesting. It’s not a drag/drop solution but it starts to show how we can better knit different services together. In this case, I run a Google Script to generate a spreadsheet of files (I can probably make that a straight up API connection in the near future). I publish that spreadsheet as CSV because Google sheets to JSON feels a good bit slower.1 Then the following shortcode (but w/in square brackets) generates the little unordered lists below. It’s taking that list of 464 files and just chopping out the ones where the filename’s first letters match A-1 and the parent folder is Tasks. Not brain surgery, right? But it is a pretty flexible solution to allow flexible access to any chunk of CSV (should work on any CSV on the web- assuming you adjust the elements to reflect the data) text you want to display portions of on the fly. People can do all their work in Google Drive and it seamlessly updates in WordPress. People without WordPress skills can update and change where these lists appear through a simple shortcode. To be clear, this is an integration rather than an […]
flickr photo shared by The U.S. National Archives with no copyright restriction (Flickr Commons) I believe this is safe but I’m no security expert. Every thing I could find on XSS issues was focused on stealing passwords. WordPress feeds are all public and require no login so I think it’s all good. StackOverflow seems to agree. With that hearty and confidence-inspiring endorsement, I give you this amazingly complicated plugin to allow access to all your WordPress feeds from other stuff (like Kin’s github rss reader)1 All simple stuff really, the key piece was getting the right trigger pre_get_posts. Otherwise it was called too late. is_feed is the other little handy piece which Tim Owens mentioned . . . and I subsequently used. 1 See how my site says success and Jim’s says failed? It’s only partially because he abandoned our country for Italy. It’s also because he doesn’t have this plugin turned on.
flickr photo shared by Thomas Hawk under a Creative Commons ( BY-NC ) license This is in response to something Adam Croom wrote two(?) days ago. I thought it’d be an interesting proof of concept and would let me figure out some things with a purpose. I also like to have a few projects going on at once so I have things to switch between when I get frustrated. I also see this kind of information pushing/pulling as broadly applicable. Some of this stuff is no doubt uglier than it had to be but I’ll try to show some intersections that happened to occur with other projects and how certain steps might be ignored entirely if you want to be all efficient and stuff. The final plugin is here and should be a decent start to any customized import you want to run against a CSV file. Adam had information in Discogs. He wanted that information in WordPress where he could control it. I had never heard of the site, let alone seen its API. But it well documented and it took me a few minutes to realize I could get all the data I needed without even needing to authenticate. The user data was associated with collections and appending 0 would get me the root level stuff. With Adam’s […]
Students writing short papers and posting them for comments from other students is a fairly common pattern among VCU faculty. It’s a nice entry point because it doesn’t require any radical rethinking but still starts to expand the audience for the work, has possibilities around peer review, and is a possible gateway to writing on the web more natively. There are lots of ways to do this. I’ll break down one option path here. The faculty member wants students to keep writing in Word. There’s no immediate interest in writing in WordPress or in Google Docs. The goal is to have comments made by other students on the document as a whole (not specific to words/phrases/sentences/paragraphs). Initial Setup – The Form We setup a Gravity Form to create a post with a document embedded in it using Google’s document viewer. You can explain it as mail merge into a WordPress post or if that doesn’t help you might show them this image as most people have been on the failure end of a mail merge attempt. You’re probably want a minimum of three fields for the user to fill out and you’ll have two that are invisible to them. The three you’ll need for the student are their name, the title of the document (the post will get this name […]
This post is going to be a bit like my head- a jumbled mass of things that are interconnected in my head but may not make any sense to anyone else. But what else is a blog for but for getting a better idea of what’s in your own head? Blogging in General The group I’m a part of (ALT Lab) has been struggling with blogging for a while now. We were/are aiming for a post a week for each member of the group. It’s not easy for many of us.1 It’s a pattern I’ve seen with lots of organizations and lots of individuals. You’ll have the usual pattern that varies somewhere between not knowing what to say, not having anything worth saying etc. The end result is that people don’t write. If you talk to them they’ll have a million things that would be interesting to read and that would be “worth” sharing. Maybe not having time gets referenced but given it’s a desired piece of our work, that’s not our issue. It feels mainly like it’s a holdover from time in formal education. Writing ends up becoming something done for an omniscient expert who will pass judgement on thee. It happens to me at times- both time limits and wondering if there’s any audience or purpose to what […]
I made a filter a while back to keep people who were associated with blogs through the bbpress/buddypress auto-enrollment feature from having tons of sites show up in their My Sites list. It was never a perfect solution and felt sloppy because it relied on having only one role and that role being bbp_participant. It also failed when I un-network activated bbPress because it couldn’t filter people who had no role (and there was still some invisible connection). And the final nail was that it seemed to fail intermittently and I had no idea why. Here is a very different path to the same result but one that appears to work better and will be proof against the ‘no role’ issue that hampered me earlier. It’s all made possible by the delightful array_interesect function. It’s one of those things that I am confident I’ll use down the road. I have no idea if it’s as commonly known as ABC or whatever but I had no idea it existed. This actually came to fruition on a plane trip because Mark Luetke told me about Varying Vagrant Vagrants and I was able to spend about twenty minutes working on this even without Internet. It has also made me reflect that lack of interruptions really improves my productivity on things like this.
I’m trying to do a better job documenting how to do some of the things people ask me to do. I’m doing it anyway, might as well do the documentation and share the love. This was request to make a gallery page from/for a series of interviews on listening for a music appreciation course conducted by the wonderful Steve Ashby. This particular series was done in pages and, very helpfully, they were all child-pages of a particular parent-page which makes this really very easy.1 The page-list plugin will make this very easy.2 I think it was one that Alan pointed out at sometime in the past. In any case, I can see the parameters for the shortcode here. We want all the child-pages and to show some sort of image. All we need to make that happen is this shortcode [pagelist_ext show_first_image=”1″] on the parent-page. Presto, we get what you see below (or at this link towards the bottom of the page). All in all, less than 10 minutes of work including writing this post. 1 If they’d been posts instead of pages I could have done something very, very similar with list category posts plugin. If they weren’t organized by category or by parent-child relationship, I would have been sad. 2 If you know it exists.
This is why things are more difficult than they might be . . . a story of why I have no idea about anything or maybe it’s a parable of complexity and human frailty. In the beginning, we created a WordPress Multisite install and turned on BuddyPress. To make the groups works correctly we network activated bbPress. As a result, anyone logged into their accounts who visited any other rampages site became a Participant of that site (a bbPress user role that allows forum participation). People got very nervous about people being in their user roles. Other people became very unhappy their My Sites list had too many sites. I had to figure out two things as a result. First, I needed to stop auto-Participant association. I eventually found a way to do that but I still had to deal with the stuff that already happened. The right way to do it was to delete the users who were participants across the multisite. But . . . at that time we couldn’t access our database through anything but php myadmin and it wouldn’t run because the database was too big. So I had to treat the problem and strip the sites from the displayed list. Fast forward a year or so. At this point, we were able to turn off […]