Unread Post Count

Unread Post Count 1.2.0

No permission to download

jayramfootball

Active member
Hi Chris does this add run a lot of queries - it seems to slow my site down... speed issues have happened since loading the add on. It might not be the add on of course - could be many things, but just wanted to check how many queries this executes...
 
Last edited:

Chris D

XenForo developer
Staff member
It runs about three, in total, I think.

Try and run this query in PHP My Admin:

Code:
ALTER TABLE `xf_post`
ADD INDEX `unread_post_count_post_date` (`post_date` ASC)[/PHP]

If it executes successfully then that is what is missing to optimise the queries that are being run.
 

jayramfootball

Active member
ok ran the query and got the mesage:
#1061 - Duplicate key name 'unread_post_count_post_date'

I guess the index was already set up - it seems likely Chris that it is the addon slowing down the site, as the moment I disabled it the speed on the site came back...

I am using 1.2 RC2 by the way.
 

Brent W

Well-known member
ok ran the query and got the mesage:


I guess the index was already set up - it seems likely Chris that it is the addon slowing down the site, as the moment I disabled it the speed on the site came back...

I am using 1.2 RC2 by the way.

How large is your site (posts per day and traffic) and what kind of server do you have?

Also, are you logging slow queries in MySQL?
 

Brent W

Well-known member
It is probably host related then. I have this installed on every site I own and it runs without a hitch (no slow queries) on a 1000+ post a day forum.
 

CyberAP

Well-known member
@Chris Deeming how does your add-on work exactly? I have a separate template for tabLinks and my customers report that this add-on doesn't work with my custom templates.
 

Chris D

XenForo developer
Staff member
In version 1.1.x it uses a XenForo 1.2 template modification:

upload_2013-8-2_11-36-9.png

It searches for the find-new/posts link in the "navigation" template, and appends my template on the end of it (within the <a> tag so the count is also part of the link).

In XenForo 1.1.X (add-on version 1.0.X) it did some even crazier regular expression on the... header template I think. That was using template hooks.

If you've replaced the navigation template with something else... why would you? But that would explain it.
 

CyberAP

Well-known member
I moved tab links to another template because I wanted them to be in a different place, and that's not possible without separating them into another template. The style I am talking about is Velour, tab links there are in content, not in navigation.
Is there any way to do that PREG replace inside a hook, not inside a template?
 

Chris D

XenForo developer
Staff member
It's not madness at all.

It's two entirely different things.

You can contact me and I'll happily provide a quote to do the work for you.

But it may be cheaper to contact the author of the other add on to see if he can provide similar styling.
 

mauzao9

Well-known member
@Chris Deeming it's nothing but that important. I could use the other, but your do cares about performance, what is a big deal for me since we're a big enough site. :)
 

netrix

Active member
@Chris Deeming, I've got a suggestion for you to change the template of this addon like this:
HTML:
<xen:if is="{$visitor.user_id}">
    <xen:require css="unread_posts_count.css" />
  
    <xen:set var="$unread">
        <xen:callback class="UnreadPostCount_Callback" method="getUnreadCount" />
    </xen:set>
  
        <span class="postItemCount{xen:if '{$unread} != 0', ' alert'}">
            {xen:number $unread}
        </span>
</xen:if>
And change the CSS like this:
Code:
.postItemCount
{   
    background: @primaryDark;
    padding-left: 3px;
    padding-right: 3px;
   
    text-align: center;
   
    font-weight: bold;
   
    border-radius: 2px;
    text-shadow: none;
}

    .postItemCount.alert
    {
        background: #e03030;
        color: white;
        box-shadow: 2px 2px 5px rgba(0,0,0, 0.25);
    }
   
.JsOnly .blockLinksList li .postItemCount {
    float:right;
}
It looks like the addon is more skin compatible, it might be necessary to adjust the fonts or some other CSS settings.
Jaxel did it the same way with XenMedio and it looks like it makes things easier.
 

IcEWoLF

Well-known member
Unfortunately this addon no longer shows with my skin, when browsing the forums 99% is not aligned and barely shows.
 

Chris D

XenForo developer
Staff member
Unfortunately I don't have enough information to assist you with fixing that. Maybe the style author can help?
 
Top