I am using the BuddyPress plugin with WP-Job-Manager plugin for my website. I am also using another plugin called BP-job-manager to display users resumes on their Buddypress profiles. Unfortunately the BP-Job-manager Plugin is a little buggy and is not supported.
Currently if a user is logged in and they visit their own profile they can click the resumes tab and there is some text which states "Your resume can be viewed, edited or removed below." and underneath they have options to view, edit or remove their own resumes when they hover over it.
If a user is logged in and selects to view another users profile they can also view the other users resumes but they do not have the options to edit or remove somebody else's resume but the text "Your resume can be viewed, edited or removed below." is still visible.
This is how it looks when I inspect it:
I have temporarily used this CSS to hide it from everyone:
#resume-manager-candidate-dashboard > p {
display: none;
}
But I still wanted it visible if a user is viewing their own profile as the features to edit and remove their resumes are still there.
I came across the "is_user_logged_in()" function online and I found an example:
/**
* Give a personalized message for logged in users and a generic one for anonymous visitors
*/
function wpdocs_personal_message_when_logged_in() {
if ( is_user_logged_in() ) {
$current_user = wp_get_current_user();
printf( 'Personal Message For %s!', esc_html( $current_user->user_firstname ) );
} else {
echo( 'Non-Personalized Message!' );
}
}
add_action( 'loop_start', 'wpdocs_personal_message_when_logged_in' );
I was wondering if this code could be modified, for example after $current_user = wp_get_current_user();
is there anything that can be added to check whether current user is the same as the user whose profile is being viewed?
...and then echo
the text "Your resume can be viewed, edited or removed below." if user is the same?
...and then else
the text "Your resume can be viewed, edited or removed below." is hidden.
I was just wondering whether there was a way of doing all this in php?
Thank you