Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 24 Sep 2009, 11:11
Digma Digma is offline
 
Join Date: Nov 2004
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 24 Sep 2009 at 11:12 ---------------

Hmmm, I think this should have gone into 'Programming Discussion'. Sorry for the wrong placement.

Last edited by Digma; 24 Sep 2009 at 11:12. Reason: Auto-Merged DoublePost
Reply With Quote
  #2  
Old 24 Sep 2009, 16:06
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
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.
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #3  
Old 24 Sep 2009, 20:18
Digma Digma is offline
 
Join Date: Nov 2004
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.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Note: I am not a real coder, so it might not be up to the standard of info you're used to. If you need more just let me know.

Thank you in advance.
Reply With Quote
  #4  
Old 24 Sep 2009, 21:53
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
What you did right here:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

You just set $row['author_id'] to *your* userid. Why? And then you spit out your username. I thought you wanted to use the userid from the query and get the username associated with it from the vbulletin database?

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.
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #5  
Old 26 Sep 2009, 16:39
charlie71 charlie71 is offline
 
Join Date: Sep 2008
You can use something like this for getting the username by a userid:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Don't forget to escape $userid properly by using the vbulletin escape functions...
Reply With Quote
  #6  
Old 30 Sep 2009, 09:05
Digma Digma is offline
 
Join Date: Nov 2004
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 30 Sep 2009 at 09:43 ---------------

Problem solved I came up with the following query and it works:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Thanks again for the pointers.

Last edited by Digma; 30 Sep 2009 at 09:55. Reason: Auto-Merged DoublePost
Reply With Quote
Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
Display Sticky threads on all forum display pages Freddie Bingham vBulletin 2.x Full Releases 16 05 Sep 2002 00:53



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 14:21.

Layout Options | Width: Wide Color: