Skip to content

Instantly share code, notes, and snippets.

@nocean
Last active January 14, 2016 23:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nocean/5d5c53952be1b71e5eb4 to your computer and use it in GitHub Desktop.
Save nocean/5d5c53952be1b71e5eb4 to your computer and use it in GitHub Desktop.
/**
*
* 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