Most Popular Tags [Deleted]

I hope you can make the title clickable so it goes to forum.com/tags

mostpopulartags1.webp



And maybe the choice have it at the bottom? Although i think the sidebar is fine.

bottom.webp

Cool add-on! I'll have to try it tomorrow

.
.
 
when i use the bdWF i have it dopple in the forum . in the sidebar and in the position where i use it with wf . where can i disable the sidebar position ?
 
@Eagle

Thanks for this add-on.
Forum down after installing your add-on.

Error message => Zend_Db_Statement_Mysqli_Exception: Mysqli prepare error: Table 'betclever_prod.xf_tag' doesn't exist - library/Zend/Db/Statement/Mysqli.php:77

Xenforo version => 1.44 (Need to upgrade, I know but I'm using a custom theme and waiting the developper).
 
#1 Does add-on this take in effect the "Minimum Tag Cloud Uses"

Capture.webp

I have this setting at 5 uses.
But the tag cloud sidebar still shows tags that have only been used 1 time


#2 I also have another problem.

Example:
The sidebar tag cloud shows tag "cool car"
when i click on it in the brower it takes me to the link is tags/cool%20car/
and it shows "The requested tag could not be found"

The correct link is tags/cool-car

I think it's a bug
 
Can't wait to upgrade to 1.5 to install this great addon.
This should be core.
There are additional queries in forum_list?
Thanks Eagle!
 
Yes. I set the "Minimum Tag Cloud Uses" settings to 5.

When i go into myforum.com/tags i don't see many tags. Only about 8

I set my most popular sidebar cloud settings at 50. And i see 50 tags in the sidebar.


I will uninstall it and install it again, and see if that changes
 
Out of those 50 tags. I see 1 or 2 popular tags.

Most of the tags that are being showed first are ones that have been used 1 time.

And i don't see any BIG tags :

example

car, cats, DOGS, joey, meow
 
@Eagle what about links romanisation? And this problem too:
#2 I also have another problem.

Example:
The sidebar tag cloud shows tag "cool car"
when i click on it in the brower it takes me to the link is tags/cool%20car/
and it shows "The requested tag could not be found"

The correct link is tags/cool-car

I think it's a bug
 
I just downloaded and installed the latest version, but in my sidebar are only the (from alphabetical view) last 25 tags. So I have now only tags starting with v-z.
It's also what I understand from the query in MostPopularTags.php
PHP:
SELECT tag_id, tag, tag_url FROM xf_tag as tag WHERE tag_id ORDER BY tag DESC
Shouldn't it be
PHP:
SELECT tag_id, tag, tag_url FROM xf_tag as tag WHERE tag_id ORDER BY use_count DESC

Nevertheless, also after changing to use_count, all tags appear with the same font size.
Did I miss something ?
 
Last edited:
Great add on - thank you @Eagle . Is it possible to change its position to the top of the forum list sidebar (above New Resources, for example?)

upload_2015-8-21_16-31-41.webp
 
Did I miss something ?
Try replacing the contents of that file with the below. The net result should be that the top X used tags will be shown using the same weighted font size as the XF tag search screen.

Just remember though that if all of your top X used tags are used the same amount of times then they'll all be the same size in the results (in other words, if your top 25 used tags were all used 5 times then all 25 tags will be the same exact size). If you end up with a lot of tags that all have more than 7 uses then they'll also end up all being the same size (since there are only 7 font sizes defined currently for the tags).

EDIT: I'm playing around with this in the sidebar at Alien Soup and for now at least you can see the results of using the code below.

Code:
<?php

class Eagle_MostPopularTags_Model_MostPopularTags extends Xenforo_Model_User
{
        public static function MostPopularTagsArray()
        {
                $db = XenForo_Application::get('db');
                $MostPopularTags = array();
                $options = XenForo_Application::get('options');
                $limitforpopulartags = XenForo_Application::get('options')->MostPopularTagsCount;

                if (XenForo_Application::get('options')->MostPopularTagsEnableAddon)
                {
                        $MostPopularTagsArray = $db->fetchAll($db->limit("
                        SELECT tag, tag_id, tag_url, use_count
                        FROM xf_tag as tag
                        WHERE tag_id
                        ORDER BY use_count DESC", $limitforpopulartags));

                        sort($MostPopularTagsArray);

                        foreach($MostPopularTagsArray as $tag)
                        {
                                $hrefx = XenForo_Link::buildPublicLink('tags', $tag);
                                if ($tag['use_count'] > 7) { $tag['use_count'] = 7; }
                                $MostPopularTags[] = array("tags" => $tag['use_count'], "tag_url" => $tag['tag_url'], "title" => $tag['tag'], "href" => $hrefx);
                        }

                return $MostPopularTags;

                }
        }
}
 
Thank you very much.
Just remember though that if all of your top X used tags are used the same amount of times then they'll all be the same size in the results (in other words, if your top 25 used tags were all used 5 times then all 25 tags will be the same exact size). If you end up with a lot of tags that all have more than 7 uses then they'll also end up all being the same size (since there are only 7 font sizes defined currently for the tags).
After my last post I also played a bit around with the code to get a real MostPopularTags add-on as this add-on currently shows only the last tags without weighting.
I took a look into the xF code for the tag cloud, copied and modified some parts and now it's doing what it is for ;)
It also solves your problem with the 7 font sizes.
PHP:
<?php

class Eagle_MostPopularTags_Model_MostPopularTags extends Xenforo_Model_User
{
    public static function MostPopularTagsArray()
    {
        $db = XenForo_Application::get('db');
        $MostPopularTags = array();
        $options = XenForo_Application::get('options');
        $limitforpopulartags = XenForo_Application::get('options')->MostPopularTagsCount;

        if (XenForo_Application::get('options')->MostPopularTagsEnableAddon)
        {
            $tags = $db->fetchAll($db->limit("
            SELECT tag_id, tag, tag_url, use_count
            FROM xf_tag as tag
            WHERE tag_id
            ORDER BY use_count DESC", $limitforpopulartags));
           
            shuffle($tags);
           
        $uses = XenForo_Application::arrayColumn($tags, 'use_count');
        $min = min($uses);
        $max = max($uses);
        $levels = 7;
        $levelSize = ($max - $min) / $levels;

        if ($min == $max)
        {
            $middle = ceil($levels / 2);
            foreach ($tags AS $id => $tag)
            {
                $tags[$id]['level'] = $middle;
            }
        }
        else
        {
            foreach ($tags AS $id => $tag)
            {
                $diffFromMin = $tag['use_count'] - $min;
                if (!$diffFromMin)
                {
                    $level = 1;
                }
                else
                {
                    $level = ceil($diffFromMin / $levelSize);
                }
                $tags[$id]['level'] = $level;
            }
        }

            foreach($tags as $tag)
            {
                $hrefx = XenForo_Link::buildPublicLink('tags', $tag);
                $MostPopularTags[] = array("tags" => $tag['level'], "tag_url" => $tag['tag_url'], "title" => $tag['tag'], "href" => $hrefx);
            }

        return $MostPopularTags;

        }
    }
}
I am not a professional coder, so there may be a more elegant way to do this ;)
 
It also solves your problem with the 7 font sizes.
I don't think that really solves the issue since if all X tags returned in the query have the same use_count then they'll still end up the same size, same result as before.

The problem isn't with this sidebar add-on, the tag CSS definitions themselves in XF 1.5 only have 7 size definitions that might be displayed in the Tags search screen. This add-on is using the same CSS definitions and is mimicking how XF itself would display the weighted tags.
 
I don't think that really solves the issue since if all X tags returned in the query have the same use_count then they'll still end up the same size, same result as before.
Yes, THAT's right. If ALL have the same use_count than ALL have the same weight. Like every single Dollar is worth a Dollar, the first one in a row of 10 isn't worth more or less ;)

The problem isn't with this sidebar add-on, the tag CSS definitions themselves in XF 1.5 only have 7 size definitions that might be displayed in the Tags search screen. This add-on is using the same CSS definitions and is mimicking how XF itself would display the weighted tags.
Thats (partially) not correct.
Correct is: XF have 7 size definitions.

The original add-on code use the use_count directly for the size definition. If a tag is used 1 time, the size is 1; used 2 times than the size is 2 and so on.
As all of our top 25 tags are used more than 20 times the sizes would be >20. As there no size bigger than 7, all tags sizes "fall back" to the standard XF link size.

Your code use the same system for tags with 1 to 7 uses, but also set all uses >7 to 7.
Now all our top 25 tags have the same (the biggest) size ;)

The XF code (and so the code I copied into the add-on code) use the use_count of the tags in the array.
The minimum use_count is set to size 1. The others are calculated by a levelsize factor:
$levelSize = ($max - $min) / $levels;

So the tags are weighted, but only within the array of selected tags.
If you show only the top 10 tags, at least 1 tag will have size 1 and at least one tag size 7, all the others one of the 7 sizes.
If you than show the top 25 tags, there will be (at least) 1 other tag with size 1, but the tag that had size 1 in the top 10 will have a bigger size.

PS: of course, there might be exceptional cases. E.g. all your top 25 tags have only 1 or 2 uses, then the sizes of top 10 and top 25 might be the same ;)
 
Top Bottom