Version: , by (Guest)
Developer Last Online: Jan 1970
Version: Unknown
Rating:
Released: 08-04-2000
Last Update: Never
Installs: 0
No support by the author.
- 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]
Code:
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,strlen($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]
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
what seems to be missing is the template for $customtext
it's called for several times in the code, but I don't see it anywhere.
I added this hack, couldn't figger out what was missing because it wouldn't show up and that seems to be what it is.
also, a coupla things in your instructions that don't seem to be quite right (or at least they are giving *me* trouble):
[*]there are 2 calls to replace the same thing in both showthread.php and announcement.php[*]you seem to be missing the ">" that the end of the code to add in admin/options.php[*]Steps 3 and 8 in the member.php both ask for something to be added to "$DB_site->query("UPDATE user SET password". I can only find one instance of this in member.php so I assume both are added to that same instance. Does the order matter?
I think that about covers it. It's gonna be great once I can use it. Thank you for all the hard work
Step 3 and Step 8 both refer to the same line and I put both changes in Step 3 and Deleted 8.
Second call to change showthread was a duplicate change, ignore it. The anouncement.php and forumdisplay.php changes are not correct. Verify yours and let me know if it works now?
okay, one small thing that will apply to only certain people.
If you, like me, had the star ranks (or any other image code) set up in the user titles rather than by using the star hack that's buried deep in here somewhere, do NOT replace all the "$usertitle=$userinfo[usertitle];" strings in your files, elsewise any html you have in your user titles will be stripped, too.
The way I'm keeping bad code out is by changing the text box in the customtext template to accept a max of 25 characters.