MyBB Community Forums

Full Version: Get UID For MyCode?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I know there's a certain way I can set it so I grab a users UID with mycode, I want it in the replacement section as part of the URL.
Anybody know about this, I heard you need a plugin and I could really use this!
Grabbing user's uid as in the user which is doing certain action? I am not sure with MyCode but with plugin, you could use like $mybb->user['uid'] .
(2012-03-31, 05:45 AM)crazy4cs Wrote: [ -> ]Grabbing user's uid as in the user which is doing certain action? I am not sure with MyCode but with plugin, you could use like $mybb->user['uid'] .

I need a plugin that can let me get a UID in MyCode. Like I'm trying to make my own mycode, and in the replacement URL I need to grab the UID.
You mean like making an MyCode, for example say [uid] would display the poster's uid?
(2012-03-31, 05:47 AM)crazy4cs Wrote: [ -> ]You mean like making an MyCode, for example say [uid] would display the poster's uid?

Yeah, currently there's no way you can do things like that in MyCode, but there's a plugin that makes it possible but I'm not capable of making one and I can't find one :p
Send query to database for a search of the username given, then trim it down to the UID and return.

Probably not a great method but it could work. I'm not going to spoon feed you there.
It would have to be done as a plugin as far as I know because you can't have it do other functions inside of preg_replace. I'd recommend looking at the /inc/class_parser.php file to see what hooks are available.
(2012-03-31, 06:30 AM)Lith Wrote: [ -> ]Send query to database for a search of the username given, then trim it down to the UID and return.

Probably not a great method but it could work. I'm not going to spoon feed you there.
I'm pretty sure that would not work.

(2012-03-31, 11:44 AM)dragonexpert Wrote: [ -> ]It would have to be done as a plugin as far as I know because you can't have it do other functions inside of preg_replace. I'd recommend looking at the /inc/class_parser.php file to see what hooks are available.
Thanks for the tip, I'll look into it.