PDA

View Full Version : Avatar Posts Hack


phumphries
15 Aug 2001, 13:17
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
26 Aug 2001, 15:15
What version does this hack work with?

phumphries
31 Aug 2001, 21:07
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
01 Sep 2001, 14:40
Where do I install this hack?

phumphries
04 Sep 2001, 14:29
avatar.php in the Admin directory.

I have clarified the instructions. Sorry about that.

LuBi
04 Sep 2001, 14:31
Found it, thanks a lot great hack.