######################################################## ## ## Hack Title: PM Limitation ## Hack Version: 1.1.0 ## Author: Christoph "Toxic" Hellings (toxic@freenet.de) ## Date Created: 09-02-02 ## Date Updated: 09-02-02 ## Thread Location: http://www.tforumhacks.com/tforum/viewtopic.php?TopicID=1028 ## Working Example: ## Description: User can't receive more PMs when their Inbox is full ## the limit depends on the user level and can be set in admin area ## ## ## Installation Level: Intermediate ## Installation Time: 10 Minutes ## Files To Edit: 3 ## Edit Database: yes ## Included Files: none ## ######################################################## ## ## Installation/Author Notes: ## ## I think it works but no warranty... ## ## UPGRADING INSTRUCTIONS 1.0.0 -> 1.1.0: ## do all instructions for the database ## do all instructions for adminfunctions.php ## do the 1st instruction for pm.php ## delete the following line from pm.php: ## $limit = 20; ## END OF UPGRADING INSTRUCTIONS ## ######################################################## # #-----[ ACTION: BACKUP ]------------------------------------------ # Every time you edit your files, you should always back them up first. Although all of these hacks have been tested on various systems, they may not work with your configuration or you may not like what it does. Backing up protects yourself and your users from downtime. # #-----[ ACTION: EDIT DATABASE ]---------------------------------- # ALTER TABLE t_UserLevel ADD PMlimit SMALLINT(5) UNSIGNED NOT NULL DEFAULT '20'; # #-----[ ACTION: OPEN ]------------------------------------------- # admin_functions.php # #-----[ ACTION: LOCATE ]----------------------------------------- # function ViewUserCat() # #-----[ ACTION: FIND ]------------------------------------------- # Color # #-----[ ACTION: ADD AFTER ]-------------------------------------- # PM Limit # #-----[ ACTION: FIND ]------------------------------------------- # > # #-----[ ACTION: ADD AFTER ]-------------------------------------- # # #-----[ ACTION: FIND ]------------------------------------------- # Power Definition:
1-Admin 2-SuperModerator 3-Senior 4-Normal 5-Junior It should be noted that the default for any new user is 5.
# #-----[ ACTION: REPLACE ]---------------------------------------- # Power Definition:
1-Admin 2-SuperModerator 3-Senior 4-Normal 5-Junior It should be noted that the default for any new user is 5.
# #-----[ ACTION: LOCATE ]----------------------------------------- # function EditUserCat() # #-----[ ACTION: FIND ]------------------------------------------- # { global $fSettings,$UserCatID,$Submit,$Level,$textColor,$Icon,$PostNeed; # #-----[ ACTION: REPLACE ]---------------------------------------- # { global $fSettings,$UserCatID,$Submit,$Level,$textColor,$Icon,$PostNeed,$PMlimit; # #-----[ ACTION: FIND ]------------------------------------------- # { $query = "UPDATE t_UserLevel set Level='$Level',textColor='$textColor',Icon='$Icon',PostNeed='$PostNeed' WHERE ID = $UserCatID"; # #-----[ ACTION: REPLACE ]---------------------------------------- # { $query = "UPDATE t_UserLevel set Level='$Level',textColor='$textColor',Icon='$Icon',PostNeed='$PostNeed',PMlimit='$PMlimit' WHERE ID = $UserCatID"; # #-----[ ACTION: FIND ]------------------------------------------- # Icon: # #-----[ ACTION: ADD AFTER ]-------------------------------------- # PM Limit: # #-----[ ACTION: LOCATE ]----------------------------------------- # function AddUserCat() # #-----[ ACTION: FIND ]------------------------------------------- # { global $fSettings,$UserCatID,$Submit,$Level,$textColor,$Icon,$PostNeed; # #-----[ ACTION: REPLACE ]---------------------------------------- # { global $fSettings,$UserCatID,$Submit,$Level,$textColor,$Icon,$PostNeed,$PMlimit; # #-----[ ACTION: FIND ]------------------------------------------- # { $query = "INSERT INTO t_UserLevel (Level,textColor,Icon,PostNeed) VALUES('$Level','$textColor','$Icon','$PostNeed')"; # #-----[ ACTION: REPLACE ]---------------------------------------- # { $query = "INSERT INTO t_UserLevel (Level,textColor,Icon,PostNeed,PMlimit) VALUES('$Level','$textColor','$Icon','$PostNeed','$PMlimit')"; # #-----[ ACTION: FIND ]------------------------------------------- # Color: # #-----[ ACTION: ADD AFTER ]-------------------------------------- # PM Limit: # #-----[ ACTION: OPEN ]------------------------------------------- # pm.php # #-----[ ACTION: LOCATE ]----------------------------------------- # function ShowPM() # #-----[ ACTION: FIND ]------------------------------------------- # { UhOh($txt['PMLogin']);} else {?>

# #-----[ ACTION: REPLACE ]---------------------------------------- # { UhOh($txt['PMLogin']);} else { $query = "SELECT PMlimit FROM t_UserLevel WHERE ID='".$UserInfo["LevelID"]."'"; $result=mysql_query($query); if ($row=mysql_fetch_array($result)) $limit = $row[0]; else $limit = 20; ?>

# #-----[ ACTION: FIND ]------------------------------------------- # # #-----[ ACTION: ADD AFTER ]-------------------------------------- #
".$txt["PMInboxFull"]."

";?> # #-----[ ACTION: OPEN ]------------------------------------------- # english_lg.php # #-----[ ACTION: ADD ]-------------------------------------------- # $txt["PMInboxFull"] = "Your PM Inbox is full. Please delete some PMs to be able to receive new ones."; # #-----[ ACTION: SAVE & UPLOAD ]----------------------------------- # admin_functions.php pm.php english_lg.php # #----------------------------------------------------------------- # EOF