The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Display username (not your own) on non-vb pages
Is there a way of showing a username other than your own on a non-vb page, while working with separate databases but within the same domain?
I've already got the userid stored in the other database under author id and would like to be able to show the username belonging to that when the entry is requested on the site. Say someone has submitted a guide and he has userid 5,000. When he submits his content the userid is stored in the content database. Now when someone else tries to access the page where that specific content is on, I would like the author id to be linked to his username in the vbulletin database. I've been trying to experiment using global.php, but either got my own username or Unregistered Users (when logged out from the system). Can anyone give me a lead where to look further (already checked [How-To] vBulletin API Basics: Creating Custom Pages & Misc. but couldn't find the answer there). Thank you in advance. --------------- Added [DATE]1253790760[/DATE] at [TIME]1253790760[/TIME] --------------- Hmmm, I think this should have gone into 'Programming Discussion'. Sorry for the wrong placement. |
#2
|
||||
|
||||
So basically, you have two user tables - one for where they submit guides and the other on vbulletin and you want to be able to link the two by userid? You should be able to do this - including global.php (or init.php) should allow you to connect to the vbulletin database. It's hard to know where you went wrong without seeing your code.
|
#3
|
|||
|
|||
Thank you for responding to my thread Lynne, much appreciated and my apologies for not being thorough enough on the information given. Basically my situation is as followed:
I am currently working with 2 databases: 1. The forum database is where all the vbulletin information resides. 2. The site database is where all the site (so non-vb) information resides. Mind that I have been fiddling around with the code to see what works. In an earlier part of the code below I have already included global.php and also have a login system that shows the person logged in. However in relation to the code below I changed the author_id in the SITE database to reflect another user. When loading the code it still shows my username, not the one it should really relate to. Also when I logout I get to see Unregistered. The last couple of line is what is currently troubling me to solve. Perhaps I am missing something stupidely simple and I just need to be pointed into the right direction or there is simply something fundamentally wrong with those few lines. PHP Code:
Thank you in advance. |
#4
|
||||
|
||||
What you did right here:
PHP Code:
You need to do a quick query to the vbulletin user table to grab the username associated with the userid of $row['author_id']. I think you can do a JOIN in your original query for it, but I'm not sure of the exact syntax with it being to another database. |
#5
|
|||
|
|||
You can use something like this for getting the username by a userid:
Code:
$username = mysql_result($db->query_read("select username from " . TABLE_PREFIX . "user where userid = '$userid' order by userid desc limit 1"), 0); |
#6
|
|||
|
|||
Thanks for the information. I'll dive into it and see if I can come up with something properly working going from both your information. Again, thanks!
--------------- Added [DATE]1254303795[/DATE] at [TIME]1254303795[/TIME] --------------- Problem solved I came up with the following query and it works: PHP Code:
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|