WordPress.org

Ready to get started?Download WordPress

Forums

Subscribe2
[resolved] Bug Report + Solution: New users are auto-subscribed but can't receive mai (8 posts)

  1. Gengar003
    Member
    Posted 2 years ago #

    I am running Subscribe2 version 7.1 on a WordPress 3.3.1 Multi-Site setup.

    On one of the sites, I had "auto-subscribe new users" enabled.

    When new user accounts were registered, they appeared to be subscribed automatically, but would not receive any e-mails about posts from Subscribe2. They could receive e-mails sent from the "Send Email" interface.

    Once a user (or an administrator) updated an affected user's subscribe2 settings, even if they left all the settings alone and just saved them with no changes, the user would become able to receive emails about posts.

    I tracked this down to the s2_authors usermeta field.

    function register(...) in subscribe2.php does not create (update_usermeta) this field. So when a user registers, if they are truly a new user, they will not have a usermeta entry for s2_authors.

    The user_menu(...) function, around line 2470, will update_usermeta for s2_authors to *something*, regardless of whether anything was set for that option. Afterward, that user will have an s2_authors usermeta entry, and be able to receive e-mail.

    Manually adding this entry in the database for a given user will enable them to begin receiving post e-mails. Removing it again will stop them.

    The solution could either be to add to function register(...) code to ensure that s2_authors is initialized, or (and I didn't look into this next solution) to modify the code that sends e-mails to be able to succeed even if a usermeta entry for s2_authors doesn't exist.

    If it were me, just trying to fix my subscribe2 install and get it working (as opposed to a subscribe2 dev, looking into an appropriate long-tem solution), I would insert the following:

    update_user_meta($user_ID, $this->get_usermeta_keyname('s2_authors'), '');

    At line 1236 in subscribe2.php, right before
    // has this user previously signed up for email notification?

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

  2. mattyrob
    Member
    Plugin Contributor

    Posted 2 years ago #

    @Gengar003,

    That is magnificent, thank you very much for a detailed bug hunt and suggested fix. I'll get this patched for 7.2 and the code that runs on upgrade should fix any existing users too.

    For the time being adding your line:

    update_user_meta($user_ID, $this->get_usermeta_keyname('s2_authors'), '');

    After line 1252 and then the new 1268 (so 1267 before the first line addition) should fix this for good.

  3. WebEndev
    Member
    Posted 2 years ago #

    @Gengar003,

    AWESOME job tracking this down. I had the same issue here

    Thanks!!!

  4. mattybe
    Member
    Posted 2 years ago #

    This same bug has been driving me crazy. Unfortunately, I only found this by tracking it down myself and googling "s2_authors" for confirmation.

    This SQL isn't the prettiest, but it should fix the existing users:
    insert into wp_usermeta (user_id, meta_key, meta_value) select wp_users.id, 's2_authors', '' from wp_users where id in (select user_id from wp_usermeta where meta_key = 's2_autosub' and meta_value='yes') and id not in (select user_id from wp_usermeta where meta_key = 's2_authors');

  5. Fdyocum
    Member
    Posted 2 years ago #

    Does anyone know whether this was fixed? I am running the latest version and it looks like code was substantially rejigged, but the client says the problem persists. New users are not automatically signed up.

  6. mattyrob
    Member
    Plugin Contributor

    Posted 2 years ago #

    @Fdyocum,

    This was fixed in 7.3 and the code changes made there have persisted into the current version.

    Have you checked the auto subscribe settings at Subscribe2->Settings?

  7. Fdyocum
    Member
    Posted 2 years ago #

    @Matthew - Thanks for responding.

    The auto subscribe is checked. I note there is a problem with mass changing of email settings (also a problem).

    Should I install the development code, referenced in that thread in the hope that both will disappear?

  8. mattyrob
    Member
    Plugin Contributor

    Posted 2 years ago #

    @Fdyocum,

    By all means give the development code a try, it will certainly fix the bulk changing bug. I'm not sure that will impact on the Auto-subscribe code though as that only applies to new users. That said though, updating the code runs an upgrade function that may also be worthwhile in your case.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags