WordPress.org

Ready to get started?Download WordPress

Forums

Subscribe2
[resolved] Please change Sorted list of subscribers to Case-Insensitive sorting (10 posts)

  1. mharpen
    Member
    Posted 1 year ago #

    Matt, please consider sorting the list of subscribers with "case-Insensitive". It's hard to find someone when some emails with upper case are sorted at the top, and others are lower case and sorted below that. Especially for trying to spot if someone is in there twice. Also, please ignore case when checking if someone is already subscribed. I'm seeing a few subscribers in there twice with the different case, but same email address. Thanks!

    http://wordpress.org/extend/plugins/subscribe2/

  2. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @mharpen,

    I'll take a look at the Table class and see if this can be done.

  3. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @mharpen,

    It was actually much easier than I though, in the classes/class-s2-list-table.php look for the usort_reorder() function towards the end of the file. In there you'll see this line (approx line number 206):
    $result = strcmp($a[$orderby], $b[$orderby]);
    Change that to:
    $result = strcasecmp($a[$orderby], $b[$orderby]);

  4. mharpen
    Member
    Posted 1 year ago #

    Thanks Matt! Do you plan to add this in the next update?

  5. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @mharpen,

    Yes, it's already committed to the development code.

  6. mharpen
    Member
    Posted 1 year ago #

    Also, case insensitivity needs to be in the area that accepts new subscriptions also, so users get a message "you've already subscribed". Does this change handle that too?

  7. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @mharpen,

    No. Subscribe2 is standards compliant with RFC 2821. Capitalisation before the '@' in an email is allowed and can be considered a different email from the same word in lower case. While it isn't recommended it is the current standard.

    Anything after the '@' should be in lower case, so Subscribe2 sanitises any input email address to the user part is left as it is input and the domain part is made lower case. Deviating from this means the plugin will no longer be standards compliant.

    EDIT, in fact RFC 2821 has been replaced by RFC 5321 but the same argument applies.

  8. mharpen
    Member
    Posted 1 year ago #

    Thanks again Matt. yes, i just looked it up too. Interesting, but the research says "Hardly any email service or ISP enforces case sensitive email addresses".

    Seems odd that this is a standard and hardly any isp is strict about it. I'm guessing it will probably fall off the standards list eventually.

    Anyway, maybe consider adding a checkbox option to force all email addresses to lower case, so we can choose to be strict or not. I only have about 50 subscribers, and 3 have duplicates (different case). I'm guessing the user wasn't sure they subscribed or not, and subscribed again.

    Thanks again!!

  9. mharpen
    Member
    Posted 1 year ago #

    hey, that usort() function is pretty cool. i didn't know about that. nice implementation of it you did too!

  10. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @mharpen,

    I'd love to take credit for the sort() function but it's all taken from the WordPress core examples! :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.