From: Charles C. <ch...@ru...> - 2004-11-18 02:26:54
|
On Thu, November 18, 2004 8:35, Charles Corrigan said: > Reini Urban wrote: >> > Looking at the code in WikiGroup and in WikiUserNew, I think that >> > the user level should be tested before accessing the prepare >> > function. Something like >> > >> > if $user->_level >= WIKIAUTH_USER { >> > $this->_is_member = $user->prepare($DBAuthParams['is_member'], >> > array('userid','groupname')); >> > $this->_group_members = >> > $user->prepare($DBAuthParams['group_members'],'groupname'); >> > $this->_user_groups = >> > $user->prepare($DBAuthParams['user_groups'],'userid'); >> > $this->dbh = $user->_auth_dbi; >> > } else { >> > $this->_is_member = false; >> > // I don't yet understand enough to do the rest of the else path >> > } >> > >> > I hope that this helps... >> >> Nope. This is not the problem. >> ->prepare is done on first user initialization which is also needed >> for yet unauthorized users, just to get the group or prefs settings >> e.g. >> >> The authlevel is raised later, after trying several methods. > > I put a debug line in just before the call to prepare > > echo get_class($user), " name:", $user->username, " level:", > $user->_level; > > and in the output, I got > > _anonuser name: level:0 > Fatal error: Call to undefined function: prepare() in > /home/runega2/public_html/whitewall/lib/WikiGroup.php on line 627 > > This output appears to be reasonable as, from looking at the lines of code > immediately before, only if there is no existing user object is an empty > _PassUser object created in $user. If there is an exiting user object > then > its class does not have to be _PassUser and prepare is only defined for > _PassUser. I will spend some more time looking at this to see if I can > work > out how to patch OK, in WikiGroup.php, I just added if (isa($user,"_PassUser)) { before the section that included the calls to prepare (and obviously a closing } too). It all worked for me. I'm at work so no access to tools to package this up as a diff regards, Charles |