Support » Plugin: Subscribe2 - Form, Email Subscribers & Newsletters » get_currentuserinfo is deprecated

  • Thanks for the free plugin! 🙂

    Testing with the latest WP version on a PHP 7 setup, I’m getting this error:

    PHP Notice: get_currentuserinfo is <strong>deprecated</strong> since version 4.5.0! Use wp_get_current_user() instead. in /wp-includes/functions.php

    It can be traced to this plugin in the two files:

    subscribe2/admin/your_subscriptions.php:
       10  	$user_ID = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_email = %s", $_GET['email']));
       11  } else {
       12: 	get_currentuserinfo();
       13  }
       14  
       ..
      186  	global $blog_id, $current_user, $s2class_multisite;
      187  	$s2blog_id = $blog_id;
      188: 	get_currentuserinfo();
      189  	$blogs = $s2class_multisite->get_mu_blog_list();
      190  

    and

    subscribe2/classes/class-s2-frontend.php:
      122  
      123  		global $user_ID;
      124: 		get_currentuserinfo();
      125  		if ( $user_ID ) {
      126  			$this->s2form = $this->profile;

    I want to know if the plugin is PHP 7 compatible and if and when an update will be available which fixes the above.

Viewing 4 replies - 1 through 4 (of 4 total)
  • @sgrx

    That error is because this code uses a function that WordPress has marked as deprecated – it should still work fine.

    The curent committers to the code haven’t updated the code for a year now so I wouldn’t expect an update anytime soon.

    I continue to maintain an extended paid version of this plugin.

    @mattyrob

    OK.

    Yes, it might just work fine for some time before it needs the change.

    I guess it would be safe to manually replace get_currentinfo with wp_get_current_user()?

    @sgrx

    If you are comfortable editing code then that should work fine. Bear in mind that the new function returns the result so it needs the values assigned to a variable like this:

    $current_user = wp_get_current_user();

    Hi,
    Can you please tell me where put this code ?

    Thank you

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘get_currentuserinfo is deprecated’ is closed to new replies.