The Forum has been Updated
The code has been upgraded to the latest .NET core version. Please check instructions in the Community Announcements about migrating your account.
I want the Thank you message in post_info.asp to add the users title and name at the end.
I know I can use "" & strDBNTUserName & "" to add the name but not sure of the title can anyone help me please?
<
I know I can use "" & strDBNTUserName & "" to add the name but not sure of the title can anyone help me please?
<
Posted
There's really no "quick" way to do it, since the title is not stored in any forum variables. If you only want to use it in that one location, it would be as simple as running a quick SQL query to get the user's title from the database and use it on post_info.asp. However, if you think you'll want to use it in other places as well, you might consider adding the code to inc_header.asp and storing it in a variable for use throughout your site.<
Bill Parrott
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)
Last edited by muzishun on 02 March 2008, 19:15
Posted
Thanks for the info
Could you help me with the code for that please?
I really lack knowledge<
Could you help me with the code for that please?
I really lack knowledge<
Last edited by leesh695 on 02 March 2008, 19:32
Posted
I am on my way out the door just at the moment, but if nobody has replied when I get home this evening, I'll take a look. It should only be a couple lines of code.<
Bill Parrott
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)
Posted
Thanks alot
<
Posted
This is untested, but it should work for you. You can include it in post_info.asp or in inc_header.asp, which will give you a little more flexibility with using the title on other pages.
<
Code:
strSql = "SELECT M_TITLE FROM " & strMemberTablePrefix & "MEMBERS WHERE MEMBER_ID = " & MemberID
set rsMTitle = Server.CreateObject("ADODB.Recordset")
rsMTitle.open strSql, my_Conn
MemberTitle = rsMTitle("M_TITLE")
rsMTitle.close
set rsMTitle = nothingBill Parrott
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)
Posted
Worked Great, I included it in Inc_header.
Thanks loads
<
Thanks loads
Posted
Oh, I noticed an error when i include it in Inc_header, when people are not logged in.
"ADODB.Field error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/forum/forum/inc_header.asp, line 595"
Its not really important, It works fine just in post_info.asp.
Thanks alot for writing this for me :)<
"ADODB.Field error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/forum/forum/inc_header.asp, line 595"
Its not really important, It works fine just in post_info.asp.
Thanks alot for writing this for me :)<
Posted
You're welcome. I forgot to include a check for users who aren't logged in. It's a fairly simple change. Make this line:
Look like this:
That'll cover your rear for users who aren't logged in.<
Code:
MemberTitle = rsMTitle("M_TITLE")Code:
if not (rsMTitle.BOF or rsMTitle.EOF) then
MemberTitle = rsMTitle("M_TITLE")
end if
Bill Parrott
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)
Last edited by muzishun on 03 March 2008, 10:56
Posted
Why not do this instead? This way you don't hit the database if they aren't logged in... it will save you a little overhead in the long-run.
There's probably an even better way of doing it during the login process, but I'd have to go back and dig up a clean copy of the code...<
Code:
If mLev > 0 Then
strSql = "SELECT M_TITLE FROM " & strMemberTablePrefix & "MEMBERS WHERE MEMBER_ID = " & MemberID
set rsMTitle = Server.CreateObject("ADODB.Recordset")
rsMTitle.open strSql, my_Conn
MemberTitle = rsMTitle("M_TITLE")
rsMTitle.close
set rsMTitle = nothing
End IfThere's probably an even better way of doing it during the login process, but I'd have to go back and dig up a clean copy of the code...<
Last edited by AnonJr on 03 March 2008, 12:03
Posted
Good idea, Anon. I agree that it could probably be done more efficiently during the login process, but I was going for "quick and dirty" to save time.<
Bill Parrott
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)
Email Member
Message Member
Post Moderation
FileUpload
If you're having problems uploading, try choosing a smaller image.
Preview post
Send Topic
Loading...