Help - Search - Members - Calendar
Full Version: Notifications Email List : Not In Alphabetical Order?
Movable Type Community Forum > Using Movable Type > Additional Features
Ted06
Hi there,

Just wondering if there's a way to get my Notification Email Address list (MT 3.33 / MySQL) into alphabetical order, rather than listing them in the date users joined?

I've seen several topics / things found via Google (based on previous versions of MT) on how to edit the code and get them in date order, but none on how to list alphabetically.

... or would I have to do something at the database level?

Any info would be greatly appreciated!
Edward.
sarah
In older versions, the Notification List entries were sorted alphabetically, and people wanted them by date. Now they're by date, and people want them alphabetically! wink.gif

Sorting for the list is handled in /lib/MT/App/CMS.pm, particularly around about lines 4455-4462 (in Movable Type 3.33), for the page.
CODE
    if ($type eq 'notification') {
        $app->add_breadcrumb($app->translate('Notification List'));
        $param{nav_notifications} = 1;
        #@data = sort { $a->{email} cmp $b->{email} } @data;
        $param{object_type} = 'notification';
        $param{object_type_plural} = $app->translate('email addresses');
        $param{list_noncron} = 1;
    }


You could try uncommenting the #@data line, but I suspect that this handles the sorting for a single "page view" on the list only (ie, the over list would still be sorted by date, but each page would be alphabetical). So, if you've got more than 20 (or however many rows you're showing on the page) entries on the list, I'm thinking you'd need to do further work on the code above that as well (ie, up in the lines 4300+).

Remember that code modifications are completely unsupported, so if you're going to try this, make sure you have backups, and are prepared for the possibility that it might all go horribly wrong.
Ted06
Hi Sarah,

Thanks a lot for the quick reply - I'll give it a go!

Edward.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.