Changing the Thank you message - نوشته شده در (1397 Views)
Junior Member
leesh695
مطلب: 101
101
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? bigsmile
<
 پیش‌فرض مرتب‌سازی برای تاریخ DESC به معنی جدیدترین است  
 تعداد در صفحه 
نوشته شده در
Senior Member
muzishun
مطلب: 1079
1079
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)
نوشته شده در
Junior Member
leesh695
مطلب: 101
101
Thanks for the info bigsmile
Could you help me with the code for that please?
I really lack knowledge<
نوشته شده در
Senior Member
muzishun
مطلب: 1079
1079
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)
نوشته شده در
Junior Member
leesh695
مطلب: 101
101
Thanks alot smile<
نوشته شده در
Senior Member
muzishun
مطلب: 1079
1079
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 = 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)
نوشته شده در
Junior Member
leesh695
مطلب: 101
101
Worked Great, I included it in Inc_header.
Thanks loads bigsmile<
نوشته شده در
Junior Member
leesh695
مطلب: 101
101
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 :)<
نوشته شده در
Senior Member
muzishun
مطلب: 1079
1079
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:
Code:
MemberTitle = rsMTitle("M_TITLE")
Look like this:
Code:

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)
نوشته شده در
Forum Moderator
AnonJr
مطلب: 5768
5768
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.
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 If

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...<
نوشته شده در
Senior Member
muzishun
مطلب: 1079
1079
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)
شما باید یک متن وارد کنید