SOLVED: SimpleMachines Forum: extracing the memberName from the session
I'm helping out a friend who wants to use a SimpleMachinesForum installation 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:
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.
Edit: Solved!
Required code:
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.
Edit: Solved!
Required code:
include ('path/to/smf/ssi.php');
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'];
