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

Change agent link in my profile #40

Merged
merged 1 commit into from
Mar 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions includes/WordLand/Manager/DataManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ protected function __construct()
public function manage()
{
add_action('set_object_terms', array($this, 'autoSetListingType'), 10, 4);
add_filter('the_author_posts_link', array($this, 'changeAgentAuthorLink'));
add_filter('author_link', array($this, 'changeAgentAuthorLink'), 10, 2);
foreach ((array)PostTypes::get() as $post_type) {
add_action("publish_{$post_type}", array($this, 'changeUpdatedTime'), 10, 2);
}
Expand Down Expand Up @@ -51,12 +51,14 @@ public function changeUpdatedTime($propertyId, $originalPost)
));
}

public function changeAgentAuthorLink($link)
public function changeAgentAuthorLink($link, $author_id)
{
global $authordata, $post;

if (in_array($post->post_type, PostTypes::get())) {
$link = str_replace('author', wordland_get_agent_type($authordata), $link);
} elseif (is_my_profile()) {
$link = str_replace('author', wordland_get_agent_type(wp_get_current_user()), $link);
}
return $link;
}
Expand Down
10 changes: 9 additions & 1 deletion templates/loop/footer/user_info.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,13 @@
<div class="user-image">
<?php echo get_avatar($user ? $user->ID : 0, 32) ?>
</div>
<?php echo get_the_author_posts_link(); ?>
<a
href="<?php echo get_author_posts_url($user->ID); ?>"
title="<?php echo esc_attr(sprintf(
__('Agent %s\'s profile', 'wordland'),
$user->display_name
)); ?>"
>
<?php echo $user->display_name; ?>
</a>
</div>