Support » Plugin: MailPoet - emails and newsletters in WordPress » Subscribers in multisite – all multitiste wordpress users are subscribers

  • Hello there,

    I know that this is an already known issue since almost three years but it still isn’t solved yet. MailPoet does know and does also say that the following is a bug:

    When a site admin goes to the subscribers page, all multisite wordpress users are synchronize as subscribers of MP3. Even the multisite WordPress users that are not members of the blog.

    We tried the fix mentioned here https://wordpress.org/support/topic/subscribers-in-multisite/#post-9552669 and it was working. But unfortunately with the newest version of MailPoet3 v3.55.0 it isn’t.

    Does anybody has any ideas on how to fix this?

    Kindly,
    Anke

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter A.

    (@anke16)

    @jdrivard – You once helped us out so much with mentioning your fix. It was working perfectly.

    We tried it with the newest version and unfortunately we’re facing an critical error on the backend/frontend screen after implementing the fixes.

    Do you still happen to have a solution for this?

    Kindly
    Anke

    Hi,

    We just upgrade this morning the extension. I don’t get time to reintroduce my fix, but when I access the subscribers interface, the bug seem fixed.
    I see in the MailPoet changelog 3.54.3, that they fix a subscribers bug. I think, and I hope that is our bug. Have you tried to use the extension without any modification?

    @jdrivard I just checked out Mailpoet with updates and it doesn’t seem to work anymore. Have you been able to create a new fix? At this point I’d pay someone to do it.

    @anke16 Were you able to figure this out?

    Effectively, I haven’t watch the good list.
    Finally, I revolve it with an easy way.
    I replaced the removeOrphanedSubscribers() with a static function, like the old one :

    public static function removeOrphanedSubscribers()
    {

    //removeorphanedwpsegmentsubscribers(nothavingamatchingwpuserid),
    //e.g.ifwpusersweredeleteddirectlyfromthedatabase
    global $wpdb;

    $wp_segment = Segment::getWPSegment();

    //$wp_segment->subscribers()
    //->leftOuterJoin($wpdb->users,array(MP_SUBSCRIBERS_TABLE.’.wp_user_id’,’=’,’wu.id’),’wu’)
    //->whereNull(‘wu.id’)
    //->findResultSet()
    //->set(‘wp_user_id’,null)
    //->delete();

    //Pourfaireleménagedubug
    $blogMembersID = get_users(array(‘blog_id’ => get_current_blog_id(), ‘fields’ => array(‘ID’)));
    $inID = “”;
    foreach ($blogMembersID as $id) {
    if ($inID != “”) {
    $inID .= “,”;
    }
    $inID .= $id->ID;
    }

    $subscribers_table = Subscriber::$_table;

    $request = sprintf(‘DELETE FROM %s WHERE wp_user_id is not null AND wp_user_id not in(‘ . $inID . ‘)’, $subscribers_table);

    Subscriber::raw_execute($request);
    }

    Then, in the init of the menu, instead of calling SynchronisezUsers, I call directly the static function :

    public function init()
    {
    $this->checkPremiumKey();

    $this->wp->addAction(
    ‘admin_menu’,
    [
    $this,
    ‘setup’,
    ]
    );

    \MailPoet\Segments\WP::removeOrphanedSubscribers();
    }

    @jdrivard thanks for this. However, I am new at this and this is totally not my specialty, so I’m not sure how to get this to work.

    First step is to replace “Remove Orphaned Subscribers” from Mailpoet/Lib/Segment/WP.php on lines 280-319

    Then I don’t know what to do with the the public function init(). Where does this go and does it replace anything?

    Do I need to do anything with the Insert Subscribers code from the previous thread? Or does this current code take care of everything?

    Thanks for all the help. I do appreciate it.

    The init function is in /lib/config/menu.php file. Just add the line at the end for the function

    public function init()
    {
    .
    .
    .

    \MailPoet\Segments\WP::removeOrphanedSubscribers();
    }

    Thread Starter A.

    (@anke16)

    @jdrivard Thank you so much for your reply and sorry for not getting back to you sooner! I just wasn’t notified or did not seen it.

    We were in contact with MailPoet and asked them if they would be intereseted in a partnership to make the plugin working on Multisites. They’re not and the new version is still not compatible with multisites.

    So what we do now is we will try out your new fix – thank you for sharing it! I will get back to you if it is working or not.

    Sorry again!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Subscribers in multisite – all multitiste wordpress users are subscribers’ is closed to new replies.