TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,004
  • Total Topics: 21,330
  • Online today: 141
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 123
  • Total: 123

Common SMF/TP PHP Variabls

Started by Mahtan, March 16, 2006, 08:06:15 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Mahtan

Hey guys -

Within my PHP article, I want to check the currently logged in user's membergroup (I'm writing a page where I want to give some membergroups different abilities & show them different things) - does anybody know the variable this is stored under & the format?

Also, I want to query my MySQL databases.  Is there any way to use the existing mysql session, to avoid executing mysql_open , mysql_close , etc?  No biggie if there's not, just thought I'd check for the most efficient method :)

Thanks in advance,

Mahtan

bloc

You can query the database at any time, just call mysql_query or db_query, no opening of the databse needed. For info of the member try $user_info. It has a array of users membergroups in ID's, so you need to query the names based upon those.

feeble

#2
if you want.
a quick way to block guests from seeing the article is to use

if ($context['user']['is_guest'])
echo $txt['welcome_guest'];
else
ssi_welcome();


ill update this soon, so you can pick what membergroups can only see this.

feeble

just found this out

change X to your desired membergroup

Quoteif ( in_array(X, $GLOBALS['user_info']['groups']) )
{
   echo "<div align='center'>ONLY MEMBERS CAN SEE THIS</div>";
}
else{
   echo "<div align='center'>You do not have permission to see this</div>";
}

This website is proudly hosted on Crocweb Cloud Website Hosting.