FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Plugins and Code Hacks » Help Needed - fud_user_reg class
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Help Needed - fud_user_reg class [message #165041] Tue, 19 April 2011 15:27 Go to next message
Dayo is currently offline  Dayo   Bahrain
Messages: 101
Registered: April 2011
Karma: 0
Senior Member
Almost got my user integration complete but stumbling somewhere.

I am trying to use existing functions and to log the user in when they log into joomla, I have done the following (


if (!class_exists('fud_user_reg')) {
	fud_use('users_reg.inc');
}
$fudUser = new fud_user_reg;
//code to get get $fudforum_id and $cur_ses_id
$fudUser->user_login($fudforum_id, $cur_ses_id, true);


But I am getting the following error:
Call to undefined method fud_user_reg::user_login()


Yet I can see that the function exists in class fud_user which fud_user_reg extends.

Any ideas what's up?

As said, I can create a local copy of the function but better to use what is there in case db details change in future.

Thanks
Re: Help Needed - fud_user_reg class [message #165042 is a reply to message #165041] Tue, 19 April 2011 15:58 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
user_login() is in users_reg.inc, but it's not part of a class.
Re: Help Needed - fud_user_reg class [message #165044 is a reply to message #165042] Tue, 19 April 2011 16:04 Go to previous messageGo to next message
Dayo is currently offline  Dayo   Bahrain
Messages: 101
Registered: April 2011
Karma: 0
Senior Member
I see. Thanks
Re: Help Needed - fud_user_reg class [message #165045 is a reply to message #165044] Tue, 19 April 2011 16:19 Go to previous messageGo to next message
Dayo is currently offline  Dayo   Bahrain
Messages: 101
Registered: April 2011
Karma: 0
Senior Member
OK. Got over that one but although not crashing, no log in either.

Here's the code
// get $fudforum_id. Confirmed to be valid
$cur_ses_id = get_cur_ses_id($fudforum_id);
user_login($fudforum_id, $cur_ses_id, true);
 
function get_cur_ses_id($id) {
	$fudSesId = $_COOKIE[$GLOBALS['COOKIE_NAME']] or 0;
	if (empty($fudSesId)) {
		$s = db_saq('SELECT ses_id, sys_id FROM '. $GLOBALS['DBHOST_TBL_PREFIX'] .'ses WHERE user_id = ' . $id);
		if (!empty($s)) {
			$fudSesId = $s[0];
		} else {
			$fudSesId = 0;
		}
	}
	return $fudSesId;
}


Any ideas?

Cheers.

[Updated on: Tue, 19 April 2011 16:20]

Report message to a moderator

Re: Help Needed - fud_user_reg class [message #165046 is a reply to message #165045] Tue, 19 April 2011 16:25 Go to previous messageGo to next message
Dayo is currently offline  Dayo   Bahrain
Messages: 101
Registered: April 2011
Karma: 0
Senior Member
Sorry. Looks like that's working.

Caching seems to be an issue.
Re: Help Needed - fud_user_reg class [message #165047 is a reply to message #165046] Tue, 19 April 2011 16:55 Go to previous message
Dayo is currently offline  Dayo   Bahrain
Messages: 101
Registered: April 2011
Karma: 0
Senior Member
Can't get the login working consistently unless I manually delete the session cookie and even then it only shows the user to be logged in after moving pages.

Need to figure out why. I'll make that a job for later.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Fudla! Plugin Core Code Changes
Next Topic: Function to send emails?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 09:54:52 GMT 2024

Total time taken to generate the page: 0.02475 seconds