Unable to create book/site even though user is registered and logged on

Description

This is on a fresh install without any books/site created yet. Registration settings is set to: Both sites and user accounts can be registered.

A user who is registered and logged on cannot create a new book. All users when clicking ‘Create a New Book’ either from the dashboard ‘Right Now’ metabox, or ‘My Catalog’->‘Create a New Book’ on the top admin toolbar is redirected to wp-signup.php to create a new account.

For the network superadmin, he is able to create a new book from the network dashboard. But the same thing happens when he clicks ‘My Catalog’->‘Create a New Book’ on the top admin toolbar - he is directed to wp-signup.php to create a new account.

Steps to Reproduce

  1. Sign up a user / Add a new user by superadmin / Log in as superadmin
  2. Click ‘My Catalog’->‘Create a New Book’ on the top admin toolbar

Expected behavior:
I do not know the expected page the user to land on since until now all users are directed to the signup page except for the superadmin ‘Right Now’ metabox link instance.

Actual behavior:
User is directed to signup page to create a new account.

Note
I already have hm-autoloader.php in the mu-plugins directory, so I am not sure why the system diagnostics show ‘hm-autoloader.php: n/a’

Pressbooks Configuration

Version: 5.5.2
Root Theme: Aldine
Root Theme Version: 1.4.1

Must-Use Plugins

hm-autoloader.php: n/a

WordPress Configuration

Network Type: Subdirectory
Version: 4.9.8
Language: en_US
WP_ENV: Not set
WP_DEBUG: Disabled
Memory Limit: 64M

“n/a” just refers to the version; as the autoloader does not have a version that’s how it shows up.

When I try this, I see the following behaviour: create-a-book

The signup page is used to register both users and books. Assuming the network is configured correctly, a logged-in user visiting the page should be prompted to create a new book. Without more details about your network configuration I’m not sure what’s causing this. Screenshots of the resulting wp-signup.php page might help diagnose further.

Hi Ned, here’s a screencast of the create book behaviour I am getting:

(1) https://cl.ly/3ec6f4670396
Here, i am logged in as network admin. I click on create a new book from the admin toolbar directly. Results in a page asking me to log in even though I am logged in.

And here are two more screencasts:

(2) https://cl.ly/c4a0fd66b0ed
For this, still as network admin, but i first click to the blog site, click to My Books, then Add New. Results in a page allowing me to add a new book.

(3) https://cl.ly/15844673b4ba
Similar to (2), but I click the Create a New Book from the admin toolbar. log site, click to My Books, then Add New. Results in a page asking me to log in even though I am logged in.

I think I’ve found the bug.

The admin toolbar link in (1) and (3) linked to http://domain.com/site/wp-signup.php - my wordpress installation url and site url were set up in WordPress’ options to point to https and not http.
whereas the Add New link in (2) linked correctly to https://domain.com/site/wp-signup.php

I can’t speak to your network configuration but the “Create a New Book” link in the admin toolbar (in your videos 1 and 2) is generated with this code:

The only way that URL would be http:// as opposed to https:// is if your network is not able to detect that it should be served over SSL. See:

Hi Ned, thanks for the references. I’ve tried to make is_ssl return true by implementing $_SERVER [ 'HTTPS' ] = 'on' ; in wp-config, but that didn’t make network_home_url() return https protocol. Still have no idea why this is happening.

For now, to solve the issue, I’ve implemented a htaccess rewrite to direct to https. Here’s the code in case anybody here needs it:

RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}/%{REQUEST_URI} [L,R=301]
3 Likes