PDA

View Full Version : Individual Textfield size for each user


T?Pau
02-10-2002, 10:00 PM
Have you ever wanted to change the size of the textfield when you post a message? Now it is possible....
With this Hack every user can have a custom textfield size.
Both width and hight can simply be changed by specifying your favorit values in your Options Menu.
For a demo click here (http://www.10-vorne.info)

Many thanks to Thomas"cptza" (http://www.fan-fiction.info) woh helped me a lot, to finish this hack :)

You need to edit 2 files and 3 templates

First open admin/functions.php
find

if (eregi("MSIE",$HTTP_USER_AGENT)) { // browser is IE
return "70";

and replace it with

// ###################### Start gettextareawidth #######################
function gettextareawidth () {
global $DB_site,$HTTP_USER_AGENT, $bbuserinfo;
$textareacols=$DB_site->query_first("SELECT textareacols FROM user WHERE userid='$userid'");
$textarearows=$DB_site->query_first("SELECT textarearows FROM user WHERE userid='$userid'");

if ($bbuserinfo[textareacols]!=0) {
return "$bbuserinfo[textareacols]";
}if ($bbuserinfo[textarearows]!=20) {
return "$bbuserinfo[textarearows]";
}elseif (eregi("MSIE",$HTTP_USER_AGENT)) { // browser is IE
return "70";


In member.php
find

if ($bbuserinfo[showsignatures]) {
$showsignatureschecked="checked";
$showsignaturesnotchecked="";
} else {
$showsignatureschecked="";
$showsignaturesnotchecked="checked";
}

And under it insert

// textarea Begin
$textareacols=$DB_site->query_first("SELECT textareacols FROM user WHERE userid='$userid'");
$textarearows=$DB_site->query_first("SELECT textarearows FROM user WHERE userid='$userid'");

// Textarea End
find

$DB_site->query("UPDATE user
SET ".$updatestyles."adminemail='$adminemail',
showemail='$showemail',invisible='$invisible',cook ieuser='$cookieuser',
maxposts='".addslashes($umaxposts)."',daysprune='".addslashes($prunedays)."',
timezoneoffset='".addslashes($timezoneoffset)."',emailnotification='$emailnotification',
startofweek='".addslashes($startofweek)."',options='$options',receivepm='$receivepm',
emailonpm='$emailonpm',pmpopup='$pmpopup',usergrou pid='$bbuserinfo[usergroupid]',
nosessionhash='$nosessionhash'
WHERE userid='$bbuserinfo[userid]'");

and replace it with

$DB_site->query("UPDATE user
SET ".$updatestyles."adminemail='$adminemail',
showemail='$showemail',invisible='$invisible',cook ieuser='$cookieuser',
maxposts='".addslashes($umaxposts)."',daysprune='".addslashes($prunedays)."',
timezoneoffset='".addslashes($timezoneoffset)."',emailnotification='$emailnotification',
startofweek='".addslashes($startofweek)."',options='$options',receivepm='$receivepm',
emailonpm='$emailonpm',pmpopup='$pmpopup',usergrou pid='$bbuserinfo[usergroupid]',
nosessionhash='$nosessionhash',textareacols='$text areacols',textarearows='$textarearows'
WHERE userid='$bbuserinfo[userid]'");


in your Admin CP edit the templates newreply and newthread
Find

<textarea name="message" rows="20" cols="$textareacols" wrap="virtual" tabindex="2">$message</textarea>

and replace it with

<textarea name="message" rows="$bbuserinfo[textarearows]" cols="$textareacols" wrap="virtual" tabindex="2">$message</textarea>


Edit modifyoptions template
insert

<tr><td bgcolor="#1C5780"><normalfont><b>Textarea Size:</b></normalfont><br>
<smallfont>Edit the Size of the textarea.
$userinfo[textareacols]</smallfont></td>
<td bgcolor="#1C5780"><normalfont>

<smallfont>width:</smallfont><input type="text" size="3" value="$bbuserinfo[textareacols]" name="textareacols" class="bginput"> <smallfont> hight:</smallfont><input type="text" size="3" value="$bbuserinfo[textarearows]" name="textarearows" class="bginput">
</normalfont></td></tr>

were you want it to appear.

Lesane
02-11-2002, 01:00 PM
Nice but i'm not gonna use it for my forums because people will gonna abuse it.

One comment: https://vborg.vbsupport.ru/showthread.php?s=&threadid=31969 ;)