The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
How to fetch a userid
I am writing a script that uses vbulletin for usernames and userids.
Currently, I know I can use $info = fetch_userinfo($userid); $username=$info["username"]; echo $username; to display a username for a userid. My problem is going the other way around. Does anyone know how to display a userid for a username? Any help would be appreciated. Thanks! Edit: Also I am aware that I can do this with an sql query. I don't want to have to do that. |
#2
|
||||
|
||||
Look up fetch_userid_from_username in the API
|
#3
|
|||
|
|||
hello people can somebody help out on a lillte issue i have?
im using a own build php script that does read a txt file and tranfers it intoo a sorted php file but it was build for a blog.... to tell what it does in short is.... ya can manually add releases to page... sofar it works fine but i can't get the userinfo on it Code:
global $user_identity; get_currentuserinfo(); $todaydate = date("m/d/Y"); $riplist .= '{[1] = [[music]],[2] = [['.$user_identity.']],[3] = [['.$todaydate.']],[4] = [['.$artist.' ('.$year.') '.$album.']],},'."\r\n"; } // append closing bracket to riplist. $riplist = $riplist."}"; // we have our riplist, now write to file. if ($handle = fopen ($rel_file3, "ab")) { // find the file size in bytes and remove one ie trailing bracket on last line $truncate = filesize("$rel_file3") - 1; // remove trailing bracket. ftruncate ($handle, $truncate); // write our new rips plus closing bracket } if (fwrite($handle, $riplist)) { print "<p>Thanks! Your rips were successfully added to the database.</p>"; } else { print "<p>Something went wrong with the writing to DB file process. Please report to admin.</p>"; } fclose($handle); } else { print "<p>Couldn't open the file for writing!</p>"; } } else print "<p>You didn't not add owt.</p>"; } but i have trouble to add the user that posted it Code:
global $user_identity; get_currentuserinfo(); $todaydate = date("m/d/Y"); $riplist .= '{[1] = [[music]],[2] = [['.$user_identity.']],[3] = [['.$todaydate.']],[4] = [['.$artist.' ('.$year.') '.$album.']],},'."\r\n"; } cause im getting the error: Fatal error: Call to undefined function fetch_userinfo() in /var/www/Forum/database/releases.php on line 324 line 324 is empty 322> global $user_identity; 323> get_currentuserinfo(); 324> empty any idea how to fix? thnx |
#4
|
||||
|
||||
This error:
PHP Code:
|
#5
|
|||
|
|||
im sorry i mixed up the first soultion... that was posted in here
the fatal error that takes place is Code:
Fatal error: Call to undefined function get_currentuserinfo() in /var/www/Forum/database/releases.php on line 323 Code:
322> global $user_identity; 323> get_currentuserinfo(); 324> empty so im trying to get a work around to get the userinfo.... |
#6
|
||||
|
||||
Weel again, it's an unidentified function which means you are calling it, but the file that contains the function is not being included. What file do you identify the function get_currentuserinfo in?
|
#7
|
|||
|
|||
well im not sure i understand fully...
but it does concern the current user thats on that(Vbulletin) page to post a release to explain in short... ive created a empty page as did get posted in here in mods and used $include php for it a part of that script is posted on post nr 9 above anything does work fine on a wordpress instalation but not on VB... cause the member thats online on VB and that wants to post a release will not be added due that error it does gave... so i need to change that script so it gets the user thats on VB and that does post that release.... maybe this helps you... ( i hope).. if not then ill gave the full script ect what belongs to it... send me then a pm pls gracias Lynne |
#8
|
||||
|
||||
The problem is it wants to use the function get_currentuserinfo() but it is unable to since you haven't included the function in the script. Find the function in your files and either copy it into your page or include the page in your script:
PHP Code:
|
#9
|
|||
|
|||
Lynne i think ya total misunderstand me a bit or i fail to explain it correctly...
but im gonnay try to explaim a bit easyer in root >> new made empty page called releases.php if has indeed included the php that needs to be show >> PHP Code:
does look for that userinfo ill post that part ofl script from line 322 until 354 and the error i do get comes from that line 324 (again this worked in wordpress but not in vbulletin) Code:
global $user_identity; get_currentuserinfo(); $todaydate = date("m/d/Y"); $riplist .= '{[1] = [[music]],[2] = [['.$user_identity.']],[3] = [['.$todaydate.']],[4] = [['.$artist.' ('.$year.') '.$album.']],},'."\r\n"; } // append closing bracket to riplist. $riplist = $riplist."}"; // we have our riplist, now write to file. if ($handle = fopen ($rel_file3, "ab")) { // find the file size in bytes and remove one ie trailing bracket on last line $truncate = filesize("$rel_file3") - 1; // remove trailing bracket. ftruncate ($handle, $truncate); // write our new rips plus closing bracket } if (fwrite($handle, $riplist)) { print "<p>Thanks! Your rips were successfully added to the database.</p>"; } else { print "<p>Something went wrong with the writing to DB file process. Please report to admin.</p>"; } fclose($handle); } else { print "<p>Couldn't open the file for writing!</p>"; } } else print "<p>You didn't not add owt.</p>"; } |
#10
|
||||
|
||||
OK, let's start with this.... what file is the function get_currentuserinfo in? Is it in the releases.php file? Is that file readable to the public? Try copying the function out of the file and putting it into your page - does it work now?
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|