week of 22 jul

22 Jul 2019

22 jul

To do this week:

intranet

Rudaina and I continue our progress with migrating content to the intranet.

I ran into yet another WP REST API interference with a plugin. I really don’t want to try to diagnose this on appsdev as I’m assuming it’s an outdated plugin or something similar that’s blocking the API. I tested the same plugin on my localhost version with no problem, so it probably has something to do with version 5.1 of WP on PHP 5.5. The only other thing it could be is a setting in the UA theme. I find this highly unlikely because a) they have screenshots of using the Gutenberg editor, which also relies on the API being accessible, and b) they use lots of shortcodes, which are only available via Gutenberg.

I also had success finding the list of drupal users and what roles everyone has. Now to decipher what these user roles have access to edit…

We also realized the sidebar menu wasn’t displaying the children pages in the navigation. I looked into this briefly, and it looks like that behavior/functionality was commented out of the sidebar nav walker at some point. I’ve added this to my list of things to look into.

instruction form

I decided to spend a little bit of time seeing what of the instruction form I could clean up quickly. The instruction part looks much better, but I can’t figure out a good way to alter the form itself without affecting the rest of the forms in libcal. I’m pretty annoyed right now because every other app in the springshare suite uses very specific ID numbers attached to content pieces, but these forms don’t have their own IDs! The questions in the forms do, but the forms themselves do not. :expressionless: So figuring this out should be fun.

23 jul

Focusing on the intranet this morning, specifically the sidebar submenu situation. It’s time to dive into WP Walker_Nav_Menu class to see where I can inject some functionality.

I started looking into this, and yes, I think this will be a pretty easy fix.

Unfortunately, I got sidetracked by a kace ticket while I was testing some stuff. I had to switch gears and start thinking about how to update one of the custom forms we have on the website… which led to quite the rabbit hole. I have a plan for fixing that, but it did take up a chunk of time from my morning.

Then Steven sent out the meeting agenda, and he wants to discuss the future of our wordpress workflow, auto deployment, and github setup. There’s a TON of research I need to do to be able to speak on that intelligently, so that took precedence in between my doctor appointment and lunch and now about an hour before the meeting.

So now I’m reading up on webpack and CI, since those are both things that could really help our development and deployment flow. For one, we have to leave grunt and bower behind because a) Bower has been archived and is only getting security updates, and b) some of our grunt plugins are causing security vulnerabilities in our repos because they haven’t been updated in 4-5 years. That’s definitely a sign that it’s time to move on to a new tool, and webpack should be the way forward. It does bundling, minifying, etc. like grunt, and we can use npm to include our packages and dependencies instead of bower.

This article has been enlightening: Webpack for WordPress

24 jul

We had a long meeting yesterday, so I didn’t get the chance to get back to work on the sidebar menu. That’s what I’ll do today. :raised_hands:

I’ve spent most of the morning fiddling around with this stupid sidebar template and I’ve just finally figured out how to get the stupid collapse/dropdown feature to cooperate. Very frustrating! Now hopefully I can tinker just a bit more with the php and css and get it working well and looking nice and I can move on to something else. Helpful articles in figuring this out:

I tinkered with the php and now realize I’mma be devastated when the UA theme gets updated and this gets overwritten. I’ve been googling about how to properly override or extend a parent theme class, and there might be a way, but I don’t know enough about PHP to be sure this is going to fly. Do I dare?

OMG, I figured it out! :tada::sparkles: Many thanks to How to extend a parent theme class from child theme? and WordPress: Override parent theme class function in child theme

The styling took a little bit longer to figure out than anticipated. Styling nav menus is pretty much the bane of my existence, but it really wasn’t all that bad. The hard part was forcing the toggle/dropdown menu to stay open once the user clicks a child page in the menu. I fixed it using javascript, but because the child theme functions load before the parent theme has time to do its thing, I had to use a document ready function which was making the navigation jumpy on load. I decided it was time to mess around with the wp/php a bit more and I’m glad I did!

I ended up var_dumping the $item array I created for the previous toggle issue to see what good stuff was in there I could exploit. Turns out, the array lists all the classes of that item. Because one of those items was current-page-parent, I could use that to change the $output variable for children of those parents. Boom! It’s pretty simple now that I’m looking at it, but thinking in PHP terms and knowing what to dump and look at is taking me some time to wrap my head around. :100:

I may want this stack overflow later if we decide to do grandchildren in that menu: Custom nav walker display current menu item children, or siblings no children

25 jul

Quiet day, but a good day. Love those.

Started the morning with adding some finishing touches to the LibCal instruction forms and description pages. Hopefully I can meet with Sara and get those finalized so we can roll out wider testing before I’m outta here!

Most of the rest of the day was intranet-related: tweaking the theme, sorting content, and thinking through the site format.

theme updates

Updated the header so it has “UA Libraries Intranet” in the logo spot and links to the intranet homepage. Updated the content-page.php file so our pages display headings and “last updated” info.

sorting content

So very much of the content is outdated. There are over 1300 pieces of content (pages, posts, meeting minutes, uploads, etc.) but only 250 of them have been added/modified in the LAST FIVE YEARS. So.

Rudaina and I have been going through the items on the “move now” list and started sorting them into what can be added to the site and what needs to be reviewed by a department head. There is very little that is making it onto the site at this point because everything is so old!

site format

The old intranet has these groups that certain people are members of (circulation, web services, area computing, info services) and those members can post things to their group page like blog posts and meeting minutes. I want to replicate this in some way, and I’m starting to think custom post types is the way to go. We already have some of the group pages up, so figuring out how to add minutes/posts to those pages shouldn’t be too complicated (famous last words). I’ll also need to use our “user roles” plugin to set groups to specific users.

I still don’t really know what to do with the homepage, but I guess it could list the latest posts/minutes from groups? And general library news?

26 jul

Spent the morning organizing intranet content into departments for review. So tedious.

More tedium in the afternoon. I thought I’d try my hand at exporting some data. There’s a drupal module called Views Data Export that helps you create a view then build an export of that view. The view is showing up, the data is showing up in the export view preview, but I’m getting a 500 Internal Server Error when I try to actually export the data.

So into the php error logs I went, and this is the error message: PHP Fatal error: Cannot redeclare class phpmailerException in /srv/web/www/inc/php-mail/class.phpmailer.php on line 2810, referer: https://intranet.lib.ua.edu/batch?op=start&id=66. How on earth is something in a completely different part of the server affecting my export?

It seems I need to find out where in this plugin/module is using the phpmailer class and do a require once function. But what happens when this module isn’t using phpmailer at all? Because that’s the case. Can’t find a single mention of the word ‘mail’ anywhere in the module code.