Author |
Topic |
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
Posted - 12 March 2004 : 04:33:34
|
Hi, I am trying to create a new mod...but I don't know how to start. The idea is this: Members can sponsor my site - for cash, or for work, whatever. If a member is a sponsor, I'd like to arrange that this member - doesn't see the ads - is allowed to change his/her own title - (automatically) gets upload priviliges
With the future in mind, I recon that I might distinguish between several 'levels' of sponsors, so I guess that using a numeric value ranging from 0 to ... is best for defining the sponsorship.
So, I think that this would be the approach:- add a column to the members table, with a numeric field, called M_SPONSORLEVEL
- Make sure that existing members are set to M_SPONSORLEVEL = 0
- Make sure that upon registration NEW members are also set to M_SPONSORLEVEL = 0
- Together with the MLEV retrieval retrieve the SLEV (Sponsorlevel)
After that I can use a statement like
IF SLEV = 0 THEN
'DISPLAY THE ADS
END IF or
IF SLEV <> 0 THEN
'ALLOW TITLE CHANGE
END IF etc.
However, I'm not sure on how to proceed and add the column/field to the table etc. Anyone willing to assist ? |
portfolio - linkshrinker - oxle - twitter |
Edited by - MarcelG on 12 March 2004 04:34:36 |
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
Posted - 12 March 2004 : 04:47:48
|
Okay...some progress already ; I've defined sLev in config.asp. (dim sLev) Next to that I've added this to inc_header.asp, around line 270.
'MarcelG's Sponsormod
'## Forum_SQL
strSql = "SELECT M_SPONSORLEVEL "
strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " WHERE " & strDBNTSQLName & " = '" & ChkString(fUser_Name, "SQLString") & "'"
set rsSponsor = my_Conn.Execute (strSql)
if rsSponsor.EOF or rsSponsor.BOF then
'## Do nothing
else
sLev = rsSponsor("M_SPONSORLEVEL")
end if
rsSponsor.close
set rsSponsor = nothing
'end of MarcelG's Sponsormod This is just after this:
if trim(strDBNTUserName) <> "" and trim(Request.Cookies(strUniqueID & "User")("Pword")) <> "" then
chkCookie = 1
mLev = cLng(chkUser(strDBNTUserName, Request.Cookies(strUniqueID & "User")("Pword"),-1))
chkCookie = 0
But...I still haven't added the field to the db...
|
portfolio - linkshrinker - oxle - twitter |
Edited by - MarcelG on 12 March 2004 04:50:20 |
|
|
Etymon
Advanced Member
United States
2385 Posts |
Posted - 13 March 2004 : 00:09:36
|
You might try contacting the owner of http://www.paratrooper.net. He used to have a Snitz forum, and I think I remember reading in one of the discussions there that paid members would not see ads, etc. Don't quote me though as he has since switched forum software, and I can't find the post anymore.
He might have some clues for you. Etymon
|
|
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
Posted - 13 March 2004 : 03:30:14
|
Thanks etymon.... however I'm almost crying....isn't there ányone who's familiar with the the process of how to ad a column to a table of the db, and who's willing to share that info ?
Once I've got thát figured out, the rest is easy. Setting the value is easy - done throught the profile page by the administrators (just as things like Upload/Download/Title/Username) |
portfolio - linkshrinker - oxle - twitter |
Edited by - MarcelG on 13 March 2004 03:32:10 |
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 13 March 2004 : 03:48:55
|
to add a column to the db, you will need to create a dbs file which you then execute using the admin_modconfig
contents of the dbs file should be everythig between the ------- lines
---------------------------------------------- Sponsorship Mod [ALTER] MEMBERS ADD#M_SPONSORLEVEL#int#NULL#0 [END] ------------------------------------- |
|
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
Posted - 13 March 2004 : 14:10:52
|
Mmmz... I've adapted the dbs file, to include the members_pending table.. So, I've used this code:
Sponsormod v1.0béta
[ALTER]
MEMBERS
ADD#M_SPONSORLEVEL#int#NULL#0
[END]
[ALTER]
MEMBERS_PENDING
ADD#M_SPONSORLEVEL#int#NULL#0
[END]
But, if I run this one, it sais this:
quote: Adding Column M_SPONSORLEVEL... ALTER TABLE FORUM_MEMBERS ADD COLUMN M_SPONSORLEVEL int NULL DEFAULT 0 ALTER TABLE FORUM_MEMBERS ADD COLUMN M_SPONSORLEVEL int NULL DEFAULT 0 -2147217900 | The database engine could not lock table 'FORUM_MEMBERS' because it is already in use by another person or process.
--------------------------------------------------------------------------------
Adding Column M_SPONSORLEVEL... ALTER TABLE FORUM_MEMBERS_PENDING ADD COLUMN M_SPONSORLEVEL int NULL DEFAULT 0 Column added successfully UPDATE FORUM_MEMBERS_PENDING SET M_SPONSORLEVEL=0 Populating Current Records with new Default value Table(s) updated
So, the members_pending table is updated, but the members_table not...any suggestions ? |
portfolio - linkshrinker - oxle - twitter |
Edited by - MarcelG on 13 March 2004 14:12:21 |
|
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
Posted - 13 March 2004 : 15:44:58
|
I've done a manual update of the members table. Replaced the code in INC_HEADER with this code:
'MarcelG's Sponsormod
'## Forum_SQL
strSql = "SELECT " & strMemberTablePrefix & "MEMBERS.M_SPONSORLEVEL"
strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " WHERE " & strDBNTSQLName & " = '" & ChkString(strDBNTUserName, "SQLString") & "'"
set rsSponsor = my_Conn.Execute (strSql)
if rsSponsor.EOF or rsSponsor.BOF then
'## Do nothing
else
sLev = 0 + rsSponsor("M_SPONSORLEVEL")
end if
rsSponsor.close
set rsSponsor = nothing
'end of MarcelG's Sponsormod I will post a complete howto tomorrow. |
portfolio - linkshrinker - oxle - twitter |
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 13 March 2004 : 17:05:48
|
quote:
The database engine could not lock table 'FORUM_MEMBERS' because it is already in use by another person or process.
probably someone was editing their profile when you tried to update. Updates like this should not really be performed on a live database. |
|
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
|
|
Topic |
|