XF 2.2 Finding number of views for an article forum

Mendalla

Well-known member
We have our first article forum running, a kind of "feature blog" where a member (who also happens to my co-admin and co-founder of the board) is posting material she originally put out on social media. She would like to know how many views the threads are getting but we are running it with the Preview layout which does not show views. I did some searching and found (and voted up) the suggestion below, but does anyone know a way to do this now short of switching the article forum to the default forum list layout? I am even game to use SQL if needed but I am not sure what tables to use just looking at the database (is the schema published anywhere??).

 
Solution
I just did an edit to post_article_macros template

Code:
<ul class="articlePreview-meta listPlain">
                <li><xf:avatar user="{$thread.User}" size="xxs" defaultname="{$thread.username}"/></li>
                <li class="articlePreview-by">{{ phrase('by_user_x', {'name':$username}) }}</li>
                <xf:comment>PETE added views</xf:comment>
                <li><dl class="pairs pairs--justified structItem-minor">
                <dt>{{ phrase('views') }}</dt>
                <dd>{{ $thread.discussion_type == 'redirect' ? '&ndash;' : ($thread.view_count > $thread.reply_count ? $thread.view_count|number_short : number_short($thread.reply_count+1)) }}</dd>
            </dl></li>

fionix

Active member
That's interesting, wonder why no one has answered this... isn't there a way to enable view count so we can see it?

It's an important piece of information I think ?
 

Mendalla

Well-known member
LOL. Forgot I had posted this. Senior moment, I guess. Thanks for the bump. Just spun up another article forum yesterday, in fact. Question still stands, of course.
 

ge66

Well-known member
Maybe this could be of some help?
 

Mendalla

Well-known member
Maybe this could be of some help?
It is indeed. Thanks for pointing out that thread. (y)
 

Mr Lucky

Well-known member
I just did an edit to post_article_macros template

Code:
<ul class="articlePreview-meta listPlain">
                <li><xf:avatar user="{$thread.User}" size="xxs" defaultname="{$thread.username}"/></li>
                <li class="articlePreview-by">{{ phrase('by_user_x', {'name':$username}) }}</li>
                <xf:comment>PETE added views</xf:comment>
                <li><dl class="pairs pairs--justified structItem-minor">
                <dt>{{ phrase('views') }}</dt>
                <dd>{{ $thread.discussion_type == 'redirect' ? '&ndash;' : ($thread.view_count > $thread.reply_count ? $thread.view_count|number_short : number_short($thread.reply_count+1)) }}</dd>
            </dl></li>
 
Solution
Top