Author |
Topic |
|
Hobeeb
Starting Member
17 Posts |
Posted - 01 May 2003 : 12:05:55
|
Ok, been trying to get this to work for a week now...
Basically, I'm trying to get it so that the links that my users see is limited. I already got it so that if they ahven't logged on they see no links in the upper right hand corner, but now I'd like to set it up so that they see different links based on thier level of subscription (e.g. admin, moderator, user)...for some reason I cannot get it to work...) Here is the code, if anyone could help me out it'd be a life saver.
sub sForumNavigation()
' DEM --> Added code to show the subscription line
if strSubscription > 0 and strEmail = "1" then
if mlev > 0 then
strSql = "SELECT COUNT(*) AS MySubCount FROM " & strTablePrefix & "SUBSCRIPTIONS"
strSql = strSql & " WHERE MEMBER_ID = " & MemberID
set rsCount = my_Conn.Execute (strSql)
if rsCount.BOF or rsCount.EOF then
' No Subscriptions found, do nothing
MySubCount = 0
rsCount.Close
set rsCount = nothing
else
MySubCount = rsCount("MySubCount")
rsCount.Close
set rsCount = nothing
end if
if mLev = 4 then
strSql = "SELECT COUNT(*) AS SubCount FROM " & strTablePrefix & "SUBSCRIPTIONS"
set rsCount = my_Conn.Execute (strSql)
if rsCount.BOF or rsCount.EOF then
' No Subscriptions found, do nothing
SubCount = 0
rsCount.Close
set rsCount = nothing
else
SubCount = rsCount("SubCount")
rsCount.Close
set rsCount = nothing
end if
end if
else
SubCount = 0
MySubCount = 0
end if
else
SubCount = 0
MySubCount = 0
end if
Response.Write " <a href=""" & strHomeURL & """" & dWStatus("Homepage") & " tabindex=""-1""><acronym title=""Homepage"">Home</acronym></a>" & vbNewline & _
" |" & vbNewline
if strUseExtendedProfile then
Response.Write " <a href=""pop_profile.asp?mode=Edit""" & dWStatus("Edit your personal profile...") & " tabindex=""-1""><acronym title=""Edit your personal profile..."">Profile</acronym></a>" & vbNewline
else
Response.Write " <a href=""javascript:openWindow3('pop_profile.asp?mode=Edit')""" & dWStatus("Edit your personal profile...") & " tabindex=""-1""><acronym title=""Edit your personal profile..."">Profile</acronym></a>" & vbNewline
end if
if strAutoLogon <> "1" then
if strProhibitNewMembers <> "1" then
if mlev > 1 then
Response.Write " |" & vbNewline & _
" <a href=""policy.asp""" & dWStatus("Register to post to our forum...") & " tabindex=""-1""><acronym title=""Register to post to our forum..."">Register</acronym></a>" & vbNewline
end if
end if
if mlev > 1 then
Response.Write " |" & vbNewline & _
" <a href=""active.asp""" & dWStatus("See what topics have been active since your last visit...") & " tabindex=""-1""><acronym title=""See what topics have been active since your last visit..."">Active Topics</acronym></a>" & vbNewline
end if
' DEM --> Start of code added to show subscriptions if they exist
if (strSubscription > 0) then
if mlev = 4 and SubCount > 0 then
Response.Write " |" & vbNewline & _
" <a href=""subscription_list.asp?MODE=all""" & dWStatus("See all current subscriptions") & " tabindex=""-1""><acronym title=""See all current subscriptions"">All Subscriptions</acronym></a>" & vbNewline
end if
if MySubCount > 0 then
Response.Write " |" & vbNewline & _
" <a href=""subscription_list.asp""" & dWStatus("See all of your subscriptions") & " tabindex=""-1""><acronym title=""See all of your subscriptions"">My Subscriptions</acronym></a>" & vbNewline
end if
end if
' DEM --> End of Code added to show subscriptions if they exist
if mlev > 1 then
Response.Write " |" & vbNewline & _
" <a href=""members.asp""" & dWStatus("Current members of these forums...") & " tabindex=""-1""><acronym title=""Current members of these forums..."">Members</acronym></a>" & vbNewline
end if
Response.write " |" & vbNewline & _
" <a href=""search.asp"
if Request.QueryString("FORUM_ID") <> "" then Response.Write("?FORUM_ID=" & cLng(Request.QueryString("FORUM_ID")))
end if
Response.Write """" & dWStatus("Perform a search by keyword, date, and/or name...") & " tabindex=""-1""><acronym title=""Perform a search by keyword, date, and/or name..."">Search</acronym></a>" & vbNewline & _
" |" & vbNewline & _
" <a href=""faq.asp""" & dWStatus("Answers to Frequently Asked Questions...") & " tabindex=""-1""><acronym title=""Answers to Frequently Asked Questions..."">FAQ</acronym></a>" & vbNewline & _
" |" & vbNewline & _
" <a href=""post.asp?method=Topic&project=1&FORUM_ID=2""" & dWStatus("Post a new project...") & " tabindex=""-1""><acronym title=""Post a new project..."">Post a New Project</acronym></a>" & vbNewline & _
" |" & vbNewline & _
" <a href=""forum.asp?FORUM_ID=2""" & dWStatus("View Projects...") & " tabindex=""-1""><acronym title=""Read Projects..."">View Projects</acronym></a>" & vbNewline & _
" " & vbNewline
end sub
Whew, pain in the a**...
Anyone that could help me out, thanks in advance.
Vin
|
Edited by - ruirib on 01 May 2003 12:08:03 |
|
Davio
Development Team Member
Jamaica
12217 Posts |
Posted - 01 May 2003 : 12:25:14
|
It seems you are setting these links to be viewed by admins and moderators only. mLev > 1 means only admins and moderators.
What links do you want to be hidden and from who? What's wrong with your code now? |
Support Snitz Forums
|
|
|
DavidRhodes
Senior Member
United Kingdom
1222 Posts |
Posted - 01 May 2003 : 12:26:17
|
use the mlev variable mlev = 0 not logged in mlev = 2 logged in mlev = 3 moderator mlev = 4 admin |
The UK MkIVs Forum |
|
|
Davio
Development Team Member
Jamaica
12217 Posts |
Posted - 01 May 2003 : 12:28:48
|
David, that's not correct. The mLev variable gets it's value from the M_LEVEL field in the database. The following info is taken from the Snitz Forums Mod Guide:quote: Field Name: M_LEVEL
Long Name: Member Level
Data Type [Access, MS SQL, MySQL]: Small Integer [SMALLINT, SMALLINT, SMALLINT(6)]
Default Value: 1 (Access and MySQL DB only)
Allow Nulls: Yes
Description: Holds the level of authority the member has on the forum.
Possible Values: -1 - The members' account is still pending approval. When approved, this level will change to the normal user level. 1 - Normal User 2 - Moderator 3 - Administrator
NOTE: There is no default value set for this field for the MS SQL database.
|
Support Snitz Forums
|
|
|
Hobeeb
Starting Member
17 Posts |
Posted - 01 May 2003 : 13:04:11
|
Well, I want the Admin/moderators to see all the links, but I want the general users to see only:
Home, Profile, View Projects, Post a New Project, FAQ, and Search
For some reason, the code won't work - it shows all the links regardless of what level user I log in as. |
|
|
jstewar
Starting Member
6 Posts |
Posted - 08 May 2003 : 14:50:38
|
I used code like the following to set my members link to only be viewed by moderators and admins. I have a m_level of 5, that is also a restricted level, so I couldn't leave it with just the > sign. Otherwise, the > sign for mlev > 2 should also work. I also did this for the register link and it seems to work ok for me. Good luck. Jennifer
If mlev = 3 or mlev = 4 then
Response.write "<a href=""members.asp""" & dWStatus("Current members of these forums...") & " tabindex=""-1""><acronym title=""Current members of these forums..."">Members</acronym></a>" & vbNewline & _ " |" & vbNewline End If |
|
|
|
Topic |
|