Skip to:
Content
Pages
Categories
Search
Top
Bottom

Profile user ID help


  • SA8001
    Participant

    @sa8001

    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

    @niuserre

    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

    @sa8001

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


    niuserre
    Participant

    @niuserre

    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

    @sa8001

    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

    @niuserre

    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