08-04-2000, 05:08 AM
- Allow User to Change their titles if they are a Mod
- Allow User to Change their title based on how many posts they have
- Allow User to change their title based on how long they have been registered
- Limit length of text the user can enter
- Censor words that a user can use in their title (separate from the cuss word censor)
[I hope it all works ok as I flew through it and it seems to work on my board :) lemme know what is broke and I will fix it]
I am creating these docs in the spirit of you probably having other hacks installed and so your lines
may not look like my lines.
Do not put the quotations surrounding the information unless I explicitly tell you to do so. Also do
case INSENSITIVE searches to better your chances of actually finding what it is you are looking for.
Lines that begin with a "-" are for you to read, do not copy those lines. Code between tilde's ~~~~~
is for you to copy just dont copy the tildes! ~~~~~
[showthread.php]
- Search for :
"$usertitle=$userinfo[usertitle];"
- Replace with:
"$usertitle = htmlspecialchars($userinfo[usertitle]);"
- This is so that any html that a person may try to enter as their custom title will be shown as text.
[member.php]
(1)
- Find the FIRST instace of "SELECT parentemail"
- add ",usertitle,posts,joindate" right after "parentemail" on that line
(2)
- Search for "$DB_site->query("UPDATE user SET password="
- Go to the end of that line where it says "WHERE userid=$userid");"
- Add ",usertitle='$customtext',customtitle=$customtitle " before the "WHERE", make sure there is a space in front of the "WHERE"
- Don't add any QUOTES but do add the apostrophes!
(3)
- Find any instances of "$usertitle=$userinfo[usertitle];"
- Change to "$usertitle=htmlspecialchars($userinfo[usertitle]);"
(4)
- Paste the following code right underneath "require("global.php")"
~~~~~~~~~
// ###################### Start censortext #######################
function customcensortext($text)
{
global $ctcensorwords,$censorchar;
$censorword=explode(" ",$ctcensorwords);
while (list($key,$val)=each($censorword))
{
if ($val!="")
{
if (substr($val,0,1)=="{")
{
$val=substr($val,1,-1);
$text=eregi_replace("([^A-Za-z])".$val."([^A-Za-z])","\\1".repeatchar($censorchar,strlen($val))."\\2",$text);
}
else
{
$text=eregi_replace($val,repeatchar($censorchar,st rlen($val)),$text);
}
}
}
return $text;
}
~~~~~~~~~
(5)
- find "$getusername=$DB_site->query_first("SELECT username FROM user WHERE userid=$userid");"
- Change to "$getusername=$DB_site->query_first("SELECT username,posts FROM user WHERE userid=$userid");"
(6)
- find "$userid=verifyusername($username,$oldpassword);"
- Add this after it : "$posts = $getusername[posts];"
(7)
- Find the SECOND instance of : $signature=censortext($signature);
- Put this on the next line:
~~~~~~~~~
// Begin Custom Hack
$customtext = censortext($customtext);
$customtext = customcensortext($customtext);
$group=$DB_site->query_first("SELECT usertitle FROM usergroup WHERE usergroupid=$bbusergroupid");
if ($group[usertitle]=="")
{
$gettitle=$DB_site->query_first("SELECT title FROM usertitle WHERE minposts<=$posts+1 ORDER BY minposts DESC LIMIT 1");
$usertitle=$gettitle[title];
}
else
{
$usertitle=$group[usertitle];
}
if ($customtext == "")
{ $customtext = $usertitle; }
if ($customtext == $usertitle)
{
$customtitle = 0;
}
else
{
$customtitle = 1;
}
$customtext = addslashes($customtext);
// End Custom hack
(8)
- find "eval("echo dovars(\"".gettemplate("modifyprofile")."\");");"
- Add this code before it:
~~~~~~~~~
// Begin Custom User Text hack
// Set Variables if admin "forgets" to set options in the CP
if ($ctLength == "" || (isset($ctLength))==0) // Max Length
{ $ctLength = 20; }
if ($ctMod == "" || (isset($ctMod))==0) // Mod use text at all times?
{ $ctMod = "1"; }
if ($ctPost == "" || (isset($ctPost))==0) // Post Requirement to use Custom Text
{ $ctPost = 100; }
if ($ctTime == "" || (isset($ctTime))==0) // Time in days that a user must be a member before using custom text.
{ $ctTime = 30; }
$usertext = htmlspecialchars($userinfo[usertitle]);
$userposts = $userinfo[posts];
$datejoined = $userinfo[joindate];
$ctIsMod = 0;
if (($bbusergroupid == 5)||($bbusergroupid == 6)) // We Have An Admin or SuperMod
{
eval("\$customtext.= \"".gettemplate("customtext")."\";");
$ctIsMod = 1;
}
else if ($bbusergroupid >= 7) // we *might* have a mod
{
$ctTitle = $DB_site->query_first("SELECT title from usergroup where usergroupid = $bbusergroupid");
if ((eregi("moderator",$ctTitle[title]))&&($ctMod=="1"))
{
eval("\$customtext.= \"".gettemplate("customtext")."\";");
$ctIsMod = 1;
}
else // Not a mod
{
$ctIsMod = 0;
}
}
if ($ctIsMod==0) // Regular old Joe Schmoe User
{
if ( ($userposts >= $ctPost) && ( ($datejoined <= (time()-($ctTime*86400))) || ($ctTime==0)) )
{ eval("\$customtext.= \"".gettemplate("customtext")."\";"); }
}
// End Custom User Hack
~~~~~~~~~
[announcement.php]
- find "$usertitle=$userinfo[usertitle];"
- Change to "$usertitle=htmlspecialchars($userinfo[usertitle]);"
[forumdisplay.php]
- find "$announceusertitle=$announceuser[usertitle];"
- replace with "$announceusertitle=htmlspecialchars($announceuser[usertitle]);"
[printthread.php]
- find "$usertitle=$userinfo[usertitle];"
- replace with "$usertitle=htmlspecialchars($userinfo[usertitle]);"
[private.php] - Private Message Hack
- find "$usertitle=$userinfo[usertitle];"
- replace with "$usertitle=htmlspecialchars($userinfo[usertitle]);"
[admin/options.php]
- find "</ul>"
- Add Before that:
"<li><a href=\"#custom\">Custom User Title Options</a></li>"
-find
~~~~~~
</table>
<div align=\"center\"><center><table border=\"0\">
<tr>
~~~~~~
- Add this code Before the "</table>"
~~~~~~~~~~~~
<tr><td colspan=2><hr></td></tr>
<tr>
<td><a name=\"custom\"></a>
<b>ctLength</b></td>
<td> <input type=\"text\" size=\"35\" name=\"newoption[ctLength]\"
value=\"$ctLength\"></td>
</tr>
<tr><td colspan=2>Maximum amount of chars to allow users to enter for their
custom title</td></tr>
<tr><td>
<b>ctPost</b></td>
<td> <input type=\"text\" size=\"35\" name=\"newoption[ctPost]\"
value=\"$ctPost\"></td>
</tr>
<tr><td colspan=2>Number of posts a user must have before they can select
their own title</td></tr>
<tr><td>
<b>ctTime</b></td>
<td> <input type=\"text\" size=\"35\" name=\"newoption[ctTime]\"
value=\"$ctTime\"></td>
</tr>
<tr><td colspan=2>Number of days a user must be registered before they can
select their own title. Use 0 to disable this option.</td></tr>
<tr>
<td></a><b>ctMod</b></td>
<td>Yes<input type=\"radio\" name=\"newoption[ctMod]\" ".iif($ctMod==1,"checked","")." value=\"1\"> No <input type=\"radio\" name=
</tr>
<tr><td colspan=2>Allow Mods to change titles at all times?</td></tr>
<tr>
<td><b>censorwords</b></td>
<td><input type=\"text\" size=\"35\" name=\"newoption[ctcensorwords]\"
value=\"$ctcensorwords\"></td>
</tr>
<tr><td colspan=2>Type all words you want censored in the field below. Do
not use commas to separate words, just use spaces. For ex
<br>
Do not use quotation marks and make sure you use curly braces, not
parentheses, when specifying exact words. This takes the same options as the
censore words in the above sections.<br></td></tr>
<tr><td colspan=2><hr></td></tr>
~~~~~~~~~~~~~
(Templates)
[modifyprofile]
- Put "$customtext" where you want the field to show up. You will need to place it between an existing </tr> and
<tr>
[customtext]
- See post below for the code
[Edited by rangersfan on 08-04-2000 at 01:30 PM]
- Allow User to Change their title based on how many posts they have
- Allow User to change their title based on how long they have been registered
- Limit length of text the user can enter
- Censor words that a user can use in their title (separate from the cuss word censor)
[I hope it all works ok as I flew through it and it seems to work on my board :) lemme know what is broke and I will fix it]
I am creating these docs in the spirit of you probably having other hacks installed and so your lines
may not look like my lines.
Do not put the quotations surrounding the information unless I explicitly tell you to do so. Also do
case INSENSITIVE searches to better your chances of actually finding what it is you are looking for.
Lines that begin with a "-" are for you to read, do not copy those lines. Code between tilde's ~~~~~
is for you to copy just dont copy the tildes! ~~~~~
[showthread.php]
- Search for :
"$usertitle=$userinfo[usertitle];"
- Replace with:
"$usertitle = htmlspecialchars($userinfo[usertitle]);"
- This is so that any html that a person may try to enter as their custom title will be shown as text.
[member.php]
(1)
- Find the FIRST instace of "SELECT parentemail"
- add ",usertitle,posts,joindate" right after "parentemail" on that line
(2)
- Search for "$DB_site->query("UPDATE user SET password="
- Go to the end of that line where it says "WHERE userid=$userid");"
- Add ",usertitle='$customtext',customtitle=$customtitle " before the "WHERE", make sure there is a space in front of the "WHERE"
- Don't add any QUOTES but do add the apostrophes!
(3)
- Find any instances of "$usertitle=$userinfo[usertitle];"
- Change to "$usertitle=htmlspecialchars($userinfo[usertitle]);"
(4)
- Paste the following code right underneath "require("global.php")"
~~~~~~~~~
// ###################### Start censortext #######################
function customcensortext($text)
{
global $ctcensorwords,$censorchar;
$censorword=explode(" ",$ctcensorwords);
while (list($key,$val)=each($censorword))
{
if ($val!="")
{
if (substr($val,0,1)=="{")
{
$val=substr($val,1,-1);
$text=eregi_replace("([^A-Za-z])".$val."([^A-Za-z])","\\1".repeatchar($censorchar,strlen($val))."\\2",$text);
}
else
{
$text=eregi_replace($val,repeatchar($censorchar,st rlen($val)),$text);
}
}
}
return $text;
}
~~~~~~~~~
(5)
- find "$getusername=$DB_site->query_first("SELECT username FROM user WHERE userid=$userid");"
- Change to "$getusername=$DB_site->query_first("SELECT username,posts FROM user WHERE userid=$userid");"
(6)
- find "$userid=verifyusername($username,$oldpassword);"
- Add this after it : "$posts = $getusername[posts];"
(7)
- Find the SECOND instance of : $signature=censortext($signature);
- Put this on the next line:
~~~~~~~~~
// Begin Custom Hack
$customtext = censortext($customtext);
$customtext = customcensortext($customtext);
$group=$DB_site->query_first("SELECT usertitle FROM usergroup WHERE usergroupid=$bbusergroupid");
if ($group[usertitle]=="")
{
$gettitle=$DB_site->query_first("SELECT title FROM usertitle WHERE minposts<=$posts+1 ORDER BY minposts DESC LIMIT 1");
$usertitle=$gettitle[title];
}
else
{
$usertitle=$group[usertitle];
}
if ($customtext == "")
{ $customtext = $usertitle; }
if ($customtext == $usertitle)
{
$customtitle = 0;
}
else
{
$customtitle = 1;
}
$customtext = addslashes($customtext);
// End Custom hack
(8)
- find "eval("echo dovars(\"".gettemplate("modifyprofile")."\");");"
- Add this code before it:
~~~~~~~~~
// Begin Custom User Text hack
// Set Variables if admin "forgets" to set options in the CP
if ($ctLength == "" || (isset($ctLength))==0) // Max Length
{ $ctLength = 20; }
if ($ctMod == "" || (isset($ctMod))==0) // Mod use text at all times?
{ $ctMod = "1"; }
if ($ctPost == "" || (isset($ctPost))==0) // Post Requirement to use Custom Text
{ $ctPost = 100; }
if ($ctTime == "" || (isset($ctTime))==0) // Time in days that a user must be a member before using custom text.
{ $ctTime = 30; }
$usertext = htmlspecialchars($userinfo[usertitle]);
$userposts = $userinfo[posts];
$datejoined = $userinfo[joindate];
$ctIsMod = 0;
if (($bbusergroupid == 5)||($bbusergroupid == 6)) // We Have An Admin or SuperMod
{
eval("\$customtext.= \"".gettemplate("customtext")."\";");
$ctIsMod = 1;
}
else if ($bbusergroupid >= 7) // we *might* have a mod
{
$ctTitle = $DB_site->query_first("SELECT title from usergroup where usergroupid = $bbusergroupid");
if ((eregi("moderator",$ctTitle[title]))&&($ctMod=="1"))
{
eval("\$customtext.= \"".gettemplate("customtext")."\";");
$ctIsMod = 1;
}
else // Not a mod
{
$ctIsMod = 0;
}
}
if ($ctIsMod==0) // Regular old Joe Schmoe User
{
if ( ($userposts >= $ctPost) && ( ($datejoined <= (time()-($ctTime*86400))) || ($ctTime==0)) )
{ eval("\$customtext.= \"".gettemplate("customtext")."\";"); }
}
// End Custom User Hack
~~~~~~~~~
[announcement.php]
- find "$usertitle=$userinfo[usertitle];"
- Change to "$usertitle=htmlspecialchars($userinfo[usertitle]);"
[forumdisplay.php]
- find "$announceusertitle=$announceuser[usertitle];"
- replace with "$announceusertitle=htmlspecialchars($announceuser[usertitle]);"
[printthread.php]
- find "$usertitle=$userinfo[usertitle];"
- replace with "$usertitle=htmlspecialchars($userinfo[usertitle]);"
[private.php] - Private Message Hack
- find "$usertitle=$userinfo[usertitle];"
- replace with "$usertitle=htmlspecialchars($userinfo[usertitle]);"
[admin/options.php]
- find "</ul>"
- Add Before that:
"<li><a href=\"#custom\">Custom User Title Options</a></li>"
-find
~~~~~~
</table>
<div align=\"center\"><center><table border=\"0\">
<tr>
~~~~~~
- Add this code Before the "</table>"
~~~~~~~~~~~~
<tr><td colspan=2><hr></td></tr>
<tr>
<td><a name=\"custom\"></a>
<b>ctLength</b></td>
<td> <input type=\"text\" size=\"35\" name=\"newoption[ctLength]\"
value=\"$ctLength\"></td>
</tr>
<tr><td colspan=2>Maximum amount of chars to allow users to enter for their
custom title</td></tr>
<tr><td>
<b>ctPost</b></td>
<td> <input type=\"text\" size=\"35\" name=\"newoption[ctPost]\"
value=\"$ctPost\"></td>
</tr>
<tr><td colspan=2>Number of posts a user must have before they can select
their own title</td></tr>
<tr><td>
<b>ctTime</b></td>
<td> <input type=\"text\" size=\"35\" name=\"newoption[ctTime]\"
value=\"$ctTime\"></td>
</tr>
<tr><td colspan=2>Number of days a user must be registered before they can
select their own title. Use 0 to disable this option.</td></tr>
<tr>
<td></a><b>ctMod</b></td>
<td>Yes<input type=\"radio\" name=\"newoption[ctMod]\" ".iif($ctMod==1,"checked","")." value=\"1\"> No <input type=\"radio\" name=
</tr>
<tr><td colspan=2>Allow Mods to change titles at all times?</td></tr>
<tr>
<td><b>censorwords</b></td>
<td><input type=\"text\" size=\"35\" name=\"newoption[ctcensorwords]\"
value=\"$ctcensorwords\"></td>
</tr>
<tr><td colspan=2>Type all words you want censored in the field below. Do
not use commas to separate words, just use spaces. For ex
<br>
Do not use quotation marks and make sure you use curly braces, not
parentheses, when specifying exact words. This takes the same options as the
censore words in the above sections.<br></td></tr>
<tr><td colspan=2><hr></td></tr>
~~~~~~~~~~~~~
(Templates)
[modifyprofile]
- Put "$customtext" where you want the field to show up. You will need to place it between an existing </tr> and
<tr>
[customtext]
- See post below for the code
[Edited by rangersfan on 08-04-2000 at 01:30 PM]