News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Questions/Comments on "A guide to the SMF integration hooks"

Started by Orstio, May 26, 2007, 05:19:48 PM

Previous topic - Next topic

Vik_R

The integration is going very well.  People can register, login, and logout from my main site, and they are automatically registered/logged in/logged out for my SMF forum. :)

I'm getting started now on using the SMF integration hooks. The first one I'm working on is integrate_login.  I have the hook installed, and SMF is calling my PHP routine ("login_to_ci") on login.  So far so good!

integrate_login passes parameters to my PHP routine, including $username, $hash_password, and $cookieTime.

I get the $username and $cookieTime, but the $hash_password is empty.

But that's easy to fix - if I declare

   global $scripturl, $user_info, $user_settings;

in my routine, I can get the hash password from $user_settings.

The question is - what is the correct way for me to use a $hash_password - one that's been encrypted? Am I supposed to decrypt it? (Is that even possible?)

Thanks in advance for any info!

Vik_R

To provide a bit more info, I'm wondering how I can log a user onto my CI app (or register them if they've just registered on my SMF board), if I only have their password in an encrypted format?

Orstio

Great to see that you're making progress! :)

QuoteI get the $username and $cookieTime, but the $hash_password is empty.

Are you using ssi_login?  If so, you will probably want to use $_REQUEST['passwrd'] in your login_to_ci.

Quotein my routine, I can get the hash password from $user_settings.

The question is - what is the correct way for me to use a $hash_password - one that's been encrypted? Am I supposed to decrypt it? (Is that even possible?)

You can't decrypt it.  Encryption is a one-way street.

Something you can count on is this:  The integrate_login hook is called AFTER SMF has already validated the user.  This means that the person has entered correct information as far as SMF is concerned.  So, you can just read the data from your CMS and log the user into that automatically.

Vik_R

QuoteSomething you can count on is this:  The integrate_login hook is called AFTER SMF has already validated the user.  This means that the person has entered correct information as far as SMF is concerned.  So, you can just read the data from your CMS and log the user into that automatically.

That's great advice. Thanks, Orstio!

Vik_R

I've got most of my site integration with SMF done, thanks in large part to you, Orstio! I really appreciate your advice.

I have a question about the "integrate_register" hook.  If email validation is required to complete registration for SMF, does SMF call the "integrate_register" hook before, or after, email validation has taken place?  If it takes place before, is there a way my app can find out, if email validation has been received by SMF? (Perhaps by a MySQL query?)

Thanks in advance for any info.



Orstio

QuoteI have a question about the "integrate_register" hook.  If email validation is required to complete registration for SMF, does SMF call the "integrate_register" hook before, or after, email validation has taken place?

Before.

QuoteIf it takes place before, is there a way my app can find out, if email validation has been received by SMF? (Perhaps by a MySQL query?)

SMF can tell your app through the integrate_activate hook.


mdp

Hello,

I have a custom game that I want to integrate registered user with SMF + TP.  Basically, what the code will need to do is check if SMF user is logged in and if it is true then it will send user's result to the database.  That's pretty much it!  Nothing too fancy than that.  What do you recommend?  Will SSI works or what?

I had somebody suggesting using global but I am not sure about that?  And I wouldn't be familiar with SMF so I am not sure it is something I want to tweak with unless you can help?

Thanks!

xXBenXx

I really don't understand how to use these hooks. :( How do I start using them?

Quote
Typically, when creating a bridge, I have SMF "wrapped" within the context of a CMS, so the startup is done in the CMS, as a part of the component/module that displays the forum.
Eh?

badams

That's something that I've been trying to figure out for the last couple of weeks.... :(

I've read about everything there is to read, but I'm still no further than I was when I started out..... :'(

I need to integrate SMF/TP with TNG (http://www.lythgoes.net/genealogy/software.php) but have no clue as to where to begin....or how to use the integration hooks.


EDIT:  OK....I want the user to register, sign on, and logout in SMF and automatically be signed into TNG...I went back over this thread and the integration hooks.  Let's see if this is sinking in.....

I need to create a file to define the integration hooks....is this done in the SMF or TNG directory?  Then I need to require/include the file at the beginning of SMF's index.php file??

Is this correct??




Orstio

QuoteI need to create a file to define the integration hooks....is this done in the SMF or TNG directory?

The location of the file doesn't matter, as long as it is within the open_basedir restrictions of your SMF index.php.

QuoteThen I need to require/include the file at the beginning of SMF's index.php file??

That way will work.  It's not the only way, but it is a viable method.

badams


I have SMF/TP in my root directory and TNG in a subdirectory.....Is there a better way to do this?

I was reading your "How to integrate Registration" thread.....Is this something that I have to do first?  Or can this be done with one of the integration hooks??

Thanks for your help.......

xXBenXx

Ok... so let me get this straight, to use these hooks I have to include the index.php that has these functions defined. But if I include the index.php won't that just load up the forum.

badams


You create a file to define the integration hooks and then you include the file in index.php....

xXBenXx

I thought the whole point of these functions is to use SMF while not on the forum . For example I want to check if a user enters the correct login details but i don't want to log them into the forum.

Orstio

Quote from: badams on January 16, 2008, 08:04:58 PM

I have SMF/TP in my root directory and TNG in a subdirectory.....Is there a better way to do this?

I was reading your "How to integrate Registration" thread.....Is this something that I have to do first?  Or can this be done with one of the integration hooks??

Thanks for your help.......


The method you chose is fine.

The registration howto topic is more of a method of modifying another registration system to also register a user in SMF.  That is a completely different method of integration than using the integration hooks.

Orstio

Quote from: xXBenXx on January 16, 2008, 08:22:35 PM
I thought the whole point of these functions is to use SMF while not on the forum . For example I want to check if a user enters the correct login details but i don't want to log them into the forum.

You can use SSI to do that.

badams


Ahh...so since I'm only going one way....SMF/TP to TNG....I don't need to use the other method since the registration is being handled by SMF....right?

In TNG's registration, it requires username, real name, password, and email address and performs a validation prior to writing it to the TNG database.....real name is not a requirement on the SMF side....do I need to add that to the SMF registration??


Orstio

QuoteAhh...so since I'm only going one way....SMF/TP to TNG....I don't need to use the other method since the registration is being handled by SMF....right?

Correct.

QuoteIn TNG's registration, it requires username, real name, password, and email address and performs a validation prior to writing it to the TNG database.....real name is not a requirement on the SMF side....do I need to add that to the SMF registration??

You can, or you can just use the username for both.  That's entirely up to you.

badams


Since I'm creating the file to define the integration hooks in the SMF directory (root) and including the file in the SMF index.php.....Is there something I need to do on the TNG side??

Advertisement: