News:

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

Main Menu

Need a list of SSI values

Started by 0PS, August 18, 2014, 05:21:48 PM

Previous topic - Next topic

0PS

I'm sure I found a page with a list of possible values a couple of days ago but I can't seem to find it anymore. Hoping someone can point me in the right direction.

Looking for a list of possible values in place of "name" in the following: $context['user']['name'];

Also if there's a list of all the other available variables for pulling data from SSI, I'd appreciate it.

Arantor

There's many depending on situation and the current running context.

What exactly are you trying to do?

0PS

Working on an advanced custom website and will need various data pulled from the forum. I don't know everything that I need yet as it's early development and will probably vary depending on what's available, so a list of what's possible is preferable.

Arantor

Except it's a list whose content is not consistent depending on the current situation, and that's just $context['user'], let alone all the (many) other variables made available during SSI setup. You could of course simply print_r() on $context, $user_info, $settings, $modSettings and possibly $options, but there's simply so much in there that it isn't practical to list everything.

In your situation it might just be simpler to ask as and when you find you need something.

0PS

Thanks, print_r is the solution then I guess. Can already see some possibilities.

Only one I need right now and can't find is the date/time the user last logged in.

Arantor

That depends on what you're calling 'last logged in'.

0PS

The last time the current user logged in, previous to the time they are currently logged in at... not sure how I can clarify further than that.

Arantor

That's just it. The entire basis of how HTTP and sessions even works is that there is potentially only one single 'login' with the session maintained permanently.

The last time I "logged in" here was several days ago, for example. It is quite possible for someone to only ever 'log in once', after that it's simply about making some sense of 'the last time we saw that user'.

0PS

You didn't seem to know so I went back to digging around in the code.

$user_info['last_login']; is what I was looking for. Funny how it's named the same as what I was asking for, strange that eh?

I understand the value is not exactly as I clarfied to, but then I was struggling to clarify upon something I thought obvious. This value will work fine however.

Arantor

Oh, I knew it was there. I'm still not sure it's the value you think it is, but if it works for you, great.

Advertisement: