MyBB Community Forums

Full Version: UID for guests
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
We'll I need some specific functionality for my site. Basically I need to generate a random UID for guests and display it in the postbit. I know this can be done with the IP somehow.

currently Guests are displayed like so.

Guest
Unregistered

What I would like is to change the default name of Guest, and generate a UID like so

Random Person
685243

I have a thread starter plugin, but all guest have a default UID of 0, so it wont work as every guest will be recognized as "threadstarter"

I know i can use a template conditional and make it work for user, but am having a problem with doing so for guests
Would this unique ID have to stay the same for the post after posting? If so, you'd need to store it in the database.
http://community.mybb.com/thread-153979-...pid1104220 - but as Euan says, you'd need to store the value for thread starter at least to compare it with other.

Or you could just get the IP address of the first post and compare other IPs to that, guest UID is not needed (unless you want it for anything else besides thread starter plugin).
// in a showthread_start hook
if($thread['uid'] == 0)
{
    //query the first post IP, store it in a global var and then compare to it in a postbit hook
}
(2015-03-04, 07:52 AM)Euan T Wrote: [ -> ]Would this unique ID have to stay the same for the post after posting? If so, you'd need to store it in the database.

YES IT WOULD

(2015-03-04, 09:08 AM)Destroy666 Wrote: [ -> ]http://community.mybb.com/thread-153979-...pid1104220 - but as Euan says, you'd need to store the value for thread starter at least to compare it with other.

Or you could just get the IP address of the first post and compare other IPs to that,  guest UID is not needed (unless you want it for anything else besides thread starter plugin).

// in a showthread_start hook
if($thread['uid'] == 0)
{
    //query the first post IP, store it in a global var and then compare to it in a postbit hook
}

UID must remain constant across multiple posts for guest. Basically i need guest to be able to post any be distinguishable as the OP if they post again later

(2015-03-04, 01:25 PM)moobooshtz Wrote: [ -> ]
(2015-03-04, 07:52 AM)Euan T Wrote: [ -> ]Would this unique ID have to stay the same for the post after posting? If so, you'd need to store it in the database.

YES IT WOULD

I tried that bit of code before doesn't work


(2015-03-04, 09:08 AM)Destroy666 Wrote: [ -> ]http://community.mybb.com/thread-153979-...pid1104220 - but as Euan says, you'd need to store the value for thread starter at least to compare it with other.

Or you could just get the IP address of the first post and compare other IPs to that,  guest UID is not needed (unless you want it for anything else besides thread starter plugin).


// in a showthread_start hook
if($thread['uid'] == 0)
{
    //query the first post IP, store it in a global var and then compare to it in a postbit hook
}

UID must remain constant across multiple posts for guest. Basically i need guest to be able to post any be distinguishable as the OP if they post again later