Skip to content

News Block: show only CoAuthors, fall back to PIO coauthor (ID 11)#92

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-news-block-author-logic
Draft

News Block: show only CoAuthors, fall back to PIO coauthor (ID 11)#92
Copilot wants to merge 2 commits intomainfrom
copilot/fix-news-block-author-logic

Conversation

Copy link

Copilot AI commented Mar 7, 2026

The News Block was combining WordPress users and CoAuthors Plus users as post authors. Per the news center migration decision, WordPress users should never appear on the site — authorship is managed exclusively via CoAuthors+.

Changes

  • News_Block_Controller::get_authors() — Replaced dual-source author logic with CoAuthors-only logic:
    • If coauthors are assigned on the post, return only their names (via the coauthors/ endpoint)
    • If no coauthors are assigned, fall back to CoAuthor ID 11 (the PIO/Public Affairs guest author)
    • Removed the WordPress users/ endpoint lookup entirely
  • Added DEFAULT_AUTHOR_ID = 11 constant — makes the fallback coauthor explicit and easy to change
// Before: fetched WP user AND coauthors, combined both
if ( ! empty( $item['author'] ) ) { /* fetch WP user */ }
if ( ! empty( $item['coauthors'] ) ) { /* fetch coauthors */ }

// After: coauthors only; fall back to PIO coauthor if none assigned
if ( ! empty( $item['coauthors'] ) ) {
    // return coauthor names
}
// fall back to coauthors/11

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/nQ0JIJ /usr/bin/composer install (http block)
  • https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/7da1894633f168fe244afc6de00d141f27517b62
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/nQ0JIJ /usr/bin/composer install (http block)
  • https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5e4e71592f69da17871dba6e80dd51bce74a351a
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/nQ0JIJ /usr/bin/composer install (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>News Block shows WordPress users and CoAuthors as authors on posts</issue_title>
<issue_description>As part of the news center migration, we decided that we will handle WordPress users and post authors separately. WordPress users, who can login and visit the WordPress dashboard, are not displayed anywhere on the site. Post authors, guest authors, etc., will be managed using the CoAuthors+ plugin.

Currently, the news syndication block, which is available as of v1.7.x of this plugin, combines and displays WordPress users and CoAuthors in the block output. We need to change this logic to:

If a CoAuthor isn't assigned, display the Public Affairs CoAuthor (not the Public Affairs WordPress user) as the author.

protected function get_authors(array $item): array {
if ( empty( $item['author'] ) && empty( $item['coauthors'] ) ) {
return [];
}
$authors = [];
</issue_description>

<agent_instructions>The News Block, in both the editor and the front end, displays the WordPress user and the Coauthors Plus user. It should only display the Coauthors Plus user.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@knice CoAuthor's names and slugs in the DB are arbitrary and often incorrect. Example: [Allison](https://news.ucsc.edu/wp-json/wp/v2/coauthors/1671). We need to download the CoAuthors information from the database and update the `name` and `slug` fields so they make sense.

Secondarily, Jason is updating the plugin to the following specification:

  1. Check for guest authors on each post, display the name of each one.
  2. If there are no guest authors, list the pio user (11) as the author.</comment_new>

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: Herm71 <1000543+Herm71@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix news block to show CoAuthors as authors on posts News Block: show only CoAuthors, fall back to PIO coauthor (ID 11) Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

News Block shows WordPress users and CoAuthors as authors on posts

2 participants