Skip to:
Content
Pages
Categories
Search
Top
Bottom

Highlight author's topics. Outputting functions as a variable without displayin

  • Avatar of sawyerh
    SawyerH
    Participant

    @sawyerh

    I’m trying to highlight a forum topic if the person logged in wrote it. I think I know how to go about setting it up, but the functions I use aren’t working for me.

    I want to write an if statement that looks something like this:

    if(bp_the_topic_poster_name() == bp_loggedin_user_fullname()){echo 'id="author"';}

    This actually displays both the poster name and the logged in username on the website. Obviously I don’t want that haha.

    Any ideas?

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • use:

    bp_get_the_topic_poster_name and bp_get_loggedin_user_fullname

    Avatar of sawyerh
    SawyerH
    Participant

    @sawyerh

    Thanks Paul, I actually tried that and wasn’t able to get it to work. However I got this one to work:

    if(bp_get_the_topic_poster_id() == bp_loggedin_user_id())

    Avatar of Anointed
    Anointed
    Participant

    @anointed

    @sawyerh I was thinking about doing something very similar, but have not yet dug deep enough to find the code to modify this. Can you point me in the right direction?

    Avatar of sawyerh
    SawyerH
    Participant

    @sawyerh

    You want to edit forums/forums-loop.php

    Find the <tr> under

    <?php while ( bp_forum_topics() ) : bp_the_forum_topic(); ?>

    and add

    <tr class="<?php bp_the_topic_css_class() ?><?php if(bp_get_the_topic_poster_id() == bp_loggedin_user_id()){echo '-topic-author topic-author';} ?>">

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.