News:

Want to get involved in developing SMF? Why not lend a hand on our GitHub!

Main Menu

Retrieving membername from SMF session

Started by patchwolf, April 14, 2009, 12:15:46 AM

Previous topic - Next topic

patchwolf

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

patchwolf

Bumping... I'm hoping it's been more than 24 hours.

Informatics

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 can catch me @ Forum Informatika a.k.a Indonesian Informatics Online Community @ http://if.web.id




Mods:
1. LinkTree v.1.1.0 [Topic  || Download]
2. Header Rotator v.1.1.0 for 1.1.x | v.2.1 for 2.0 [Topic || Download]

H

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
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

patchwolf

Thank you both so much!!!

Cyclon Boy for the code, and H for the crucial include.  You guys rock.

H

-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

Advertisement: