WordPress super admin – three tables to update

I recently did a migration from a single site to a multisite here in WordPress. It was painful. But I did learn how to change the super admin login name.

The three tables are: wp_users, wp_usermeta, and wp_sitemeta

Upon creation of a brand-spanking-new WordPress multisite, wp_users has but one record in it. ID = 1, which is the super admin user. I changed the user_login field (and other fields) to the login name I wanted. WordPress “knew” that this did not qualify me to be a network admin, so it would present me with only the one site.

A little bit of searching told me that I needed to make sure that in table wp_usermeta, the field wp_capabilities was correct. Well, it was. But there were other parts of my login name that I wanted to update here. So I suppose that technically, only two fields must be updated, to swap out the super admin login name.

The last piece, that was not easy to find, was that the table wp_sitemeta has a field: site_admins which needs to have a PHP array entry in it. There was an entry in it already, but, it listed the default login ID, not the one I wanted to log in as. Because it’s an array, there is an index number, and a string length, that precede the actual data in quotes.

Once both wp_sitemeta:site_admins and wp_users:user_login both linked up, then I could log in with my preferred login ID and be super admin.

Bitnami WordPress multisite installation

Make an ssh connection in to your Bitnami server installation. I’m using AWS, and they had instructions for me to get the password / ssh private key. ssh bitnami@your-ip-address-here

cat bitnami_application_password

While logged in to the ssh session, execute the Bitnami configuration script that assigns a domain name to your WordPress multisite server.

cd /opt/bitnami/apps/wordpress

sudo ./bnconfig --machine_hostname your-domain-name-here.tld

sudo mv bnconfig bnconfig.disabled

First, we changed to the directory with the bnconfig script. Then we ran it, with the machine_hostname option. (I wanted to put a dash in there, between machine and hostname, but it’s an underscore). Lastly, we moved the bnconfig script out of the way. This is because if the server rebooted, and bnconfig did run, it would be as if it ran bnconfig –machine_hostname your-ip-address-here.xip.io

xip.io is a Bitnami thing, I guess.

Hopefully, you already have the domain name, and have pointed it at the static IP address of your server.

On to configuring WordPress the familiar way: point your favorite browser at the ip address and go to https://your-domain-name-here/wp-admin

This redirected me, but really it was the same as going to https://your-ip-address-here.xip.io/wp-login.php

Log in as user with the password from bitnami_application_password

Upon logging in, the administration page looks almost the same as a regular WordPress installation. However, in the upper left corner, there is now a menu named “My Sites”. Hanging off of it is “Network Admin”

Hanging off of “Network Admin” are a whole bunch more sub-menu items, but I’m going to ignore those for the moment.

Clicking on “Network Admin” actually takes me to the first sub-menu item: “Dashboard”

And here, I had made my life more complicated. I’m actually trying to move this site, gerisch.org to the multisite, under the same domain name. Tell me “good luck with that.” Part of the multisite login process is to redirect to the domain name – which is the production server on some other IP address.

I’m going to have to go into DNS, and point the gerisch.org at the multisite IP address, before I can successfully log in (and remain logged in) to the multisite server still being set up.

Of course, I’m going to have to export this (the production site) to a file, for importing later, prior to taking it’s presence off teh interwebs.

And I don’t know if there is going to be any weird http://www.gerisch.org versus http://gerisch.org versus https://

Yeah, “stuff” in the databases that will need to be cleaned out during export, for import later.

Follow up to xdotool doesn't work nicely

My previous post was that Windows “just works”, and Linux was “good luck with that”. Indeed, I had a deadline, and to get the job done, I used Windows and WinBatch, just got it done. On time. On a laptop. In my car. Yay.

But really, my nice setup is here at home, instead of on the laptop in my car. And my preferred setup is this OpenSuSE box here at home. So, now that the time pressure is lessened, I can spend a little more time, trying to figure it out. The secret is to not use the one-liner feature of xdotool. If you do the one-liner format of xdotool, it composes the command to throw at the window with “XSendEvent”

If you do multiple xdotool commands in order, it composes the commands to throw at the window with “XTEST”

More accurately, if the xdotool command has –window in the line, then XSendEvent is used. If xdotool command has only the “key” command in it, XTEST is used.

Apparently, most programs ignore window commands send with XSendEvent, so xdotool does it’s tool do to X, and the window ignores it.

Yay.

Here is one of the scripts that finally worked. Note I did have to add a time delay in, because otherwise the audio player window wasn’t ready in time for the following key stroke to be input.

!/bin/bash
 WIDLibre=$(/usr/bin/xdotool search --name "LibreOffice Writer")
 WIDAudio=$(/usr/bin/xdotool search --name "Insert Name Of Window of audio player here")
 /usr/bin/xdotool windowactivate $WIDAudio
 /usr/bin/sleep 0.5
 /usr/bin/xdotool key Control_L+comma
 /usr/bin/xdotool windowactivate $WIDLibre

This script sends a comma (with the Control key modifier) to the audio player. In WinBatch, this would be SendKey("^,")

Ctrl+, is the pause / unpause keystroke for the audio player. The other script, uses the left arrow key to rewind the audio. One script each is attached to a couple KDE shortcuts. Each of those keytroke combinations is programmed into a Kinesis Savant Elite2 foot pedal. So the left pedal backtracks the audio a few seconds, and the right pedal pauses / unpauses the audio. Window focus remains in LibreOffice.

To figure out what to use for “Insert Name Of Window of audio player here“, use the command wmctrl -l

One thing to note: the full name of the window (because of the audio player I used) had the length of the audio in it. That time had special characters in it (colons to separate minutes from seconds); so either I would have had to escape them out, or, I just put the first part of the window name in, up to the time / length.

The whole secret to the thing was that this did not work:

/usr/bin/xdotool --window $WIDAudio key Control_L+comma

and this did work:

/usr/bin/xdotool windowactivate $WIDAudio
/usr/bin/xdotool key Control_L+comma

Windows "just works" versus Linux "good luck with that"

I’m trying to do some audio transcription, so that I have text to go along with the audio. Transcription is still quite the labor intensive problem, even here a few months away from 2020. Sure, I can get Amazon to do a basic transcription for very little cost (pennies more than dollars); but, the transcription isn’t very good. Part of the problem is that one of the speakers has a thick Southern accent.

Fine, whatever – I’ll just fix it.

Years ago, I was a “programmer” for an NC Drill. “NC” is the acronym for Numerical Control. So this drill just put holes in circuit board material at numerical X Y coordinates. My job was to digitize the artwork (or at least, line up the crosshairs on digitizer with the pads on the artwork, and then tap a foot pedal. As I spun the dials, the X and Y positions would be counted, and when I hit the foot pedal, the current position was recorded. (Actually, it was punched onto a paper tape).

So I learned that foot pedals are a nice way of interfacing with the computer. Especially with your shoes off. 😉

For this transcription work, I need to be editing a document (with my hands), but I’d like to pause and rewind the audio with foot pedals. I bought a somewhat expensive foot pedal from a company in the Pacific Northwest (Made in USA). It works well.

But what to have it do?

At first, I programmed it to do direct keystrokes: Alt-Tab to switch to the last window, Space to pause, Alt-Tab to switch back.

But this has the drawback that the last two windows I’ve used must be the one’s I need, and it’s terribly inflexible. How about picking an un-used set of keys as shortcuts / hotkeys, and attaching scripts? This way, the script can pick the name of the window from the open list, and go right there no matter if it’s been pushed to the back by something else.

Windows, with WinBatch, it just works.

Linux, with xdotools is a nightmare. Someone said xvkbd is the right way to go, to get around the fact that xdotools doesn’t work. Tried the combo, and now one run of one of the scripts kills off the other script from being able to work. I’ve got both, because xdotools does know now to do a “WinActivate” (to use WinBatch terminology), and it doesn’t appear that xvkbd doesn’t do window management. And it wasn’t written for that, either. But xdotools doesn’t know how to send the Space character to the media player, so I’ve got to mash these two together.

The xdotools people say it’s not their fault; most applications block input. Although somehow the xvkbd people are managing it.

I’ve used xdotools at work, and it does great with mouse clicks; so there’s that. But VLC and other Linux media players (many based on VLC) refuse to use a mouse click as “pause” for the video (where YouTube and Facebook don’t have a chip on their shoulder, and just do what is natural for people).

Anyway, I had a deadline to meet, and Windows actually got the job done.

Super WordPress Day – Meetup Fresno – 2019-09-24

Phil Derksen: Plugins you should install on every WordPress site

Akismet Anti-Spam

Backups:

  • BackWPup
  • UpdraftPlus
  • VaultPress (JetPack)
  • BackupBuddy
  • BlogVault

SEO

  • Yoast SEO
  • All in One SEO Pack
  • The SEO Framework
  • Broken Link Checker (resource intensive; run manually after changes)

Forms

  • Gravity Forms (long history of the product)
  • Ninja Forms
  • WPForms
  • Formidable
  • Contact Form 7 (very popular and free, but older and takes more work / detailed to implement)

Email – don’t skip this step

  • WP Mail SMTP
  • Easy WP SMTP
  • Service-specific (Postmark, Mandrill, Sendgrid)

Site Migration

  • WP Migrate DB
  • Duplicator
  • (most backup plugins)

What do Phil’s co-workers say?

  • User Switching – see what logged in users see.
  • Regenerate Thumbnails – change your theme or thumbnail size? This does the work.
  • Public Post Preview
  • Duplicate Post
  • Plugin Toggle
  • Editorial Calendar – Calendar view of past and future posts 😉

Community says

  • Simple Links – will randomize a list of links
  • WP Simple Pay – uses Stripe and other payment processors
  • Woo Commerce – manage inventory for physical sales, among other things
  • Event Espresso – booking
  • Sugar Calendar – booking

Generate WP for plugin development – generatewp.com

Matt Reeves: WordPress Customizer

The customizer does do instant WYSIWYG – which is better than before.

While inside the customizer, you can change the device type: full PC web site, tablet, and smartphone.

Kirki Theme Customizer; but can be temperamental re: the themes it works with.

Elementor is a theme builder that Matt has started using, that he actually admires the power in it.

Fruit of the Loom and Jockey underwear

Fruit of the Loom Men’s Breathable V-Neck T-Shirts are no longer available

I’m bummed. I suppose I should have seen that they weren’t terribly popular, and stocked up on them while I had the chance.

But I didn’t, and now they are no more.

Technically, I don’t terribly care if the brand is Fruit of the Loom or not. I’m generally a fan of that brand, because I think they just put out a high quality product. But if someone else comes up with a T-Shirt made of the same material, I’d happily buy from them.

These particular T-Shirts were made of a fabric that had both polyester and spandex in it. So the shirts cling to my torso well, which makes moisture wicking particularly effective in them. Hello 21st Century! I’m a fan.

The label says they are 91% cotton, 5% polyester, and 4% spandex. The label is also sublimated dye into the fabric, so here two years later, the label is as clear as can be. I do like tagless shirts. But most of the other tagless T-Shirts I have were printed with some crap ink on top of the material, that then flakes off in the wash. But these Fruit of the Loom shirts still look good, which is a testament to high quality design and manufacture.

They are simply high quality T-Shirts. Which is why I am bummed they didn’t make it in the market. They were made in Pakistan. Anyone over there have a stash left over that they want to sell?

Jockey Men’s Underwear Sport Microfiber Boxer Brief; pricing on Amazon signals me they think I am a chump

Again with the theme that I like modern fabrics / materials, I like the Jockey Men’s Underwear Sport Microfiber Boxer Brief. The material is great: 80% polyester, 20% spandex. I also very much like the horizontal fly, and the positioning of it.

However, at one time, Jockey was selling these on Amazon in two-packs, for $24.

Today, you can buy them from Jockey themselves, and the price is two for $24.

But today, on Amazon, Jockey only sells them in single packs, for $18.

$6 per piece markup, because I’m buying them from Amazon? What do they think I am? A chump?

Apparently, Jockey thinks I am a chump.

Yeah, I’m buying Terramar Men’s 6″ SilkSkins AIRCOOL Boxer Briefs with Fly instead. $11 per piece. From Amazon.

I have three reasons for buying from Amazon, and not buying direct from Jockey:

  • Amazon Prime rewards credit card: I’m building up points; Jockey isn’t going to give me that through direct sales, and in order to get that through Amazon, I have to pay 50% more per piece than Jockey themselves will sell it to me. Apparently, Jockey thinks I am a chump.
  • Amazon Prime delayed shipping: I get $1 toward music / mp3 files for download.
  • Amazon Smile donation: one half of 1 percent of my shopping goes to a charity of my choice. Sure, for the one purchase of six pieces of underwear, that only generates 36 cents of donation; but that’s better than nothing, and over time, it builds up.

The fly on the Terramar is way high up, which is not where I would like it to be. I don’t know if the legal system is structured so that Terramar can move the fly down to the location that Jockey has it, without getting sued by Jockey for copying the design.

The Terramar briefs are also a slightly different material: 86% nylon + 14% spandex versus 80% polyester + 20% spandex. The result is that they don’t grip as tightly as the Jockey briefs. I prefer the Jockey Microfiber brief material. I have since come to prefer the Terramar briefs. When one is sitting in a chair, the Terramar briefs are more comfortable than the Jockey briefs. Also, the material is softer, which is nice.

But so far (that I know of), Terramar has never structured a deal where they insulted my intelligence for buying their product through Amazon.

Quality of product

I’ve also noticed that the Fruit of the Loom stuff fits well, where other brands are built for short people. Perhaps by cutting the material short, the manufacturer thinks they are going to save a half penny per undershirt. They save a minuscule amount of money; and, I expose ass-crack. Wonderful.

Or, I can get the Fruit of the Loom stuff, and the shirts fit correctly from the beginning. The Fruit of the Loom stuff is also built with good “registration”.

In the printing industry, there is the concept of how well things are printed in relation to each other. Ink gets laid down in colors (passes), so the registration is how well the red print lines up with the blue print lines up with the yellow print. You want green (but only want to pay for three color printing)? Print yellow on top of blue. But the registration had better be good, because otherwise one edge of the green image will be blue, and the opposite edge, yellow.

In T-Shirts, the registration is between the neck hole, and the sides (seams). The badly sewn shirts have the neck hole off-center from the sleeves. I won’t wear these for work; but, in place of a pajama top, an oversize T-Shirt works fine. One interesting piece of technology is cloth that is woven into a tube, so there is no seam at all. I have no idea of how this is done; I imagine that it is a technological miracle. And I suppose if seams bothered me, I’d really like the seamless feature. However, if the fabric doesn’t have side seams, then the line of where the side falls is where the bottom of the sleeve (armpit) joins the shirt. Poor registration is a big problem here. I’ve seen T-Shirts where the neck hole was two inches off center from the armpit holes. Not a fan.

I’ve never seen this problem with the Fruit of the Loom shirts. Which is another reason I like the brand.

Hanes brand does have registration problems, in my experience. The cheapest Amazon house brand shirts are the worst.

Much of happiness is hope, no matter how deep the underworld, in which that happiness was conceived.

Called upon properly, the internal critic will suggest something to set in order, which you could set in order, which you would set in order, voluntarily, without resentment, even with pleasure.

Ask yourself: is there one thing that exists in disarray in your life or your situation, that you could and would set straight? Could you, and would you, fix that one thing, that announces itself humbly, in need of repair?

Could you do it now?

Imagine that you are someone with whom you must negotiate. Imagine further, that you are lazy, touchy, resentful, and hard to get along with. With that attitude, it’s not going to be easy to get you moving. You might have to use a little charm and playfulness. 😉 “Excuse me” you might say to yourself (without irony or sarcasm), “I’m trying to reduce some of the unnecessary suffering around here. I could use some help.” (keep the derision at bay).

“I’m wondering if there’s anything you would be willing to do? I’d be very grateful for your service.” Ask honestly, and with humility.

(offers reward for doing the dishes)

Then you could listen. Maybe you will hear a voice inside. Maybe it’s even the voice of a long lost child. Maybe it will reply. “Really? You really want to do something nice for me? You’d really do it? It’s not a trick?” This is where you must be careful. That little voice, that’s the voice of someone once burnt and twice shy. So you could say, very carefully, “Really. I might not do it very well, and I might not be great company, but I will do something nice for you. I promise.” A little careful kindness goes a long way. And judicious reward is a powerful motivator. … and then do the damned dishes.

And then you’d better not go clean the bathroom, and forget about the coffee or the movie or the beer, or it will be even harder to call those forgotten parts of yourself forth from the nooks and the crannies of the underworld.

Jordan B Peterson – Twelve Rules for Life: An Antidote to Chaos

Selling some stock

I happen to have a need to raise some cash, so it’s time to sell some stock. Some of it, I’m going to liquidate, and call the loses final. Others, I’m going to shave back and get the cash, but leave as much as I can in there, so that they continue to grow.

APRN – Man, what a stinker. I was using the Blue Apron service, and loved it (for a while), so I bought in shortly after they did their Initial Public Offering (IPO). The next day after, one of the stock guys I listen to said (essentially) “don’t buy APRN – this IPO is just a liquidity event for the initial investors; they are going to take your cash and run. It’s going to be a terrible stock.” That information was too late – I’d already bought. Worse, when it was near it’s bottom, my pride told me to put in some more, so as to dollar-cost-average my loss, so that if it did come back, it would be easier to cross into the black. All in all, I will be down 91%. All I’m really getting is peace of mind, to no longer be reminded of this stinker.

ADXS – Another stinker. This one was supposed to be a good biotech play; but something happened, and the entire market has just trashed this stock. I might as well get out, because it looks like it will never come back. Down 99%. Worse – the trading commission is actually more than the liquidation reap of what is left. Thankfully, I only had $500 in there in the first place. Again – peace of mind, getting rid of this stinker.

AA and ARNC – Way back when, I heard that Alcoa was a good idea, so I went with it. There was probably a momentary opportunity to make some money (listening to stock picker guys who don’t have that great a track record (again)). There was some sort of corporate fight over control of the Board, and it split into two stocks: Alcoa and Arconic. And then both fell. I don’t have much of this loser, but I’d like to get rid of it anyway. Down 15% on Arconic. Forgot to look at the down percentage on Alcoa.

XOM – At one time, Exxon-Mobile was the greatest petroleum company in the world. Might still be. But I had a single share, and I’m down 20% on it. I’ve held it a long time, but it never quite ever made it back into the black. Might as well be done with the mental overhead of seeing it on the list.

NUAN – Nuance Communications. This was another stock suggestion by one of the guys I listen too. Problem is, someone whispered in his ear that with all the AI stuff going on, these people were going to get swept up in the growth of the industry. But that’s not how technology companies work. So it’s been dead money for a long time; I will be down 1%, but at least I’ll have the cash I put in way-back-when. By the way, after I bought the stock, (months later) out of the blue, the networks team sends me work order to help integrate the Nuance software with our email system. I had no idea; but the fact that they were making sales (well, at least one) caused me to hang on to this stock probably longer than I should have.

SQM – This is a South American mining company; I bought it because I thought they had a lot of metals needed in the high tech battery industry. But the more basic resources are down, and South America in general is not a fun place right now, so I’m down 54%. I’m getting out.

REMX – VanEcke Rare Earth Metals ETF. Similar idea to SQM, but ETF’s are probably not a good long term hold. I’m down 40%, and getting out.

CRSP – Crispr Theraputics. Actually, I’m up 142% on this stock, so I’ve sold enough to cover my initial cost, and will let the rest ride.

INTC – Intel. Similar story: I’m up 90%, so I’m selling not quite 1/2 so that what remains is “free money”.

MU – Micron Technology. I bought both Intel and Micron about the same time, because I love the idea of their Optane memory technology. The two companies have a research / manufacturing partnership for this technology, and I think it’s great. Since I’m up 44%, I might as well sell enough to cover the cost I initially got in at, and let the rest ride as “free money”.

CY – Cypress Semiconductor. This was a 5G play, and I’m up 63%. Same story: sell what it cost, so the rest is free money.

SWKS – Sky Works Solutions. You know that stock picker guy I listen to, who so often steers me wrong? Well, he was talking to a different stock picker guy, and they both liked this stock, and they were right. Apparently the company makes wireless modem chips that go to a small cell phone company you might have heard on named Apple. I’m up 19% (although at times, this stock was up 50%). I needed to get the total amount a cash from today’s sales to a certain point, so I sold five shares.

And there you have it: thirteen sales to generate cash I will need in a few days. Some of it was getting rid of losers that make me feel bad. Some of it was selling the same dollar amount as it cost me to get in; what is left in, I am happy to let ride. If it goes up, that is great! If it goes down, I don’t really care, since I’ve gotten my initial investment out of it.

WordPress multisite and Let's Encrypt certificates for multiple sites

I’m using the Bitnami images for my WordPress installations, and am very happy with them. However, it got a little weird when I added a new site to my WordPress multisite instance.

The secret was to run a few commands by hand:

sudo /opt/bitnami/ctlscript.sh stop apache
sudo /opt/bitnami/letsencrypt/lego  --path="/opt/bitnami/letsencrypt/" --email="david@some-domain-name-i-am-not-publishing-here" --domains="gerisch.org" --domains="www.gerisch.org" --domains="test.gerisch.org" --http run
sudo /opt/bitnami/ctlscript.sh start apache

Earlier, I had run the Bitnami bncert-tool which wrangled my Apache configuration so that all attempts to go to an http:// address were re-written to go to an https:// address. This is very good. But when I added the test.gerisch.org web site, the certificate provided by Let’s Encrypt did not have a SAN (Subject Alternative Name) entry for “test”. So trying to visit that site got the ominous “this site is insecure – nothing provides for an SSL certificate for it”. True enough.

By running the /opt/bitnami/letsencrypt/lego script with multiple –domains arguments, I could update the requested certificate to have the additional SANs I wanted. Very nice. It was the Bitnami community support web site that gave me this information. The same page warns me that more than five requests for new certificates puts the certificate issuer into a time-out corner for one week. So that is something to be aware of.

How to make Ubuntu have a nice bash shell like OpenSuSE

There are two features of OpenSuSE that I love when logging in to the command line, that do not exist in Ubuntu. Problem is, I’m renting web servers from Amazon, and those are Ubuntu. So I log in to them with ssh, and the bash completion features I want are not there. This post will be documentation of how to get back to the settings I want.

Apparently, theses used to be the settings that most Linux distributions came with. But someone somewhere decided they had a better (in my opinion: worse) plan, and the rest of the world didn’t push back. Well, except for OpenSuSE. Since I cut my teeth on SuSE, I grew to really like those features, and badly miss them when I’m on a Ubuntu box.

First up: change the editor to VIM

On these new boxes, the file ~/.bash_profile does not exist. That’s fine; Ubuntu will read it on login if it does exist.

vim ~/.bash_profile

Get into insert mode with <ins>

export EDITOR=vim

Because the presence of .bash_profile breaks .bashrc (used later), add this to .bash_profile:

[ -r $HOME/.bashrc ] && source $HOME/.bashrc

Save and exit VIM with <esc> : w q

Now, if you are looking at a file with “less” and you want to then edit it, you can hit the letter “v” and be editing the file.

I imagine that way back when, “v” was a way to think “VIM”; but once Ubuntu changed it’s default to the nano editor, that doesn’t really map any more. This changes it back.

Second up: alias the change directory command up-one-level to ..

vim ~/.bashrc

Find the list of alias commands, and move to the bottom line in the list of aliases, and do a “yank”, then a “paste” in VIM:

yy
p

Then get into edit mode by hitting the <ins> key, and modify the pasted command to be this:

alias ..='cd ..'

Get out of insert mode with <esc> and :wq to write the file and quit VIM

If you exit your ssh session, and log back in, the .. command should now take you up one level in the directory hierarchy. Much nicer than having to type cd ..

Third up: bash history search command

We will be editing /etc/inputrc

The tricky part here is that /etc/inputrc is a system file, and attempting to edit it warns that I won’t be able to write and quit. I don’t have permission to edit this file. The solution is to edit it with permissions:

sudo vim /etc/inputrc

Nicely enough, the commands I want are already there; they are merely commented out:

# alternate mappings for "page up" and "page down" to search the history
# "\e[5~": history-search-backward
# "\e[6~": history-search-forward

All I have to do is to delete the “#” character that declares \e[5~ and \e[6~ to be a comment. With VIM, this is the x key