Skip to:
Content
Pages
Categories
Search
Top
Bottom

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

  • Profile photo 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)
  • Profile photo of Paul Gibbs
    Paul Gibbs
    Keymaster

    @djpaul

    use:

    bp_get_the_topic_poster_name and bp_get_loggedin_user_fullname

    Profile photo 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())

    Profile photo 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?

    Profile photo 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)
  • The topic ‘Highlight author's topics. Outputting functions as a variable without displayin’ is closed to new replies.
Skip to toolbar