Skip to content

About

Integrate Nextcloud with WordPress accounts

Topics

Resources

Stars

1 star

Watchers

3 watching

Forks

Latest commit

 

History

49 Commits

Folders and files

Repository files navigation

WordPress login backend

Integrate WordPress login with Nextcloud

What this app do?

Autenticate at Nextcloud using username and password of WordPress.

How to configure

occ config:system:set wordpress_dsn --value "mysql:host=myserverhostname;port=3306;dbname=woocommerce;user=root;password=root"

Replace the values by your database settings.

The database user only needs SELECT on the tables read by the queries (wp_users and wp_wc_orders with the default ones) and UPDATE on wp_users.user_pass:

GRANT SELECT ON woocommerce.wp_users TO 'nextcloud'@'%';
GRANT SELECT ON woocommerce.wp_wc_orders TO 'nextcloud'@'%';
GRANT UPDATE (user_pass) ON woocommerce.wp_users TO 'nextcloud'@'%';

Linked accounts

Only accounts linked to a WordPress user can log in with the WordPress password, and only their password changes are written back to WordPress. The WordPress user is the one whose user_login is exactly the account uid. See Linking existing accounts.

While logged in, only administrators and delegated administrators can create an account whose uid is a WordPress login.

Custom SQL queries (optional)

You can override default SQL queries using the wordpress_queries system key, following the same idea used by user_backend_sql_raw.

Supported query keys:

  • get_wordpress_user
  • get_disabled_users
  • set_wordpress_password

Example:

occ config:system:set wordpress_queries --type json --value '{"get_wordpress_user":"SELECT user_pass AS password, user_login AS uid, display_name AS displayname, 1 AS enabled FROM wp_users WHERE user_login = :username","get_disabled_users":"SELECT user_login AS uid FROM wp_users WHERE user_login LIKE :search","set_wordpress_password":"UPDATE wp_users SET user_pass = :hash WHERE user_login = :username"}'

The backend expects these named parameters:

  • :username for user lookup and password updates
  • :search for disabled-user listing
  • :hash for password updates

Linking existing accounts

An account is linked to WordPress by the user preference wordpress_login of the app wordpress_login_backend, holding the account uid. Admin Group Manager records it when it creates the account that owns a group.

When upgrading from a version that did not require the link, deploy in this order, otherwise the existing customers cannot log in:

  1. a version of Admin Group Manager that records the link;
  2. this app, then run the command below to link the existing accounts.

To link the accounts created before that, run:

occ wordpress-login-backend:link-users --dry-run
occ wordpress-login-backend:link-users

The command links each account that is sub-admin of the group with the same id as its uid and has a WordPress user with exactly that login. Members of the groups are never linked and are listed as skipped. With --dry-run it only lists the accounts.

Support, customization and enterprise

If you need help using this app, or if you want custom development, priority support, or an enterprise support plan, please contact us.

LibreSign-related enterprise support can also be discussed through the same contact channel.

About

Integrate Nextcloud with WordPress accounts

Topics

Resources

Stars

1 star

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages