Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Co-Authors Plus guest author links are incorrect #1396

Closed
daltonrooney opened this issue Apr 21, 2017 · 1 comment
Closed

Co-Authors Plus guest author links are incorrect #1396

daltonrooney opened this issue Apr 21, 2017 · 1 comment

Comments

@daltonrooney
Copy link

daltonrooney commented Apr 21, 2017

Expected behavior

When looping through the authors object, if the author is a guest author, {{author.link}} should return either the guest author 'website' meta value or be blank, as they do not have a typical WordPress author page.

Actual behavior

{{author.link}} returns an incorrect (non-existent) WordPress author URL for guest authors.

Steps to reproduce behavior

Create a guest author in Co-Authors Plus and assign it as coauthor to a post.

In the template:

{% for author in post.authors %}
   <a href="{{author.link}}">{{author.name}}</a>
{% endfor %}

{{author.link}} will return something like '/blog/author/authorname' where authorname is a non-existent user.

What version of WordPress, PHP and Timber are you using?

WordPress 4.7.3, PHP 7.0.3, Latest Timber from GitHub

As a temporary fix, I added a conditional to CoAuthorsPlusUser.php:

if ( $coauthor->type == 'guest-author' && $coauthor->website ) {
	$this->_link = $coauthor->website;	
} else {
	$this->_link = get_author_posts_url(null, $coauthor->user_nicename );		
}

Which is an improvement but still returns an incorrect link if the $coauthor->website value is empty. I tried setting $this->_link to null when $coauthor->website is empty, but that still returns the author permastruct.

@Levdbas
Copy link
Member

Levdbas commented May 12, 2023

Since this is quite an old issue and using a third party plugin we will close this issue.

@Levdbas Levdbas closed this as completed May 12, 2023
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

No branches or pull requests

2 participants