-
-
Save nocean/5d5c53952be1b71e5eb4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* This will add an additional contact item to WPAdverts | |
* Add this to your overridden /wpadverts/single.php theme file. | |
* | |
* It checks to confirm the user is logged in, and will not display if you are viewing your own ad. | |
* | |
*/ | |
if (function_exists('bp_send_private_message_link') && is_user_logged_in() ) { | |
global $bp; | |
if ($bp->loggedin_user->id !== bbp_get_reply_author_id()){ | |
$user = get_userdata( bbp_get_reply_author_id() ); | |
if ( !empty( $user->user_nicename ) ) { | |
$user_nicename = $user->user_nicename; | |
} | |
$compose = bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' . $user_nicename; ?> | |
<p class="adverts-contact-method"> | |
<span class="adverts-icon-mail adverts-contact-icon" title="<?php _e('Private Message','your_textdomain'); ?>"></span> | |
<span class="advertise-contact-pm"><a href="<?php echo $compose; ?>" title="">Send <?php echo get_post_meta($post_id, 'adverts_person', true); ?> a Private Message</a></span> | |
</p> | |
<?php } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment