PDA

View Full Version : Avatar Posts Hack


phumphries
08-14-2001, 10:00 PM
This one is almost a template modification, but here it is since it hacks avatar.php.

When adding multiple avatars, you can use the "Check All" box to select them all, but you still have to type in the desired number of posts for each if "0" is not what you are after.

So, I added a little JavaScript to let you set them all to the same number. This is especially useful if you are importing all your old avatars from Freddie's original hack, and they are already organized into directories based on post numbers.

In avatar.php in the Admin directory, find the JavaScript section that contains:<script language="JavaScript">
<!--
function CheckAll()Add this function after the CheckAll function and before the CheckCheckAll function (it really does not matter where you add it; that is just were I put it in the SCRIPT block):function ChangeAll()
{
var textboxcount=0;
for (var i=0;i<document.form.elements.length;i++)
{
var e = document.form.elements[i];
if ((e.name != 'allavatarposts') && (e.type=='text'))
{
textboxcount++;
if (textboxcount % 2==0)
e.value = document.form.allavatarposts.value;
}
}
}Then find:<td align='center'><span class='tblhead'><b>Minimum Posts</b></span></td>";and change it to:<td align='center'><span class='tblhead'><b>Minimum Posts</b></span><br><input name='allavatarposts' type='text' size=8 value='0' onChange='ChangeAll();'></td>";to add the AllAvatarPosts text box to the table's title bar.

That is it. When you upload multiple avatars, you can now type in a value in the AllAvatarPosts box, then check the CheckAll check box, and all the avatars are uploaded with the same post threshold value.

LuBi
08-26-2001, 02:15 PM
What version does this hack work with?

phumphries
08-31-2001, 08:07 PM
I have 2.0.3, but it should work with any of the 2.0.x releases.

The hack just adds some JavaScript to the Avatar import page.

LuBi
09-01-2001, 01:40 PM
Where do I install this hack?

phumphries
09-04-2001, 01:29 PM
avatar.php in the Admin directory.

I have clarified the instructions. Sorry about that.

LuBi
09-04-2001, 01:31 PM
Found it, thanks a lot great hack.