default userpic

mt:Entries category="NOT Something" Broken?

Vote 0 Votes

I recently upgraded an MT Enterprise install to 4.25 without any problems, until I wanted to rebuild the site which is spread across multiple blogs. One particular blog filters out a specific category from RSS feeds and monthly archives using mt:entries category="NOT Category Label Here", which worked just fine before the upgrade. Now this attribute causes an error upon rebuild, stating there is an error in my category attribute.

I have removed this attribute for now and have started using an mt:Unless within the mt:Entries to filter out the entries, however this is not ideal as it makes the limit and lastn attributes redundant.

Has anyone else come across this problem? Does anyone have a solution?

Reported on Movable Type 4.2

7 Replies

| Add a Reply
  • I would hardly believe that this is broken.

    As you're having an Enterprise license, I would recommend to open a support ticket for this.

  • I have this exact same problem. If there is a fix, I'd like to know what's up. I'm NOT using Enterprise, I'm using MT Pro. May same category="NOT Something" logic has worked for over a year and now it is broken after upgrading to 4.25.

  • FYI, I fixed this problem by replacing this file with an older version

    lib/MT/Template/ContextHandlers.pm

    By replacing that file with the 4.23 version, my old NOT logic works just fine.

    Clearly a bug in the code...

  • Yes, I confirm this bug. Until Six Apart will issue a fix, I've been able to fix this problem for myself by replacing the lines:

    from line 7997 (" children => ")

    up to line 8030 (" if ($cexpr) {")


    With the following lines taken from movable type v4.24:

    ##################### CUT FROM HERE ###########
    children =>
    $class_type eq 'entry' ?
    ($args->{include_subcategories} ? 1 : 0) :
    ($args->{include_subfolders} ? 1 : 0)
    });
    } else {
    if (($category_arg !~ m/\b(AND|OR|NOT)\b|[(|&]/i) &&
    (($class_type eq 'entry' && !$args->{include_subcategories}) ||
    ($class_type ne 'entry' && !$args->{include_subfolders})))
    {
    if ($blog_terms{blog_id}) {
    $cats = [ $cat_class->load(\%blog_terms, \%blog_args) ];
    } else {
    my @cats = cat_path_to_category($category_arg, [ \%blog_terms, \%blog_args ], $class_type);
    if (@cats) {
    $cats = \@cats;
    $cexpr = $ctx->compile_category_filter(undef, $cats, { 'and' => 0 });
    }
    }
    } else {
    my @cats = $cat_class->load(\%blog_terms, \%blog_args);
    if (@cats) {
    $cats = \@cats;
    $cexpr = $ctx->compile_category_filter($category_arg, $cats,
    { children => $class_type eq 'entry' ?
    ($args->{include_subcategories} ? 1 : 0) :
    ($args->{include_subfolders} ? 1 : 0)
    });
    }
    }
    $cexpr ||= $ctx->compile_category_filter($category_arg, $cats,
    { children => $class_type eq 'entry' ?
    ($args->{include_subcategories} ? 1 : 0) :
    ($args->{include_subfolders} ? 1 : 0)
    });
    }
    if ($cexpr) {
    ##################### CUT UP TO HERE ###########

  • I've missed to mention that the file you should edit is:

    /mt/lib/MT/Template/ContextHandlers.pm

    And that you will need to download this file from the server and upload it back after editing in ASCII mode.

  • Thanks for all the replies guys, and thanks for the fix. When I get a few minutes I'll check the bug site to see if this has not already been raised, and if it hasn't I'll raise it.

Add a Reply

If you need to share template code, replace all the "<" signs with "&lt;" or use this utility.

Forum Groups

1773 6162

Last Topic: Excluding categories from blog by kholechek on Feb 9, 2012

86 302

Last Topic: website entries by masoud on Oct 26, 2011

1429 5077

Last Topic: What apocalypse hit this community in the middle of 2011? by 75th on Feb 10, 2012

695 2910

Last Topic: Insert Image / File Fails by Russ Miller on Feb 10, 2012

84 291

Last Topic: How to have some other characters in entry basename automatically written by Afshin Haghighatnia on Dec 22, 2011

173 737

Last Topic: About the MT version stated in HTML source by Alex E. Schneider on Feb 7, 2012

190 567

Last Topic: Analytics Reporting by michael webster on Feb 5, 2012

48 210

Last Topic: An idea and also a request by Afshin Haghighatnia on Jun 29, 2011

64 246

Last Topic: jQuery in MT 5.1 still at 1.4 - why? by perlmonkey on May 25, 2011

code.sixapart.com

137 478

Last Topic: Getting a thumbnail with xpath by Peter on Mar 13, 2011

222 720

Last Topic: Custom Field for Asset Not Appearing by android on Feb 9, 2012