######################################################## ## ## Hack Title: Remember "View topics from last x days" ## Hack Version: 1.0.0 ## Author: Christoph "Toxic" Hellings (toxic@freenet.de) ## Date Created: 08-31-02 ## Thread Location: http://www.tforumhacks.com/tforum/viewtopic.php?TopicID=1077 ## Working Example: ## Description: The setting "View topics from last x days" ## is stored in DB for each user. ## ## ## Installation Level: Intermediate ## Installation Time: 5 Minutes ## Files To Edit: 2 ## Edit Database: yes ## Included Files: none ## ######################################################## ## ## Installation/Author Notes: ## ## I think it works but no warranty... ## ######################################################## # #-----[ 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_users ADD viewlastdays MEDIUMINT NOT NULL default '0'; # #-----[ ACTION: OPEN ]------------------------------------------- # functions.php # #-----[ ACTION: FIND ]------------------------------------------- # $UserInfo["UserName"] = $row["UserName"]; # #-----[ ACTION: ADD AFTER ]-------------------------------------- # $UserInfo["viewlastdays"] = $row["viewlastdays"]; # #-----[ ACTION: OPEN ]------------------------------------------- # viewboard.php # #-----[ ACTION: FIND ]------------------------------------------- # if (!isset($dayview)) $dayview = 66; # #-----[ ACTION: REPLACE ]----------------------------------------- # if (!isset($dayview)) { if (!$CurrentUserInfo["viewlastdays"]) { $dayview = 66; $query = "UPDATE t_users SET viewlastdays=$dayview WHERE UserName='".AddSlash($CurrentUserInfo[UserName])."'"; if ($CurrentUserInfo[LevelID] != 99) mysql_query($query); } else $dayview = $CurrentUserInfo["viewlastdays"]; } else { $query = "UPDATE t_users SET viewlastdays=$dayview WHERE UserName='".AddSlash($CurrentUserInfo[UserName])."'"; if ($CurrentUserInfo[LevelID] != 99) mysql_query($query); } # #-----[ ACTION: SAVE & UPLOAD ]----------------------------------- # functions.php viewboard.php # #----------------------------------------------------------------- # EOF