Customizing SMF > Portals, Bridges, and Integrations
Should I use Member ID or Name for integration?
Ardenstone:
I recently decided to convert a very small, custom (PHP) site that has its own usernames and passwords to use SMF instead. After reading through the docs I basically include SSI.php on my pages, and override the login_url and logout_url variables appropriately. This all works beautifully. At the moment, I've changed my own custom get_user() function to make a SQL call and find my custom USERID where my custom USERNAME = $user_info['id'] (SMF's Member ID). This also works perfectly.
But then I read a line at http://wiki.simplemachines.org/smf/Integration_hooks#integrate_activate that says, "string representing the member's name (since that is guaranteed to be consistent, member id is not)."
Possibly I'm just misreading this, but should I link to SMF's Member ID or Member Name (presumably $context['user']['name'])? I tend to think ID's are the way to go, but I'm very new at SMF so maybe I'm not understanding the data structure.
Thank you and all the best,
Chris
Ardenstone:
I'm thinking the answer is use the username because that's what the integration hooks seem to expose. :)
Andre N:
Member ID, username or email will all work.
keep in mind that username and email can be changed. AFAIK the member id never will
nend:
Member id is the only value that is not changeable due to it being a auto increment. I would have to say username is probably no the best however usernames are unique and you can lock them where they can't be changed in the settings. So maybe either or, I would personally go with the member id, seems more politically correct to me. ;)
Ardenstone:
Thank you, all! Is the member ID something that's exposed during the integrate_register register (or another hook used during initial account creation)? And, if so, how/where? I could only see username in those. I did my initial integration using the member ID but then didn't see an easy way to pull that. In part because most of the hooks (especially integrate_register) seem to be called before the user is saved in the database so the member ID probably isn't determined yet.
Thank you,
Chris
Navigation
[0] Message Index
[#] Next page
Go to full version