HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Changing category description character limit

pitkmipitkmi scifi-meshes.com

Vanilla 3.3. Weird question. 😛

I've been messing around with @rbrahmson 's FilterDiscussion a little, and came up with a bunch of filters for filtering discussions based on various different parameters, including thread prefixes. All of this worked fine, so I figured I'd put the URLs for the filters into category descriptions (there's some JS trickery in place to make the prefixes category specific), which works fine in theory, but as it turns out there's a hard 500 character limit on the descriptions, which is not enough for 5 or 6 different URLs, since everything gets counted.

Is there an easy way to increase the limit?

Comments

  • rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one" NY ✭✭✭

    Have you looked into saved filters? They allow you to reference a complex long set of parameters with a single keyword.

  • pitkmipitkmi scifi-meshes.com

    Yeah, that's how I set them up. Problem is getting the URLs to fit in the descriptions. I could put them in a menu or in the sidebar, but I think having them on the main index would be the most usable implementation for thread prefixes.

  • rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one" NY ✭✭✭

    Can you send me screen shots of your filter definitions and how you invoke them (publicly or as a pm - your choice)?

  • pitkmipitkmi scifi-meshes.com

    Uh, sure. I'm just messing with the concept on the dev site, so nothing final yet.

    Here are the current settings:

    And here's how they should appear on the forum index:

    So, the link I'd like to fit in there would be something like /discussions/filterdiscussion?!filter=wip3d or /discussions/filterdiscussion?!filter=wip2dand so on. Currently messing with Routes to see, if I can make the URLs a little shorter, but the quickest solution would still seem to be an option to bump the category descriptions to 5000 characters or something.

  • rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one" NY ✭✭✭

    Still don't understand the url length limit you face but routes can indeed shorten urls...

    I've got a newer version in the works that will hopefully go up before the end of the year. It won't change the url length but possibly give you more options.

  • @rbrahmson The OP's problem has nothing to do with your wonderful plugin, which indeed works quite delightfully well with custom routes/url.

    The OP is asking about Vanilla Forum's native limit on the $Category.Description.

    The OP has observed that that Category attribute has a limit which gets filled up rather quickly, and html characters are no friends to it.

    The OP intends to put links (in HTML format) in that Category attribute.

    @pitkmi I just go straight to the Database and tweak the 500 limit. It's your site, better to do that tweak so that you can achieve exactly what you want and enjoy it. When you upgrade Vanilla Forums, the change you made shall persist.

    Cheers!

  • Without asking me how come the OP is clear to me, I will answer:

    It's because I have trodden that path very amply ... putting images and videos and whatnot into that pesky little Category description... all to my frustration. 😎

  • rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one" NY ✭✭✭

    @donshakespeare - Thanks for clarifying. @pitkmi - I fully endorse donshakespeare's suggestion (jusr remember the db change when you upgrade versions)

    I just uploaded version 1.8.5 of the plugin. Read the description of the changes in that version in the plugin source. There is a lot new in there.

  • pitkmipitkmi scifi-meshes.com

    Ok, upping the limit in the database did the trick, but like you said with the caveat is that whenever /utility/structure or a forum update(probably) happens the limit resets to 500 and existing descriptions will get truncated. Easy enough to fix manually. As a workaround could bump it in applications/vanilla/settings/structure.php(best guess; could be somewhere else) too, but still need to keep an eye on it during updates.

    Thanks for your help @donshakespeare, @rbrahmson :)


    Oh, if you're looking for feature ideas, the help messages are extremely helpful when setting up the plugin, but may communicate a bit too much information about the database to end users on an internet facing forum. Doesn't matter, if you use it as an admin tool, but if regular users are going to get to use the filters, an option to disable the messages or replace them with more generic ones might be handy. I've just been commenting them out or replacing them with generic messages in the code so far, which works too.

  • rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one" NY ✭✭✭

    First, I'd consider adding another field to the category table with the longer description so it wouldn't be subjected to (the still unlikely) change i future versions.

    Second, I looked again at your sample filters which use category numbers, Take a look at the plugin source comments about using the (category} paramete that allow you to use category names. Example:prefix=animation,{$category}=General


    Lastly, in the source you can see the HelpMessage function. You can add this line in this function and anything below it would anly appear for admins:

        if (!Gdn::Session()->CheckPermission('Garden.Settings.Manage')) return;

    I suggest you add it after:

    if (is_array($Fields) && !empty($Fields)) {

  • pitkmipitkmi scifi-meshes.com

    Second, I looked again at your sample filters which use category numbers, Take a look at the plugin source comments about using the (category} paramete that allow you to use category names. Example:prefix=animation,{$category}=General

    CategoryIDs had fewer characters, so I went with those, back when that was the issue.


    Lastly, in the source you can see the HelpMessage function. You can add this line in this function and anything below it would anly appear for admins:

        if (!Gdn::Session()->CheckPermission('Garden.Settings.Manage')) return;

    I suggest you add it after:

    if (is_array($Fields) && !empty($Fields)) {

    That did the trick. Had to put it a couple of lines earlier though.

    Thanks for your help. The category filters are now up and running on the main site, and I got all sorts of cool filters planned for the future. :)

Sign In or Register to comment.