![]() |
Displaying Custom Profile Fields on an Image
Hello, I'm trying to set up a signature image creator for users on my website. What I want to do is have the php script, pull a profile field from the database and insert the text onto the image. I found a script to make images, however after modifying it a great deal, I still can't get this to work.
I'm able to get the page itself to display the profile field, however the image refuses to show it. The image also refuses to acknowledge I'm even logged in. I tried Code:
$text = $vbulletin->userinfo['field17']; This is the code for the image script: Code:
<?php |
You need to include vBulletin's global.php for any vBulletin variables to work.
|
I have it included in the page that is calling the script itself, including it in the script returns the error "headers already sent, cookies cannot be sent" but it still refuses to call the profile field for anyone, except it will show mine for everyone if I use the code below.
Code:
$text = $vbulletin->db->query_first("SELECT field17 FROM " . TABLE_PREFIX . "userfield"); |
This is field 17 for *you*, not someone else -
PHP Code:
|
I'm not sure what you're trying to say.
I must correct myself in my last post, as it was 4am and I was tired of looking at the code. I meant to say that this code causes my field17 to show up for everyone that generates the form: Code:
$text = $vbulletin->db->query_first("SELECT field17 FROM " . TABLE_PREFIX . "userfield"); I'm unable to call the profile field for the current logged in user, and instead the query seems to only show the field for the first userid in the database. I guess what I should be asking is how to get the script to access the cookie of vbulletin so it can pull from the database for each user, if that makes any sense. I'm sure it's probably my query itself that's off, so that might be the main problem. |
Actually, that query just grabs field17 for some random user. Nowhere in that query do you say to grab it for a particular user - you have no WHERE statement in that query (like WHERE userid = 'whatever'). Are you trying to grab field17 for the person accessing the page or who?
I don't know anything about accessing cookies, sorry. |
I'm trying to grab it for the user who presses the "generate image" button on the form. So yes, to the person accessing the page.
|
Then you need something like WHERE userid = $vbulletin->userinfo['userid'] in the query (correct punctuation not included).
|
Ok, I was finally able to get the profile field on the image.
Thanks for your help. :) |
All times are GMT. The time now is 07:05 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:
|