Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Details »»

Version: , by (Guest)
Developer Last Online: Jan 1970 Show Printable Version Email this Page

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.

Comments
  #2  
Old 08-04-2000, 07:58 AM
Guest
 
Posts: n/a
Default

wow!

that was FAST!
Reply With Quote
  #3  
Old 08-04-2000, 09:39 AM
Guest
 
Posts: n/a
Default

um

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
Reply With Quote
  #4  
Old 08-04-2000, 02:09 PM
Guest
 
Posts: n/a
Default

Oh yeah I said I did it fast and I was tired when I posted I did forget to inculde the template. oops.

Here is the template "customtext"
http://www.hedgehogwheels.com/customtext.txt

I have fixed the anomolies in the instructions.

The ">" was missing in options.php

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?
Reply With Quote
  #5  
Old 08-04-2000, 03:20 PM
Guest
 
Posts: n/a
Default

absolutely perfect!

thanx for a great hack!
Reply With Quote
  #6  
Old 08-04-2000, 03:53 PM
Guest
 
Posts: n/a
Default

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.
Reply With Quote
  #7  
Old 08-04-2000, 04:10 PM
Guest
 
Posts: n/a
Default

As i said before, the stars in titles kinda has to leave.

If you dont put in the htmlspecialchars function people can still fit a <img src=> line in under 25 chars.
Reply With Quote
  #8  
Old 08-04-2000, 04:25 PM
Guest
 
Posts: n/a
Default

Quote:
Originally posted by rangersfan
[usertext]
- See post below for the code
I think that you mean:
Code:
[customtext]
Right?
Reply With Quote
  #9  
Old 08-04-2000, 04:30 PM
Guest
 
Posts: n/a
Default

Yeah
Reply With Quote
  #10  
Old 08-04-2000, 04:36 PM
Guest
 
Posts: n/a
Default

You replied even before I have finished cutting and pasting the hack!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:04 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04080 seconds
  • Memory Usage 2,283KB
  • Queries Executed 23 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete