Automattic / Automattic/wordpress-activitypub
Use user nicename, not user login
- Dominant language
- PHP
- Stars
- 579
- Forks
- 92
- Avg merge
- 13h 5m
- Merged PRs (30d)
- 85
Description
### Quick summary
User nicename is a unique, sanitized version of user login. Since user login can be an email address and contain spaces or special characters, user nicename is used for creating permalinks etc. throughout the rest of WordPress. Therefore, it should be used as the ActivityPub user name string, rather than user login.
https://wordpress.stackexchange.com/questions/127905/user-login-vs-user-nicename
`includes/model/class-user.php`:
```php
public function get_preferred_username() {
return \get_the_author_meta( 'nicename', $this->_id );
}
```
In fact there is some sanitization happening in `includes/class-signature.php` that shouldn't be necessary if using the nicename:
```php
protected static function get_signature_options_key_for( $user_id ) {
$id = $user_id;
if ( $user_id > 0 ) {
$user = \get_userdata( $user_id );
// No need to sanitize nicename
$id = $user->user_nicename;
}
return 'activitypub_keypair_for_' . $id;
}
```
Similar to #141, but doesn't require complete user customization of ActivityPub user name.
### Steps to reproduce
Install ActivityPub and see that it is using user_login, not user_nicename.
### Site owner impact
More than 60% of the total website/platform users
### Severity
Minor
### What other impact(s) does this issue have?
_No response_
### If a workaround is available, please outline it here.
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.