Support » Plugins and Hacks » Bainternet Posts Creation Limits » Undefined variable (with fix)

  • Resolved Austin Passy

    (@austyfrosty)


    You have a undefined variable notice in your plugin at line 150.

    150:
    $rules_BY_id = $this->get_sub_array($options['rules'],'role',$current_user->ID);

    Were $current_user is only getting set if the $user_id is null. That function should get the global removed and set a top the function.

    if ($user_id == null){
    	get_currentuserinfo();
    	$user_id = $current_user->ID;
    	if ($user_id <= 0)
    		return true;
    }

    Also note the uppercase ID as id is deprecated.

    So the function should look like:

    public function limitUser($user_id = null,$type = null,$use_m = true){
    	global $current_user;

    http://wordpress.org/extend/plugins/bainternet-posts-creation-limits/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Bainternet

    (@bainternet)


    How about just replacing $current_user->ID with $user_id since the only real use and declaration $current_user is to set $user_id of and changing the id to uppercase?

    seems much simpler to me.

    thanks.
    will fix soon

    Plugin Author Bainternet

    (@bainternet)


    Fixed.

    Thanks again.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Undefined variable (with fix)’ is closed to new replies.