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
  #12  
Old 08-04-2000, 05:13 PM
Guest
 
Posts: n/a
Default

You could always add htmlspecialchars() when the user INSERTS the custom title, rather then waiting for it to be displayed. This would allow us admins to use HTML via the CP if we needed to. Or, you could add some sort of flag... (allowhtmlstatus)

Nice job on the hack though, saved me some time!
Reply With Quote
  #13  
Old 08-04-2000, 05:56 PM
Guest
 
Posts: n/a
Default

well, the 25 caharacters works great for me

<img src=http://www.m.com

that's 25 characters.
Reply With Quote
  #14  
Old 08-04-2000, 07:25 PM
Guest
 
Posts: n/a
Default

Quote:
Originally posted by Stallion
You could always add htmlspecialchars() when the user INSERTS the custom title, rather then waiting for it to be displayed. This would allow us admins to use HTML via the CP if we needed to. Or, you could add some sort of flag... (allowhtmlstatus)

Nice job on the hack though, saved me some time!
Stallion yes you could do this but then that would be going against the way John handles the other fields, like "username" so I chose to try to be consistent. Doing that way means you wouldn't have to edit all the files also.

[Edited by rangersfan on 08-04-2000 at 04:26 PM]
Reply With Quote
  #15  
Old 08-05-2000, 04:54 AM
Guest
 
Posts: n/a
Default

damn it, there are SOO many hacks I want to install, but for some reason I've actually had a life this week, not sure how that happened, but it did. I WILL get these damned things in!
Reply With Quote
  #16  
Old 08-05-2000, 11:37 AM
Guest
 
Posts: n/a
Default

okay, how would I switch this line to an "or" instead of an "and" statement?

Code:
if ( ($userposts >= $ctPost) && ( ($datejoined <= (time()-($ctTime*86400))) || ($ctTime==0)) )
Reply With Quote
  #17  
Old 08-05-2000, 04:36 PM
Guest
 
Posts: n/a
Default

So you want it to be ok for a user to change their title if they have say 100 posts or they have been registered 30 days but may have only 1 post?

Code:
if ( ($userposts >= $ctPost) || ( ($datejoined <= (time()-($ctTime*86400))) || ($ctTime==0)) )
Just change the '&&' to a '||'

in php you can actually use th word 'and' if you want but I stick to C style..
Reply With Quote
  #18  
Old 08-05-2000, 05:47 PM
Guest
 
Posts: n/a
Default

actually, I was thinking 1000 posts or 365 days

I have a lot of very active posters and a lot who read everything but post infrequently.

They are as valued as members as the ones who post like the board will die tomorrow
Reply With Quote
  #19  
Old 08-24-2000, 04:58 PM
Guest
 
Posts: n/a
Default

what part of code did i obviously forget to put in.I mean it doesn't remember the custom user title when i set it,so obviously it doesn't display it eather.It still shows the default one
Reply With Quote
  #20  
Old 08-24-2000, 05:01 PM
Guest
 
Posts: n/a
Default

You need to look at all the code that gets added to member.php and verify that it is correct.
Reply With Quote
  #21  
Old 08-25-2000, 04:04 AM
Guest
 
Posts: n/a
Default

that's where i screwed up
thnk you
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 10:36 PM.


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.05349 seconds
  • Memory Usage 2,287KB
  • Queries Executed 25 (?)
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
  • (3)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
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)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