I have a WordPress website with a custom theme. I'm using custom author template page to display a public "profile" of the user's page. I want to show a link to the edit page (I have a template for that too) to ONLY the logged in user who is also that particular author.
I have the following code, but it shows the edit link to ALL logged in users. I don't want users to think they can edit other authors' profiles.
<?php global $user_id, $user_login;
get_currentuserinfo();
$author_id = $curauth->user_id;
if($user_id !== '' && $author_id == $user_id){
echo 'EDIT LINK HERE';
}
?>