MyBB Community Forums

Full Version: User ID in post
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I found a mod that is supposed to display the user ID in a thread post, but it doesn't seem to work.. that's aside the point, though.

I want to know if there is a mod or if someone can create one where the user ID is displayed each time a user post and a user ID is assigned to a guest user based off their IP address each time they post. The user ID would be located under Reputation.

Thanks for any help Smile

bump...
For users, in postbit_author_user template add:
<br />UID: {$post['uid']}

For guests, it's more complicated. Install this plugin: http://mybbhacks.zingaburga.com/showthread.php?tid=464
You have to put in inc/plugins both .txt and .php file.

Then in postbit_author_guest template add:
UID: <?=hexdec(substr(md5($post['ipaddress']), 0, 10))?>
or something similar to generate the number based on ip.
I think OP wants to assign an ID to guest, just like UID for registered users.

@OP, here is a plugin which assigns a unique ID to guests based on their unique IP: http://yaldaram.com/thread-6594.html
Thanks for both the replies.

@Yaldaram, the plugin looks great but I'm just not willing to pay for it when I could make it work without it.

@Destroy, I get an error when adding that code into the guest template.
What is the error? Be more specific.
(2013-11-21, 07:50 AM)Euan T Wrote: [ -> ]What is the error? Be more specific.

Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /home/awak333x/public_html/mboard/inc/functions_post.php(438) : eval()'d code on line 3
that would be it after adding this line of code:
UID: <?=hexdec(substr(md5($post['ipaddress']), 0, 10))?>
Does it happen when you view forum as guest or/and admin? Instead of that code put {$post['ipaddress']} only, what is shown after that for admins/guests?
(2013-11-21, 11:28 PM)Destroy666 Wrote: [ -> ]Does it happen when you view forum as guest or/and admin? Instead of that code put {$post['ipaddress']} only, what is shown after that for admins/guests?

It displays the IP address. The error occurs as guest and admin so I think the problem might be when we use that other bit of code along with it.
I tested exactly the same code and don't get that error... I should be ok if the ip is displayed in every post.

Make sure you activated Template Conditionals plugin and placed the phptpl_allowed_funcs.txt file in inc/plugins.
Got it! I don't know what I did but I just followed your directions again and it worked. Thanks for the help, this was exactly what I needed!