Adding to a widget

tekboi

Active member
I'm currently using a xenforo plugin that displays the latest threads in a wordpress widget. The plugin is bare bones and I would like it to display more information such as: the original poster's Avatar, and the time the thread was created. But I'm still learning .PHP so i'm not the best coding at the moment. And i'm new to xenforo so i'm unfamiliar with xenforo shortcode and whatnot.

Here is the code that I think needs to be added to in order to produce the desired effects.

Code:
$thread_qry = '
                        SELECT thread_id, title, last_post_date FROM `xf_thread`
                        WHERE discussion_state = 1
                        ORDER BY `last_post_date` DESC
                        LIMIT ' . $number_of_posts . '
                        ';

        $threads = XenForo_Application::get( 'db' )->fetchAll( $thread_qry );

        $link = '';

        foreach ( $threads AS $thread ) {

                echo(
                    "<div class='entry-meta'><a href='"
                    . $XF->createLink( $link )
                    . XenForo_Link::buildPublicLink( 'threads', $thread )
                    . "'>"
                    . XenForo_Helper_String::wholeWordTrim( $thread['title'], 40 )
                    . "</a></div>"
                    ."<hr>"
                    ."<br>"
                );
            }

        echo $after_widget; // post-widget code from theme
    }


Is there anyone or any documentary I can read that will help me accomplish this?
 
You should join xf_user to get avatar data *gender, avatar_date, gravatar*

In the field you fetching the table xf_thread you should include the column `post_date` so you can display created at...
 
Back
Top Bottom