illegal string offset

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
User avatar
wsiconcrete
Posts: 18
Joined: 2015-04-27 16:39
Location: SC, USA

illegal string offset

Post by wsiconcrete » 2016-04-06 04:35

Trying to set filters for users while maintaining visibility of all information for admins. Maybe I am combining things that I shouldn't, but from the help I came up with the following to apply a filter so long as the logged in user was not a member of the 'Admins' group (added to the 'tablename_init.php' file in the /hooks/ folder:

Code: Select all

	function moistures_init(&$options, $memberInfo, &$args){
		/*
			Added memberInfo[group] to filter out admins
		*/
		if(!$_POST['FilterField'][1] && !$_GET['FilterField'][1] && !$memberInfo['group']['Admins']){
		...rest of code for filters
While it seems to work, when inspecting the code in the browser console I see the following error:

Code: Select all

:  Illegal string offset 'Admins' in .../hooks/tanker_monitor.php on line 32
Should I be worried about this error? It doesn't seem to affect functionality but on some mobile browsers I see portions of the error displayed on the page itself.

User avatar
a.gneady
Site Admin
Posts: 1354
Joined: 2012-09-27 14:46
Contact:

Re: illegal string offset

Post by a.gneady » 2016-04-10 08:52

Hmm .. try this code instead:

Code: Select all

if(!isset($_REQUEST['FilterField'][1]) && !$memberInfo['group'] == 'Admins'){
:idea: AppGini plugins to add more power to your apps:

Post Reply