![]() |
Custom chat not showing Usernames?
Hello there I have a custom chat that functions properly; however, it doesnt properly display the usernames. Can someone help me with this?
Online Demo Notice how when you type, it doesnt show the username. such as below Code:
[02:38:05] This is the message Code:
[02:38:05] Username: This is the message PHP Code:
|
1 Attachment(s)
Here is a screenshot of the issue.
The conding header for the non-boxed area of the screenshot is shown below: Code:
error_reporting(0); Code:
error_reporting(0); |
You have this:
Code:
$userid = intval($_COOKIE[bbuserid]); And why are you doing a while loop when you are only expecting one row returned? |
I am not entirely sure whether its $userid or $USER_ID but when I changed it to $userid, the chat doesnt work no more. It doesnt connect the user. So it must be $USER_ID.
As for the while loop, I did that because I will code the rest where I will add $icon = $row['icon']; $color = $row['color']; So each user will have a custom icon, if none then they will have a generic icon set for their particularity usergroup. The color is for the text color of each usergroup's username. So "User 1" as an Admin will be Blue, where as "User2" a regular member, will just be white. |
Quote:
Or not. |
Well I have modified the top of the code a bit so that the code would work if the $user_id was blank. I tried both the $userid and $USER_ID and still nothing.
So I can ensure that its not an error with there being no userid or username.. Unless my code is wrong? Here is the modified original code: PHP Code:
PHP Code:
|
Is your php file included (or "required") in another file, or is it supposed to be "stand-alone". I'm not sure if you're showing all the code in what you posted above, but if that file isn't being included in another vbulletin file, then you need to define some things before including global.php. If it is being included, then you probably don't need to include global.php.
Your original code had "error_reporting(0);" and some '@'s at the beginning of some function calls. You might want to remove those, at least temporarily, so you can see any PHP errors that you might be getting. |
Well theres 3 files involved. chat.php, chat.txt and chat.htm Everything I have showed you is the complete code. Chat.txt as you can imagine, is just the file it writes to and displays.
Below is the chat.htm: PHP Code:
|
This will not do anything:
Code:
$sql = @mysql_query("SELECT username FROM user WHERE userid=$userid"); |
Quote:
Quote:
|
Quote:
I didnt make the first chat, my friend did. His chat uses those table values and the chat works, so I wouldnt see why this one would not. If you would like to see a demo of that chat you can do so Here. But you must register (and click on Remember me upon login) before proceeding. You will notice that the users and icons/ colors work accordingly. Quote:
Code:
[22-May-2011 15:06:39] PHP Parse error: syntax error, unexpected T_STRING in /home/xxxxx/public_html/community/wc3_nightelf/chat.php on line 7 |
What does line 7 of chat.php look like?
|
Line 7 would be:
PHP Code:
To be more specific on the current chat.php I have shown you the coding below: PHP Code:
|
Can anyone further investigate with this issue? What other information should I supply so that others can fully analyze the problem?
|
My fault, I should have asked for the lines around line 7 (and I didn't notice that you posted more later). Anyway, you're missing a ';' at the end of the error_reporting() line.
|
Sorry, that was actually my fault for the minor error. Here is the generated error log:
PHP Code:
I changed the include from: PHP Code:
PHP Code:
|
Is chat.php in the same directory with global.php?
|
No which is why I am trying to set it to the Root of the directory. I though DIR would function as root.
Global is in community/global.php chat is in community/wc3nightelf/chat.php PHP Code:
PHP Code:
|
I don't think DIR is defined until after global.php is included. Have you tried ../global.php ?
|
That worked, now it properly generates the REAL errors:
Edit. Nvm it didnt work. PHP Code:
|
OK, try this:
Code:
chdir ( '..' ); |
Changes applied. Strange enough, there are no errors outputted. Yet the chat continues to be broken..
|
So with no errors, with the chat still not working, where do you think the issue begins with now?
|
All times are GMT. The time now is 05:49 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|