Advertisement:

Getting User ID

Aloittaja velkymx, marraskuu 21, 2007, 01:19:47 AP

« edellinen - seuraava »

velkymx

I want to integrate the SMF login and use the user id for other areas of my site.

For example: a forum member could post a want ad

What is the session variable I need to call do get user id???

codenaught

Well I don't think the ID is stored in any $_SESSION variable. If you load SSI.php you can use SMF's variables, of which one of them is $context['user']['id'], which returns the ID of the current member.

There is an ssi_login() function too that can print out a login box on your site.

http://docs.simplemachines.org/index.php?topic=400.0
Dev Consultant
Former SMF Doc Coordinator

velkymx

How do I include the SSI? Just include it??

codenaught

As stated in that document:

LainaaPHP Setup
Now that we have established you have a compatible web page setup, we need to add a line of code to every page where you wish to add any Forum information and statistics on your website. Pages with *.shtml extensions do not require this set up and can skip to the next section! To use SSI.php in your webpage, add at the very top of your page before the <html> tag on line 1:

<?php require("/path/to/forum/SSI.php"); ?>

This may be slightly different on your Forum installation depending on the location of your SMF boards. If you are unsure, you can run ssi_examples.php or ssi_examples.shtml from your own Forum directory on your website, which will give the correct code for your personal requirements.
So basically you would want to require it at the top of the file.
Dev Consultant
Former SMF Doc Coordinator

velkymx


Advertisement: