• Good afternoon,

    I just updated Subscribe2 to 10.22.1, and during testing I ran into an issue.

    When I tried to view the Registered Subscribers at /wp-admin/admin.php?page=s2_tools&tab=registered, I couldn’t see the e-mail addresses like I used to be able to. Instead, it only shows the first letter of the e-mail.

    These error messages get generated when viewing the Registered Subscribers Page:

    PHP Warning: Illegal string offset ‘user_email’ in [URL]\wp-content\plugins\subscribe2\classes\class-s2-list-table.php on line 351
    PHP Warning: Illegal string offset ‘ID’ in [URL]\wp-content\plugins\subscribe2\classes\class-s2-list-table.php on line 352
    PHP Warning: Illegal string offset ‘user_email’ in [URL]\wp-content\plugins\subscribe2\admin\subscribers.php on line 224

    If it helps, this is on a Network install, not a single site.

    Thank you for your time.

Viewing 12 replies - 1 through 12 (of 12 total)
  • @theinich

    I’m not seeing this issue using 10.22.1 with WordPress 4.8.2 and PHP 7.0 branch.

    what version of WordPress and PHP are you using?

    Thread Starter theinich

    (@theinich)

    Hi @mattyrob,

    My PHP version is 5.6.21, and my WordPress version is 4.8.2 as well.

    @theinich

    I’ve tested again on the PHP5.6 branch (using 5.6.31) and I’m still not seeing this happen.

    Have you tried deactivating other plugins and using a core theme? Have you tried re-insatlling Subscribe2 via FTP – warning don’t uninstall from the admin page or you lose all subscriber and settings data.

    Thread Starter theinich

    (@theinich)

    Hi @mattyrob.

    Sorry the delay. I’ve tried deactivating all my plugins, switching themes to a few of the core themes, and I’m still having the same issue. I even tried doing a full uninstall/reinstall (this is a dev site, so no worries about losing subscribers!), and still no luck. The only other thing I can think to offer is when I went to that same page, I checked the console out on Chrome and saw this error (I have no idea if it’s related).

    s2-subscribers.min.js?ver=1.2:1 Uncaught TypeError: Cannot set property ‘onclick’ of null
    at s2_delete_check (s2-subscribers.min.js?ver=1.2:1)
    s2_delete_check @ s2-subscribers.min.js?ver=1.2:1

    @theinich

    The only way I can reproduce that error is if there are no Registered Subscribers / Users available to the plugin.

    Are you running as a single site or multisite?

    Are there users available on the site in the Users menu?

    Thread Starter theinich

    (@theinich)

    @mattyrob

    I’m running on a multisite. The site in question that is showing the error has users available although I have not actively registered any subscribers.

    @theinich

    The JavaScript error led me down the right path on this. The JavaScript tries to bind to a form element and the error is telling us that this element is not available.

    The error can only trigger if there are no Bulk Actions available on the page and that only happens in WordPress if there is no content in the table which can be processed through a Bulk Action.

    I therefore think it may be something to do with this being a Multisite install that has no Registered Users assigned to that particular site. Perhaps if you add a User and check again.

    Thread Starter theinich

    (@theinich)

    @mattyrob

    Alrighty, so after trying things out I am now even more confused than I was before. Long story short is after trying out your suggestion, I think you’re right in that something is going on with MultiSite. I apologize, but here’s a full recap of what I tried and the results to see if this makes sense:

    Instance: MultiSite WordPress install with a few sites and 4 users. For server configuration reasons, all 4 users are also subscribers to the Main Site.
    In particular, I’m looking at one site on this multisite where I’ve activated Subscribe2. 2 users on this site, both administrators.

    When I first activated the plugin, I had no public subscribers listed, and 2 registered subscribers, which seem to be my 2 users on the testsite (but because of the bug, really the only thing I see is the first letter of the e-mail).

    If I want to add a user through the public subscribers, I cannot do it if they are user on the MultiSite: it tells me they are already registered subscribers (even though they are not list of registered subscribers). This I noticed is in my previous version of Subscribe2 as well.

    I can add a user to the public subscribers by entering a random e-mail like [email protected]. This doesn’t seem to change anything about the Registered Subscribers bug.

    I tried clicking “Add Registered User”. This sent me to the WordPress “Add User”. I add an existing user, and then check the Registered Subscribers list again. I have a new registered subscriber, but it is still only showing the first letter of the e-mail.

    I’m not sure what else to try. I’m sorry!

    @theinich

    Thanks for the update.

    I only have 2 ideas left.

    First is this might be something to do with adding users to blogs in Multisite.

    Second is that it is a weird Multisite specific bug. I’ll try to set up a localhost multisite and test when I get some spare time.

    @theinich

    I’ve created a test set up and reproduced your issue. I think it’s a big in Subscribe2. I’ll see if I can create a fix. Will post again with more once I have it.

    @theinich

    The bug is in the class-s2-core.php file in the get_all_registered() function. The top half has an if block that check for ‘s2mu’ being true – that runs if multisite is in use. The content of the if block needs changing to the following:

    if ( 'ID' === $return ) {
    	if ( '' === $this->all_registered_id ) {
    		$this->all_registered_id = $wpdb->get_col( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key='{$wpdb->prefix}capabilities'" );
    	}
    	return $this->all_registered_id;
    } elseif ( 'emailid' === $return ) {
    	if ( '' === $this->all_registered_email_id ) {
    		$this->all_registered_email_id = $wpdb->get_results( "SELECT a.user_email, a.ID FROM $wpdb->users AS a INNER JOIN $wpdb->usermeta AS b on a.ID = b.user_id WHERE b.meta_key ='{$wpdb->prefix}capabilities'", ARRAY_A );
    	}
    	return $this->all_registered_email_id;
    } else {
    	if ( '' === $this->all_registered_email ) {
    		$this->all_registered_email = $wpdb->get_col( "SELECT a.user_email FROM $wpdb->users AS a INNER JOIN $wpdb->usermeta AS b ON a.ID = b.user_id WHERE b.meta_key='{$wpdb->prefix}capabilities'" );
    	}
    	return $this->all_registered_email;
    }
    
    Thread Starter theinich

    (@theinich)

    @mattyrob

    Huzzah! We have success.

    Replacing that code with this code fixed the e-mail display bug. Thank you!

    • This reply was modified 7 years, 1 month ago by theinich.
Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Issue Viewing Registered Subscribers’ is closed to new replies.