Hello,
New to SMF, but I'm a php/mySQL hobbyist developer. I'm helping out a friend who wants to use SMF as a roleplaying game tool, and wants to create a character table for each user in mySQL that is tied to a user in the forums.
Example:
smf_members
| ID_MEMBER | memberName | ...
| 1 | patch |
| 2 | Evan |
character_patch
| OWNER_ID | CharName |
| 1 | Ghost |
character_Evan
| OWNER_ID | CharName |
| 2 | Niobe |
My first question is hopefully relatively simple: How can I retrieve the memberName of the current session? I can read the session_id(), but I seem to be running into trouble gathering the memberName, which will be used to create the new table...
Any help you guys can provide would be appreciated.
Patch
Bumping... I'm hoping it's been more than 24 hours.
global $context, $user_info;
echo 'USER ID: ' . $context['user']['id'];
echo '<br />Username: ' . $context['user']['username'];
echo '<br />Display name: ' . $context['user']['name'];
echo '<br /> Email: ' . $context['user']['email'];
echo '<br /> IP Address: ' . $user_info['ip'];
echo '<br /> Posts: ' . $user_info['posts'];
You'll need to include SMF's SSI.php file, if you want Cyclon Boy's code to work in a page outside of SMF
Thank you both so much!!!
Cyclon Boy for the code, and H for the crucial include. You guys rock.
Glad that did what you wanted :D