Support » Plugins and Hacks » SendGrid » Php notice after wp 4.6.1 update

  • Resolved Erol Abzait

    (@erolabzait)


    Hello,

    I get a php notice:

    Notice: Undefined variable: plugin_directory in ../content/plugins/sendgrid-email-delivery-simplified/lib/class-sendgrid-settings.php on line 37

    I use wordpress skeleton and Debug Bar.

    Thanks in advance!

Viewing 8 replies - 1 through 8 (of 8 total)
  • fkraus

    (@fkraus)


    Hi there,

    Same warning over here.

    In my case I was using WP 4.6.1 with SendGrid plugin v1.9.5 and it worked just fine.

    I’ve just updated the SendGrid plugin to v1.10 and teh warning appeared.

    Thanks

    Same issue.

    cartpauj

    (@cartpauj)


    Notice: Undefined variable: plugin_directory in /var/www/site.com/wp-content/plugins/sendgrid-email-delivery-simplified/lib/class-sendgrid-settings.php on line 37

    To fix, open the file mentioned in the error and make the following 3 changes.

    1. public static $plugin_directory; //New Line
    2. self::$plugin_directory = $plugin_directory; //New Line
    3. self::$plugin_directory //Modify line #37

    So the beginning of the file would then look like this:

    
    <?php
    
    require_once plugin_dir_path( __FILE__ ) . 'sendgrid/class-sendgrid-smtp.php';
    require_once plugin_dir_path( __FILE__ ) . 'class-sendgrid-tools.php';
    require_once plugin_dir_path( __FILE__ ) . 'class-sendgrid-nlvx.php';
    require_once plugin_dir_path( __FILE__ ) . 'class-sendgrid-mc-optin.php';
    require_once plugin_dir_path( __FILE__ ) . 'class-sendgrid-nlvx-widget.php';
    
    class Sendgrid_Settings {
      const DEFAULT_SIGNUP_EMAIL_SUBJECT = 'Confirm your subscription to ';
      const DEFAULT_SIGNUP_EMAIL_CONTENT = '<p>Greetings!</p>
    
    <p>Please click <a href=&quot;%confirmation_link%&quot;>here</a> in order to subscribe to our newsletter!</p>
    
    <p>Thank you,</p>
    <p>';
      const DEFAULT_SIGNUP_EMAIL_CONTENT_TEXT = 'Greetings!
    
    Please open %confirmation_link% in order to subscribe to our newsletter!
    
    Thank you,
    ';
      
    public static $plugin_directory;
    
      /**
       * Settings class constructor
       *
       * @param  string   $plugin_directory   name of the plugin directory
       *
       * @return void
       */
      public function __construct( $plugin_directory )
      {
        self::$plugin_directory = $plugin_directory;
        add_action( 'init', array( __CLASS__, 'set_up_menu' ) );
      }
    
      /**
       * Method that is called to set up the settings menu
       *
       * @return void
       */
      public static function set_up_menu()
      {
        if ( ! is_multisite() and current_user_can('manage_options') ) {
          // Add SendGrid settings page in the menu
          add_action( 'admin_menu', array( __CLASS__, 'add_settings_menu' ) );
          // Add SendGrid settings page in the plugin list
          add_filter( 'plugin_action_links_' . self::$plugin_directory, array( __CLASS__, 'add_settings_link' ) );
          // Add SendGrid Help contextual menu in the settings page
          add_filter( 'contextual_help', array( __CLASS__, 'show_contextual_help' ), 10, 3 );
          // Add SendGrid javascripts in header
          add_action( 'admin_enqueue_scripts', array( __CLASS__, 'add_headers' ) );
        } elseif ( is_multisite() and is_super_admin() ) {
          // Add SendGrid settings page in the network admin menu
          add_action( 'network_admin_menu', array( __CLASS__, 'add_network_settings_menu' ) );
          // Add SendGrid Help contextual menu in the settings page
          add_filter( 'contextual_help', array( __CLASS__, 'show_contextual_help' ), 10, 3 );
          // Add SendGrid javascripts in header
          add_action( 'admin_enqueue_scripts', array( __CLASS__, 'add_headers' ) );
        }
      }
    
    • This reply was modified 4 months ago by  cartpauj. Reason: Can't bold inside a code block duh
    SooBahkDo

    (@soobahkdo)


    Same here

    Plugin Author SendGrid INC

    (@team-rs)


    Hello,

    Thanks for noticing us. We will release the fix for this issue in one of the next updates and update this thread.

    Have a nice day,
    SendGrid

    “Thanks for notice-ing us.” [>_>]

    Plugin Author SendGrid INC

    (@team-rs)


    Hi guys,

    Please update to the 1.10.1 version. It should work just fine now.
    @khromov – we see what you did there. We hope you enjoy using SendGrid :-).

    Thank you,
    SendGrid

    fkraus

    (@fkraus)


    It’s perfect! Thanks for that!

    • This reply was modified 4 months ago by  fkraus.
Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.