National Flags

New Warning after update - National Flags

New Warning after update

by durangod » Tue Jul 02, 2024 12:17 am

Hi, after i updated my phpbb to 3.3.12 i am getting this warning, yes i know its just a warning but i would like to fix it.
PHP Warning: Undefined array key "is_registered" in ext/rmcgirr83/nationalflags/event/listener.php on line 197
That code is

Code: Select all

	public function page_header_after($event)
	{
		if (!$this->user->data['is_registered'] || !$this->auth->acl_get('u_chgprofileinfo'))
		{
			return;
		}

		$page_name = substr($this->user->page['page_name'], 0, strpos($this->user->page['page_name'], '.'));

		if ($page_name == 'ucp')
		{
			return;
		}
		if ($this->config['flags_display_msg'])
		{
			$this->template->assign_vars(array(
				'S_FLAG_MESSAGE'	=> (empty($this->user->data['user_flag'])) ? true : false,
				'L_FLAG_PROFILE'	=> $this->language->lang('USER_NEEDS_FLAG', '<a href="' . append_sid("{$this->root_path}ucp.$this->php_ext", 'i=profile') . '">', '</a>'),
			));
		}
	}
and line 197 is

Code: Select all

if (!$this->user->data['is_registered'] || !$this->auth->acl_get('u_chgprofileinfo'))
Im thinking maybe we should check for empty

something like

Code: Select all

	 if(empty($this->user->data['is_registered']) || !$this->user->data['is_registered'] || !$this->auth->acl_get('u_chgprofileinfo'))
		{
			return;
		}
	
Seems to work.

Your thoughts :) thanks
And my apology i just saw there was another topic for this.... sorry i didnt look first... :( but that other one has not been answered yet :)
Username is short for durango dave
User avatar
durangod
Registered User
Posts: 817
Joined: Tue Nov 03, 2009 1:26 pm
Location: USA East Texas
Name: Dave