Skip to:
Content
Pages
Categories
Search
Top
Bottom

Profile user ID help

  • @sa8001

    Participant

    Hi,

    I’m trying to integrate the Cartpauj PM plugin with my new install of bbPress.

    I want to add a private message link to member’s profile page, so when they click the link it pre-poluates the ‘To’ field in the message.

    I’m using…

    
    <?php if($page = get_page_by_title('title of the page for messages')) 
    {  
                            $link = get_permalink($page->ID); 
    
                            echo '<a href="'.$link.'?pmaction=newmessage&to='xx'">  
                            <span class="pm">Message 
                            </a></span></a>';  
    
                            } ?>

    But I’m stuck at what ‘xx’ should be.

    If I use .$user_ID.

    echo '<a href="'.$link.'?pmaction=newmessage&to='.$user_ID.'">

    It pre-popluates my user name correctly. Anyone help with what I need to use to pull in the ID of the profile the message link is attached to? I’ve tried '.bbp_displayed_user_field( 'ID' ).' – that pulls the correct ID number but places it outside of the clickable link

    Anyone steer me in the right direction?

    Thanks in advance

Viewing 5 replies - 1 through 5 (of 5 total)
  • @niuserre

    Participant

    This is a complete guess based on the way it’s done for a reply which is this:

    <a href="'.$link.'?pmaction=newmessage&to='.get_the_author_meta("ID").'"><span class="pm">Send for author a PM</span></a>

    So I’m thinking get_user_meta("ID") maybe?

    @sa8001

    Participant

    Thanks for the suggestion (hadn’t tried that one). Unfortunately didn’t work.

    @niuserre

    Participant

    Another guess… bbp_get_user_id( 0, true, false )

    Which translates as:

    bbp_get_user_id ([int $user_id = 0], [bool $displayed_user_fallback = true], [bool $current_user_fallback = false])

    @sa8001

    Participant

    You absolute STAR!!!! Just using bbp_get_user_id( 0, true, false ) worked perfectly as in echo '<a href="'.$link.'?pmaction=newmessage&to='.bbp_get_user_id( 0, true, false ).'">

    Thanks x 1000

    @niuserre

    Participant

    Yay! You’re very welcome 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar