PHPackages                             helsingborg-stad/active-directory-api-wp-integration - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. helsingborg-stad/active-directory-api-wp-integration

ActiveWordpress-plugin[Authentication &amp; Authorization](/categories/authentication)

helsingborg-stad/active-directory-api-wp-integration
====================================================

Simple plugin for verification of existing WordPress users with api.

3.2.0(1mo ago)218.9k↓39.5%[1 PRs](https://github.com/helsingborg-stad/active-directory-api-wp-integration/pulls)MITPHPCI passing

Since Apr 10Pushed 1mo ago9 watchersCompare

[ Source](https://github.com/helsingborg-stad/active-directory-api-wp-integration)[ Packagist](https://packagist.org/packages/helsingborg-stad/active-directory-api-wp-integration)[ RSS](/packages/helsingborg-stad-active-directory-api-wp-integration/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (110)Used By (0)

Active Directory Integration
============================

[](#active-directory-integration)

Integration with the simple active directory api service (). Simply define AD\_INTEGRATION\_URL with the url to the base directory of the api. The following functions will be enabled by default:

- Only allow local WordPress users to login (their usernames must match those in active directory)
- Use the password stored in active-directory for matching WordPress users.
- Update of users basic data like email, first name and last name on login.

Database modifications
======================

[](#database-modifications)

This plugin will alter the index of the user table to require unique usernames. This is not a default behavior for WordPress and may break other plugins related to user management.

WordPress Admin User Actions
============================

[](#wordpress-admin-user-actions)

When bulk import is enabled, the plugin adds an "Update from AD" action to each user in the WordPress admin user list (Users → All Users). This allows administrators to manually update individual user profiles from Active Directory with a single click.

**How to use:**

1. Navigate to Users → All Users in WordPress admin
2. Hover over a user row
3. Click "Update from AD" link
4. The user's profile will be updated with the latest information from Active Directory
5. A success or error message will be displayed

WP-CLI Commands
===============

[](#wp-cli-commands)

The plugin provides WP-CLI commands for managing bulk operations with clear logging. This is the recommended approach for production environments.

User Synchronization Commands
-----------------------------

[](#user-synchronization-commands)

### Sync users with Active Directory

[](#sync-users-with-active-directory)

Imports new users from AD and removes users that no longer exist:

```
wp adintegration sync
wp adintegration sync --max-delete-limit=500
```

### Update user profiles

[](#update-user-profiles)

Updates all WordPress user profiles with latest data from AD:

```
wp adintegration update-profiles
```

### Propagate users (Multisite)

[](#propagate-users-multisite)

Adds all users to all sites in the network:

```
wp adintegration propagate
```

Individual User Management (CRUD Operations)
--------------------------------------------

[](#individual-user-management-crud-operations)

Manage individual users with get, update, and delete operations.

### Get user information from Active Directory

[](#get-user-information-from-active-directory)

Retrieves user details from AD and shows WordPress status:

```
wp adintegration user get john.doe
wp adintegration user get john.doe@example.com
```

### Update user profile from Active Directory

[](#update-user-profile-from-active-directory)

Updates an existing WordPress user's profile from AD, or creates the user if `--create` flag is used:

```
# Update existing user
wp adintegration user update john.doe

# Create user if not exists and update profile
wp adintegration user update john.doe --create
```

### Delete user from WordPress

[](#delete-user-from-wordpress)

Removes a user from WordPress (requires confirmation):

```
wp adintegration user delete john.doe
```

Cleaning Commands
-----------------

[](#cleaning-commands)

### Remove duplicate users

[](#remove-duplicate-users)

```
wp adintegration clean-users
```

### Remove orphaned user metadata

[](#remove-orphaned-user-metadata)

```
wp adintegration clean-meta
```

### Remove empty user capabilities

[](#remove-empty-user-capabilities)

```
wp adintegration clean-capabilities
```

Trigger manual bulkimport (Legacy - Query Parameters)
=====================================================

[](#trigger-manual-bulkimport-legacy---query-parameters)

**⚠️ Deprecated:** Query parameter triggers are maintained for backward compatibility but WP-CLI commands are recommended for better logging and monitoring.

Import new users / remove old: Update registered profiles: Propagate user roles to all sites:

Trigger manual cleaning actions (Legacy - Query Parameters)
===========================================================

[](#trigger-manual-cleaning-actions-legacy---query-parameters)

**⚠️ Deprecated:** Query parameter triggers are maintained for backward compatibility but WP-CLI commands are recommended.

Remove duplicate users: Remove orphan user meta: Remove user capabilitys that are empty:

Options (Define Constants)
==========================

[](#options-define-constants)

- AD\_UPDATE\_NAME: Update first and last name.
- AD\_UPDATE\_EMAIL: Update email if it not belongs to another user account.
- AD\_UPDATE\_META: Update meta according to result (will use ad-keys as meta keys prefixed with below). \*\*
- AD\_META\_PREFIX: Prefix for metakeys stored in the database. \*\*
- AD\_SAVE\_PASSWORD: Wheter to save the ad-password (true) in WordPress. \*
- AD\_RANDOM\_PASSWORD: Block random password generator. \*
- AD\_USER\_DOMAIN: Define a domain that belongs to ad-users (to block password reset). \*
- AD\_HP\_VALIDATION: Define to false to disable honeypot login protection.
- AD\_NONCE\_VALIDATION: Define to false to disable nonce login protection.

Options Bulk Import (Define Constants)
======================================

[](#options-bulk-import-define-constants)

These options imports all users avabile in active directory nightly.

- AD\_BULK\_IMPORT: Turn on or off bulk import (true/false)
- AD\_BULK\_IMPORT\_USER: User account that can read all items in the ad
- AD\_BULK\_IMPORT\_PASSWORD: Password to the account name above
- AD\_BULK\_IMPORT\_ROLE: Default role to assign new users (default to "subscriber")
- AD\_BULK\_IMPORT\_REASSIGN\_USERNAME: Reassign content of deleted users to this username. Will fallback to first user if not set or the user is missing.
- AD\_BULK\_IMPORT\_PROPAGATE: Propagate users on the whole network of blogs (default to true).

Options Auto Create Users
=========================

[](#options-auto-create-users)

These options creates a user on the site if it exists in active directory on signon.

- AD\_AUTOCREATE\_USER: Turn on or off auto signup (true/false)
- AD\_AUTOCREATE\_ROLE: Default role to assign new users (default to "subscriber")

- Be careful setting these options. All of them are not compatible. For instance: You cannot save the password, and generate a random password. \*\* Ad update meta should be set in order to enable ad\_meta\_prefix constant.

Filters
=======

[](#filters)

Filter the meta keys stored in the database.

```
add_filter('adApiWpIntegration/profile/metaKey', function($meta_key){
    return $meta_key;
});
```

Filter the default redirect to page, subscribers may not be affected to this (to homepage as default)

```
add_filter('adApiWpIntegration/login/defaultRedirect', function(){
    return home_url();
});
```

Example configuration
=====================

[](#example-configuration)

```
 define('AD_INTEGRATION_URL', 'https://internalproductionserver.com/ad-api/');
 define('AD_UPDATE_NAME', true);
 define('AD_UPDATE_EMAIL', true);
 define('AD_SAVE_PASSWORD', false);
 define('AD_RANDOM_PASSWORD', true);
 define('AD_USER_DOMAIN', 'company.com');

 define('AD_BULK_IMPORT', true);
 define('AD_BULK_IMPORT_USER', 'bulkimportaduser');
 define('AD_BULK_IMPORT_PASSWORD', '*********');
 define('AD_BULK_IMPORT_ROLE', 'subscriber');
 define('AD_BULK_IMPORT_REASSIGN_USERNAME', 'administrator');
```

###  Health Score

59

—

FairBetter than 98% of packages

Maintenance98

Actively maintained with recent releases

Popularity28

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 90.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~34 days

Recently: every ~45 days

Total

97

Last Release

44d ago

Major Versions

1.0.9 → 2.0.02017-09-15

2.5.0 → 3.0.02023-09-26

### Community

Maintainers

![](https://www.gravatar.com/avatar/f46fe64973c3e89d15c745c0bf601c25983bafea81d30e64d4bf813a6f8c8c7c?d=identicon)[sebastianthulin](/maintainers/sebastianthulin)

---

Top Contributors

[![sebastianthulin](https://avatars.githubusercontent.com/u/797129?v=4)](https://github.com/sebastianthulin "sebastianthulin (146 commits)")[![Sven65](https://avatars.githubusercontent.com/u/10225982?v=4)](https://github.com/Sven65 "Sven65 (7 commits)")[![silvergrund](https://avatars.githubusercontent.com/u/4200504?v=4)](https://github.com/silvergrund "silvergrund (3 commits)")[![jonatanhanson](https://avatars.githubusercontent.com/u/21363149?v=4)](https://github.com/jonatanhanson "jonatanhanson (2 commits)")[![petter-a](https://avatars.githubusercontent.com/u/40427478?v=4)](https://github.com/petter-a "petter-a (1 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (1 commits)")[![colesmedia](https://avatars.githubusercontent.com/u/54745265?v=4)](https://github.com/colesmedia "colesmedia (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/helsingborg-stad-active-directory-api-wp-integration/health.svg)

```
[![Health](https://phpackages.com/badges/helsingborg-stad-active-directory-api-wp-integration/health.svg)](https://phpackages.com/packages/helsingborg-stad-active-directory-api-wp-integration)
```

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M117](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
