Automattic / Automattic/co-authors-plus

Bug in coauthors_plus->search_authors()

Open
#142 3 comments 0 reactions 0 assignees View on GitHub
status: awaiting reporter feedback status: needs investigation
Dominant language
PHP
Stars
322
Forks
216
Avg merge
7h 50m
Merged PRs (30d)
65

Description

I think I've pinpointed a bug in co-authors search_authors. We were having issues assigning some posts to some authors when creating a post.

Look at the following block of code:

``` php
foreach( $found_terms as $found_term ) {
$found_user = $this->get_coauthor_by( 'user_nicename', $found_term->slug );
if ( !empty( $found_user ) )
$found_users[$found_user->user_login] = $found_user;
}
```

get_coauthor_by() function uses wordpress function get_user_by to get user data. However it's passing the term's slug as second argument instead of user's nicename.

Contributor guide

Open the contributing guide

Research direction

Start in the implementation of coauthors_plus->search_authors() and inspect the shown get_coauthor_by() call, then trace how the term slug and user nicename are represented. Reproduce the author-assignment case described in the issue; done means affected authors can be assigned when creating a post.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
backend, search
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.