Detect members
#11
and to avoid parse errors, you (ghazal) should use elseif not else if, unless you know what you're doing
All my plugins are available for free at MyBB Extend and on my GitHub. MyBB-Plugins.com has been closed and none of my plugins are officially maintained or supported.
Reply
#12
I've seen that else if cause havoc in some places...


(2009-09-08, 02:39 PM)AMEAR Wrote: Where is this $mybb class? where Defined it?

The best method (or easiest) is to do:

define("IN_MYBB", 1);
require_once './global.php';

if($mybb->user['uid'])
{
     // Is a User.
}

Then you're good to go. You can use $mybb, $db, $lang etc. anywhere. For less specifics, you can just include ./inc/init.php.
Reply
#13
dear Tomm M!
$mybb->user['uid'] how can specify uid? how set uid?
Reply
#14
$mybb->user['uid'] contains the uid of the current user. 'uid' is a field in the users table. You don't set it because that's done when someone registers.
All my plugins are available for free at MyBB Extend and on my GitHub. MyBB-Plugins.com has been closed and none of my plugins are officially maintained or supported.
Reply
#15
...or logs in...

Shy
Reply
#16
No, but I mean the 'uid' field is filled with an id when someone registers.
The uid is always the same.
You misunderstood me Toungue
All my plugins are available for free at MyBB Extend and on my GitHub. MyBB-Plugins.com has been closed and none of my plugins are officially maintained or supported.
Reply
#17
...meh - I meant it's set from 0 to 8582 when you log in here... Toungue
Reply
#18
(2009-09-11, 07:37 AM)Tomm M Wrote: I've seen that else if cause havoc in some places...


(2009-09-08, 02:39 PM)AMEAR Wrote: Where is this $mybb class? where Defined it?

The best method (or easiest) is to do:

define("IN_MYBB", 1);
require_once './global.php';

if($mybb->user['uid'])
{
     // Is a User.
}

Then you're good to go. You can use $mybb, $db, $lang etc. anywhere. For less specifics, you can just include ./inc/init.php.
Its ok thx
but... how can set it, when user loging in?
excuse me i dont know more things about mybb system
Reply
#19
As I said, the 'uid' field is created on sign up, it never changes. You don't set it, it is a unique identification number
All my plugins are available for free at MyBB Extend and on my GitHub. MyBB-Plugins.com has been closed and none of my plugins are officially maintained or supported.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)