WordPress.org

Ready to get started?Download WordPress

Forums

Subscribe2
[resolved] Are e-mail aliases (ex: username+alias@gmail.com) fully supported ? (11 posts)

  1. bosseal
    Member
    Posted 5 months ago #

    Dear support,

    Just a simple question: are e-mail aliases (ex: username+alias@gmail.com) fully supported ?

    I ran a simple test with subscribers having e-mail aliases and notifications are not sent to them IF "Restrict the number of recipients per email to" is > 1 (tested with 10 in my case).

    When a subscriber of "Registered Subscribers" having an e-mail alias is edited, there is a weird behavior:

    • The name of user is not displayed after label "Editing Subscribe2 preferences for user: "
    • Fields are empty
    • When submitting, the message "Subscription preferences updated." is displayed but it looks preferences are not saved

    Could you also reproduce the same issues ?

    Thanks a lot for your help,

    Best regards,

    Alexandre 8)

    https://wordpress.org/plugins/subscribe2/

  2. mattyrob
    Member
    Plugin Contributor

    Posted 5 months ago #

    @Alexandre,

    I can confirm this weird behaviour, there is a pretty quick fix. In the /admin/your_subscriptions.php file find this line:

    $user_ID = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_email = %s", urldecode($_GET['email'])));
    And replace it with:
    $user_ID = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_email = %s", $_GET['email']));

  3. bosseal
    Member
    Posted 5 months ago #

    @mattyrob

    Thanks for the quick fix, unfortunately it didn't work. But I applied a similar fix that worked for me (but can't guarantee it meets all expected requirements):

    In the /admin/your_subscriptions.php - Replace
    $user_ID = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_email = %s", urldecode($_GET['email'])));
    with
    $user_ID = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_email = %s", rawurldecode($_GET['email'])));

    And in the /classes/class-s2-list-table.php - Replace
    $actions = array('edit' => sprintf('<a href="?page=%s&email=%s">%s</a>', 's2', $item['email'], __('Edit', 'subscribe2')));
    with
    $actions = array('edit' => sprintf('<a href="?page=%s&email=%s">%s</a>', 's2', rawurlencode($item['email']), __('Edit', 'subscribe2')));

    Gonna complete my testing now...

    Best regards,

    Alexandre 8)

  4. mattyrob
    Member
    Plugin Contributor

    Posted 5 months ago #

    @Alexandre,

    Hmm, it worked in my tests both with an without adding a urlencode() call in the /classes/class-s2-list-table.php file.

  5. bosseal
    Member
    Posted 5 months ago #

    OK thanks for your testing. I tried again (with IE, FF, GC) with the urlencode / urldecode methods but it didn't work with my configuration (WP3.8.1, Subscribe2 9.2 and PHP 5.3.21).

    So for now I have to fork with this rawurlencode / rawurlcdoe - won't make my maintenance easy :(

    Alexandre

  6. mattyrob
    Member
    Plugin Contributor

    Posted 5 months ago #

    @Alexandre,

    I'll keep testing but it might be because of the urldecode() / rawurldecode() call in the /admin/your_subscriptions.php file.

    According to the urldecode() documentation at PHP.net data in $_GET and $_REQUEST variables is already decoded so by having that call it is being decoded twice and it therefore probably breaking. Try removing the call completely in that file.

  7. bosseal
    Member
    Posted 5 months ago #

    OK thanks for your help, we'll find a solution to avoid forking :)

    But I'm a bit confused now as everything is mixed... so could I kindly ask you to post the content of your files:

    • /admin/your_subscriptions.php for the line starting with $user_ID = $wpdb->get_var($wpdb->prepare("SELECT ID FROM[...]
    • /classes/class-s2-list-table.php for the line starting with
      $actions = array('edit' => sprintf('%s', 's2',[...]

    And I'll then give a new test

    Thanks a lot and sorry for the inconvenience,

    Alexandre 8)

  8. mattyrob
    Member
    Plugin Contributor

    Posted 5 months ago #

    @Alexandre,

    Sure :) I have this:

    In /admin/your_subscriptions.php I have:
    $user_ID = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_email = %s", $_GET['email']));

    And in /classes/class-s2-list-table.php I have:
    $actions = array('edit' => sprintf('<a href="?page=%s&email=%s">%s</a>', 's2', urlencode($item['email']), __('Edit', 'subscribe2')));

  9. bosseal
    Member
    Posted 5 months ago #

    @mattyrob

    Hi, thanks for this, indeed it's working correctly like this !

    Perfect !

    Will you add this fix in your next release or is it something I'll have to patch every time there is a new release ?

    Thanks a lot,

    Alexandre 8)

  10. mattyrob
    Member
    Plugin Contributor

    Posted 5 months ago #

    @Alexandre,

    Based on my testing I checked in some changes to the development version last night that will be in future versions.

    http://plugins.trac.wordpress.org/changeset/865693

  11. bosseal
    Member
    Posted 5 months ago #

    Great, perfect, thanks a lot !

Reply

You must log in to post.

About this Plugin

About this Topic