Author |
Topic |
|
leesh695
Junior Member
101 Posts |
Posted - 02 March 2008 : 18:40:57
|
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?
< |
|
muzishun
Senior Member
United States
1079 Posts |
Posted - 02 March 2008 : 19:15:28
|
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) |
Edited by - muzishun on 02 March 2008 19:15:50 |
|
|
leesh695
Junior Member
101 Posts |
Posted - 02 March 2008 : 19:31:25
|
Thanks for the info
Could you help me with the code for that please? I really lack knowledge< |
Edited by - leesh695 on 02 March 2008 19:32:03 |
|
|
muzishun
Senior Member
United States
1079 Posts |
Posted - 02 March 2008 : 19:49:24
|
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) |
|
|
leesh695
Junior Member
101 Posts |
Posted - 02 March 2008 : 19:51:33
|
Thanks alot < |
|
|
muzishun
Senior Member
United States
1079 Posts |
Posted - 02 March 2008 : 23:44:14
|
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.
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 < |
Bill Parrott Senior Web Programmer, University of Kansas Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com) Personal Website (www.chimericdream.com) |
|
|
leesh695
Junior Member
101 Posts |
Posted - 03 March 2008 : 08:46:39
|
Worked Great, I included it in Inc_header.
Thanks loads < |
|
|
leesh695
Junior Member
101 Posts |
Posted - 03 March 2008 : 09:31:01
|
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 :)< |
|
|
muzishun
Senior Member
United States
1079 Posts |
Posted - 03 March 2008 : 10:55:52
|
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:
MemberTitle = rsMTitle("M_TITLE") Look like this:
if not (rsMTitle.BOF or rsMTitle.EOF) then
MemberTitle = rsMTitle("M_TITLE")
end if
That'll cover your rear for users who aren't logged in.< |
Bill Parrott Senior Web Programmer, University of Kansas Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com) Personal Website (www.chimericdream.com) |
Edited by - muzishun on 03 March 2008 10:56:21 |
|
|
AnonJr
Moderator
United States
5768 Posts |
Posted - 03 March 2008 : 12:02:35
|
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...< |
Edited by - AnonJr on 03 March 2008 12:03:27 |
|
|
muzishun
Senior Member
United States
1079 Posts |
Posted - 03 March 2008 : 14:38:46
|
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) |
|
|
leesh695
Junior Member
101 Posts |
Posted - 03 March 2008 : 15:38:19
|
Well, I have added the fix that anon posted because you both seem to agree thats better:p
Thanks again for everything < |
|
|
muzishun
Senior Member
United States
1079 Posts |
Posted - 03 March 2008 : 17:47:15
|
You're quite welcome.< |
Bill Parrott Senior Web Programmer, University of Kansas Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com) Personal Website (www.chimericdream.com) |
|
|
cgcarter1
Starting Member
14 Posts |
Posted - 01 April 2008 : 12:00:53
|
I decide that having the user's number of posts was better. For instance: Thank you JohnQSmith for your 123456 posts!
This is how I changed your code...
If mLev > 0 Then strSql = "SELECT M_POSTS FROM " & strMemberTablePrefix & "MEMBERS WHERE MEMBER_ID = " & MemberID
set rsMposts = Server.CreateObject("ADODB.Recordset") rsMposts.open strSql, my_Conn MemberPosts = rsMposts("M_POSTS") rsMposts.close set rsMposts = nothing End If< |
|
|
|
Topic |
|