[ALPHA] - Random Avatars Mod 1.1.0

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Post Reply
leseulun
Registered User
Posts: 31
Joined: Sun Jul 24, 2005 7:03 pm

So smooth I cant even tell its there???

Post by leseulun »

Okay guys I feel like I should be able to look at the code and figure out what the problem is here though I am not the best programmer. The options to manage random avatars doesnt show up in my control panel, in fact after making all the modifications everything appears exactly as it did prior to making the mods. I am runing 2.0.1.6 I installed fresh and here is I believe a complete list of mods

Autogroup (the one that does it when you reach a certain post)
Hyperions blog mod
Photo Album 2.0.53 © 2002-2003 Smartor
Volodymyr (CLowN) Skoryk's SP1 Addon 1.5.1
IdleVoid's Album Category Hierarchy 1.3.0
last 15 min mod
forum clock

Running BSRF skin

I have gone over the code and redone it at least 3 times now. The only thing I question is that there are a couple of finds that actually have multiple lines in the code and one that had "find and add after" that had additional code at the end of the line in question but I compared these anomolies to the original code I downloaded from PHPBB and they were not as a result of any mods I have done. Its probably something simple and stupid I am overlooking, anyone have any ideas? Let me know if there is anything in particular you would like to see, too much code to post everything.

thx,

-Shawn
leseulun
Registered User
Posts: 31
Joined: Sun Jul 24, 2005 7:03 pm

Descrep with code, is it related?

Post by leseulun »

Okay here is where I have found problems with the install

admin_users.php

You state find:
$avatar_filename = $user_id . $imgtype;

(This comes up twice in the instructions but have the same addition after it, recommend that your semantecs say find all instances and add after- removing redundant instruction and confusion)
**********
You state find:
if( $this_userdata['user_avatar_type'] == USER_AVATAR_UPLOAD && $this_userdata['user_avatar'] != "" )

(This comes up twice, I tried adding the subsequent code to one or the other and then to both with the addition of
} after the unlink command on the first instance (Otherwise error with unexpected ?> at end of code. Looking at the code I think you only intended the second occurance to be edited???)

--------------
usercp_avatar.php

you say find:
if ( $mode == 'editprofile' && $current_type == USER_AVATAR_UPLOAD
{

But what I find is this

if ( $mode == 'editprofile' && $current_type == USER_AVATAR_UPLOAD && $current_avatar != '' )
{

I added code after this statement as directed, just semantecs here I think?


----

usercp_register.php

You state find:
$unhtml_specialchars_replace

I find 5 instances of this in this code

I assumed you intended it to go after this first instance which actually looks like this

$unhtml_specialchars_replace = array('>', '<', '"', '&');

All other instances appear to be mid sentence and have to do with emailer>

*******

You state find

$allowsmilies = ( isset($HTTP_POST_VARS['allowsmilies'])

I find 2 instances both actually look like this-

$allowsmilies = ( isset($HTTP_POST_VARS['allowsmilies']) ) ? ( ($HTTP_POST_VARS['allowsmilies']) ? TRUE : 0 ) : $userdata['user_allowsmile'];

This appears to be symantecs you have the code in twice I believe you might want to put find both occurrances of and place after and may want to depict that there will probably be more code after that looks something like ? ( ($HTTP_POST_VARS['allowsmilies']) ? TRUE : 0 ) : $userdata['user_allowsmile'];

*****
You state find


You state find

$template->pparse('body');

This statement occurs twice in this code, after I modifed this and added before both of them I now get a radio in the profile asking if the user wants random avatars but even when yes is selected it doesnt work. Nothing in the ACP.


Any advice?
User avatar
mosheen
Registered User
Posts: 259
Joined: Wed Apr 06, 2005 12:16 am
Location: Asheville, NC
Contact:

Re: Descrep with code, is it related?

Post by mosheen »

leseulun wrote: admin_users.php

find:
$avatar_filename = $user_id . $imgtype;

(This comes up twice in the instructions but have the same addition after it, recommend that your semantecs say find all instances and add after- removing redundant instruction and confusion)
**********
You state find:
if( $this_userdata['user_avatar_type'] == USER_AVATAR_UPLOAD && $this_userdata['user_avatar'] != "" )

(This comes up twice, I tried adding the subsequent code to one or the other and then to both with the addition of
} after the unlink command on the first instance (Otherwise error with unexpected ?> at end of code. Looking at the code I think you only intended the second occurance to be edited???)

--------------
usercp_avatar.php

you say find:
if ( $mode == 'editprofile' && $current_type == USER_AVATAR_UPLOAD
{

But what I find is this

if ( $mode == 'editprofile' && $current_type == USER_AVATAR_UPLOAD && $current_avatar != '' )
{

I added code after this statement as directed, just semantecs here I think?


----

usercp_register.php

You state find:
$unhtml_specialchars_replace

I find 5 instances of this in this code

I assumed you intended it to go after this first instance which actually looks like this

$unhtml_specialchars_replace = array('>', '<', '"', '&');

All other instances appear to be mid sentence and have to do with emailer>

*******

You state find

$allowsmilies = ( isset($HTTP_POST_VARS['allowsmilies'])

I find 2 instances both actually look like this-

$allowsmilies = ( isset($HTTP_POST_VARS['allowsmilies']) ) ? ( ($HTTP_POST_VARS['allowsmilies']) ? TRUE : 0 ) : $userdata['user_allowsmile'];

This appears to be symantecs you have the code in twice I believe you might want to put find both occurrances of and place after and may want to depict that there will probably be more code after that looks something like ? ( ($HTTP_POST_VARS['allowsmilies']) ? TRUE : 0 ) : $userdata['user_allowsmile'];

*****
You state find


You state find

$template->pparse('body');

This statement occurs twice in this code, after I modifed this and added before both of them I now get a radio in the profile asking if the user wants random avatars but even when yes is selected it doesnt work. Nothing in the ACP.


Any advice?


Hi Shawn, thanks for trying it out... In regards to the issues listed above, I have gotten hammered by the mod validation guys (5 rejections so far) for mod syntax and EasyMod compatibility. My mod document looked quite a bit different a few versions ago. It was originally written with hand-modding in mind, using notepad or wordpad or something...

I now am following the standards that they require here. There are some posts in the development area (announcements or stickies) explaining the mod document standards that you have to follow.

Here are some examples (these aren't quotes): Mod documents have to be written from top to bottom... So, if there is a "find" statement for something that you see multiple appearances of in the phpbb page, just know that the mod document has to be written in order that the code happens. You should be able to start at the top of the document and work your way down. If something that you find multiple times in a page is only listed once in the mod doc, you can save yourself the confusion by following the directions in order, and not doing extra replacements or additions other than what is listed.

Another thing, is that instead of typing out a whole paragraph full of an sql statement as the "find" you can use:

$sql = " SELECT * from " . USERS_TABLE
WHERE
ORDER BY

As long as the find is listing the code accurately, this is acceptable. The real emphasis here, in the standards, seems to be EasyMod standard compliance. I haven't ever used EasyMod, I don't trust it. I use notepad or wordpad and have done a clean install of this mod a few times throughout the development process. Using Edit > Find in order of the document, top to bottom, works perfectly.

I would suggest taking admin/admin_users back to its original form and trying again. The following code is what sends the info to the template:

Code: Select all

#
#-----[ FIND ]---------------------------------
#
		if( file_exists(@phpbb_realpath('./../' . $board_config['avatar_path'])) && ($board_config['allow_avatar_upload'] == TRUE) )
		{


#
#-----[ BEFORE, ADD ]---------------------------------
#
// Random Avatars Mod //
if ( $this_userdata['user_randomavatars'] == 1 && $this_userdata['admin_randomavatars'] == 1 )
{
	$template->assign_block_vars('random_avatars', array() );
}
//---------END---------//

Here are lines 1179 to 1319 from my admin_users page:

Code: Select all

		$template->assign_vars(array(
			'USERNAME' => $username,
			'EMAIL' => $email,
			'YIM' => $yim,
			'ICQ' => $icq,
			'MSN' => $msn,
			'AIM' => $aim,
			'OCCUPATION' => $occupation,
			'INTERESTS' => $interests,
			'LOCATION' => $location,
			'WEBSITE' => $website,
			'SIGNATURE' => str_replace('<br />', "\n", $signature),
			'VIEW_EMAIL_YES' => ($viewemail) ? 'checked="checked"' : '',
			'VIEW_EMAIL_NO' => (!$viewemail) ? 'checked="checked"' : '',
			'HIDE_USER_YES' => (!$allowviewonline) ? 'checked="checked"' : '',
			'HIDE_USER_NO' => ($allowviewonline) ? 'checked="checked"' : '',
			'NOTIFY_PM_YES' => ($notifypm) ? 'checked="checked"' : '',
			'NOTIFY_PM_NO' => (!$notifypm) ? 'checked="checked"' : '',
			'POPUP_PM_YES' => ($popuppm) ? 'checked="checked"' : '',
			'POPUP_PM_NO' => (!$popuppm) ? 'checked="checked"' : '',
			'ALWAYS_ADD_SIGNATURE_YES' => ($attachsig) ? 'checked="checked"' : '',
			'ALWAYS_ADD_SIGNATURE_NO' => (!$attachsig) ? 'checked="checked"' : '',
			'NOTIFY_REPLY_YES' => ( $notifyreply ) ? 'checked="checked"' : '',
			'NOTIFY_REPLY_NO' => ( !$notifyreply ) ? 'checked="checked"' : '',
			'ALWAYS_ALLOW_BBCODE_YES' => ($allowbbcode) ? 'checked="checked"' : '',
			'ALWAYS_ALLOW_BBCODE_NO' => (!$allowbbcode) ? 'checked="checked"' : '',
			'ALWAYS_ALLOW_HTML_YES' => ($allowhtml) ? 'checked="checked"' : '',
			'ALWAYS_ALLOW_HTML_NO' => (!$allowhtml) ? 'checked="checked"' : '',
			'ALWAYS_ALLOW_SMILIES_YES' => ($allowsmilies) ? 'checked="checked"' : '',
			'ALWAYS_ALLOW_SMILIES_NO' => (!$allowsmilies) ? 'checked="checked"' : '',
			'AVATAR' => $avatar,

// Random Avatars Mod //
			'RANDOM_AVATARS_YES' => ( $random_avatars ) ? 'checked="checked"' : '',
			'RANDOM_AVATARS_NO' => ( !$random_avatars ) ? 'checked="checked"' : '',
			'ADMIN_RANDOM_AVATARS_YES' => ( $admin_random_avatars ) ? 'checked="checked"' : '',
			'ADMIN_RANDOM_AVATARS_NO' => ( !$admin_random_avatars ) ? 'checked="checked"' : '',
			'RANDOM_AVATAR_GALLERY' => $random_avatar_gallery,
//--------END---------//

			'LANGUAGE_SELECT' => language_select($user_lang),
			'TIMEZONE_SELECT' => tz_select($user_timezone),
			'STYLE_SELECT' => style_select($user_style, 'style'),
			'DATE_FORMAT' => $user_dateformat,
			'ALLOW_PM_YES' => ($user_allowpm) ? 'checked="checked"' : '',
			'ALLOW_PM_NO' => (!$user_allowpm) ? 'checked="checked"' : '',
			'ALLOW_AVATAR_YES' => ($user_allowavatar) ? 'checked="checked"' : '',
			'ALLOW_AVATAR_NO' => (!$user_allowavatar) ? 'checked="checked"' : '',
			'USER_ACTIVE_YES' => ($user_status) ? 'checked="checked"' : '',
			'USER_ACTIVE_NO' => (!$user_status) ? 'checked="checked"' : '', 
			'RANK_SELECT_BOX' => $rank_select_box,

			'L_USERNAME' => $lang['Username'],
			'L_USER_TITLE' => $lang['User_admin'],
			'L_USER_EXPLAIN' => $lang['User_admin_explain'],
			'L_NEW_PASSWORD' => $lang['New_password'], 
			'L_PASSWORD_IF_CHANGED' => $lang['password_if_changed'],
			'L_CONFIRM_PASSWORD' => $lang['Confirm_password'],
			'L_PASSWORD_CONFIRM_IF_CHANGED' => $lang['password_confirm_if_changed'],
			'L_SUBMIT' => $lang['Submit'],
			'L_RESET' => $lang['Reset'],
			'L_ICQ_NUMBER' => $lang['ICQ'],
			'L_MESSENGER' => $lang['MSNM'],
			'L_YAHOO' => $lang['YIM'],
			'L_WEBSITE' => $lang['Website'],
			'L_AIM' => $lang['AIM'],
			'L_LOCATION' => $lang['Location'],
			'L_OCCUPATION' => $lang['Occupation'],
			'L_BOARD_LANGUAGE' => $lang['Board_lang'],
			'L_BOARD_STYLE' => $lang['Board_style'],
			'L_TIMEZONE' => $lang['Timezone'],
			'L_DATE_FORMAT' => $lang['Date_format'],
			'L_DATE_FORMAT_EXPLAIN' => $lang['Date_format_explain'],
			'L_YES' => $lang['Yes'],
			'L_NO' => $lang['No'],
			'L_INTERESTS' => $lang['Interests'],
			'L_ALWAYS_ALLOW_SMILIES' => $lang['Always_smile'],
			'L_ALWAYS_ALLOW_BBCODE' => $lang['Always_bbcode'],
			'L_ALWAYS_ALLOW_HTML' => $lang['Always_html'],
			'L_HIDE_USER' => $lang['Hide_user'],
			'L_ALWAYS_ADD_SIGNATURE' => $lang['Always_add_sig'],
			
			'L_SPECIAL' => $lang['User_special'],
			'L_SPECIAL_EXPLAIN' => $lang['User_special_explain'],
			'L_USER_ACTIVE' => $lang['User_status'],
			'L_ALLOW_PM' => $lang['User_allowpm'],
			'L_ALLOW_AVATAR' => $lang['User_allowavatar'],

// Random Avatars Mod //
			'L_RANDOM_AVATARS' => $lang['Use_random_avatars'],
			'L_RANDOM_AVATAR_GALLERY' => $lang['Random_avatar_gallery'],
			'L_ALL_AVATAR_TYPES' => $lang['All_avatar_types'],
			'L_ADMIN_RANDOM_AVATARS' => $lang['Random_avatars_override'],
//--------END---------//
			
			'L_AVATAR_PANEL' => $lang['Avatar_panel'],
			'L_AVATAR_EXPLAIN' => $lang['Admin_avatar_explain'],
			'L_DELETE_AVATAR' => $lang['Delete_Image'],
			'L_CURRENT_IMAGE' => $lang['Current_Image'],
			'L_UPLOAD_AVATAR_FILE' => $lang['Upload_Avatar_file'],
			'L_UPLOAD_AVATAR_URL' => $lang['Upload_Avatar_URL'],
			'L_AVATAR_GALLERY' => $lang['Select_from_gallery'],
			'L_SHOW_GALLERY' => $lang['View_avatar_gallery'],
			'L_LINK_REMOTE_AVATAR' => $lang['Link_remote_Avatar'],

			'L_SIGNATURE' => $lang['Signature'],
			'L_SIGNATURE_EXPLAIN' => sprintf($lang['Signature_explain'], $board_config['max_sig_chars'] ),
			'L_NOTIFY_ON_PRIVMSG' => $lang['Notify_on_privmsg'],
			'L_NOTIFY_ON_REPLY' => $lang['Always_notify'],
			'L_POPUP_ON_PRIVMSG' => $lang['Popup_on_privmsg'],
			'L_PREFERENCES' => $lang['Preferences'],
			'L_PUBLIC_VIEW_EMAIL' => $lang['Public_view_email'],
			'L_ITEMS_REQUIRED' => $lang['Items_required'],
			'L_REGISTRATION_INFO' => $lang['Registration_info'],
			'L_PROFILE_INFO' => $lang['Profile_info'],
			'L_PROFILE_INFO_NOTICE' => $lang['Profile_info_warn'],
			'L_EMAIL_ADDRESS' => $lang['Email_address'],
			'S_FORM_ENCTYPE' => $form_enctype,

			'HTML_STATUS' => $html_status,
			'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="../' . append_sid("faq.$phpEx?mode=bbcode") . '" target="_phpbbcode">', '</a>'), 
			'SMILIES_STATUS' => $smilies_status,

			'L_DELETE_USER' => $lang['User_delete'],
			'L_DELETE_USER_EXPLAIN' => $lang['User_delete_explain'],
			'L_SELECT_RANK' => $lang['Rank_title'],

			'S_HIDDEN_FIELDS' => $s_hidden_fields,
			'S_PROFILE_ACTION' => append_sid("admin_users.$phpEx"))
		);

// Random Avatars Mod //
if ( $this_userdata['user_randomavatars'] == 1 && $this_userdata['admin_randomavatars'] == 1 )
{
	$template->assign_block_vars('random_avatars', array() );
}
//---------END---------//

		if( file_exists(@phpbb_realpath('./../' . $board_config['avatar_path'])) && ($board_config['allow_avatar_upload'] == TRUE) )
		{
			if ( $form_enctype != '' )
Interested in Random Avatars for your board? Click here
Need to Enable Avatars By Post Count? Click here
Want HTML in your polls? Click here
leseulun
Registered User
Posts: 31
Joined: Sun Jul 24, 2005 7:03 pm

much thanks

Post by leseulun »

I appreciate you taking the time to look through that. I didnt realize but the radio in the profile does work, you just have to turn it on immediately submit and then add avatars submitting betwen each one. After each avatar is submitted it kicks me back to the main forum rather than the profile but easy enough to address on my side. So basically I have been able to give it a test run and I have to say in between what I am seeing and what I have read, this is an awesome mod, good work! I appreciate you making me aware of the flow of the mod file. I have never used easy mode before either and dont trust it especially as I add more and more mods to my board. This is actually the first mod I have run across that had mulitple instances of the find statement and I wasnt aware of the flow. I'm sure the ACP wil be working and everything will be fine after I do this again with your direction in mind and your code for reference.

Thanks again!

-Shawn
User avatar
mosheen
Registered User
Posts: 259
Joined: Wed Apr 06, 2005 12:16 am
Location: Asheville, NC
Contact:

Post by mosheen »

Hey, no sweat! If you still have trouble with the admin page, I can take a look at it for you, or you can temporarily bypass the admin page, just change "admin_randomavatars" to 1 in the users table in the database for everyone.

JAmes
leseulun
Registered User
Posts: 31
Joined: Sun Jul 24, 2005 7:03 pm

????

Post by leseulun »

Well I redid it all again as suggested and the mod process went smooth. I think this is the way I did it the first time but I must of mixed up a before/after and then I got so caught up trying to find out why things didnt work I made things more complicated then they needed to be. Well essentially after doing this mod again for the 6th time I have retained my random avatar functionality, however, still no control in the ACP. The only place there is a configuration is in the users profile. My Admin_users.php looks EXACTLY like yours does except your line 1179 is my 1146 so if anything you probably have more mods than I do on this page. Is there anyway there is something in the template causing this? Also I was hoping you could help me on a simpe issue/question. I have the Hyperion Blog Mod and it only displays the current avatar(Last avatar chosen) and so I was wondering if adding the ", user_randomavatars = $random_avatars" where applicable should be all I need to resolve this issue?

I wonder if this thing will frown upon me posting 1328 lines of code, one way to find out; here is my admin_users-..

*** Edit*** I removed code, it was making this page of these posts unfriendly, I can work with you via email if you still have interest, let me know****

-Shawn
Last edited by leseulun on Mon Aug 08, 2005 11:49 am, edited 1 time in total.
leseulun
Registered User
Posts: 31
Joined: Sun Jul 24, 2005 7:03 pm

frowned upon

Post by leseulun »

Okay so I guess it didnt really like me trying to post that much code. Let me know if there is some specifics you need if relevant.

thx

-Shawn
leseulun
Registered User
Posts: 31
Joined: Sun Jul 24, 2005 7:03 pm

actually

Post by leseulun »

Redoing this code broke my functionality I did have, I reverted back to the code that worked. I will have to re-review the changes. Basically I just added extra code where it probably didnt belong on lines with multiple occurances. With this code as is I have no ACP and when I add a new pic to the gallary it just adds the current pic again and when I remove it I get a red X. using .015 code so that shouldnt be an issue. I would just revert back to the originals on all 10 files but having my blog and photo album work take precedance. I dunno, its almost 2am here, I will have to try again tomorrow.
niksa
Registered User
Posts: 612
Joined: Mon Sep 08, 2003 7:20 pm
Location: Future birthplace of James T. Kirk
Contact:

Post by niksa »

This looks like a really nice mod, and I'm pretty eager to try it out. I also am looking at your other mod, the one that restricts depending on post count.

I have a question/comment:
What would be really useful (to me anyway) is the ability increase "random avatar slots" depending on their post count. But more specifically, set it almost like a rank. The intro (0 post) level has 1 avatar. My next level might be 25 posts, where they get a second avatar. Then 50 posts give them a third, and by the time they have 500 posts, they might have 10 avatars that will cycle randomly.

Is this possible to currently do with the mod, or is it planned? 8)
Narc0sis
Registered User
Posts: 662
Joined: Tue Apr 09, 2002 12:59 am
Contact:

Post by Narc0sis »

niksa wrote: This looks like a really nice mod, and I'm pretty eager to try it out. I also am looking at your other mod, the one that restricts depending on post count.

I have a question/comment:
What would be really useful (to me anyway) is the ability increase "random avatar slots" depending on their post count. But more specifically, set it almost like a rank. The intro (0 post) level has 1 avatar. My next level might be 25 posts, where they get a second avatar. Then 50 posts give them a third, and by the time they have 500 posts, they might have 10 avatars that will cycle randomly.

Is this possible to currently do with the mod, or is it planned? 8)


thats a pretty awesome idea
User avatar
mosheen
Registered User
Posts: 259
Joined: Wed Apr 06, 2005 12:16 am
Location: Asheville, NC
Contact:

Post by mosheen »

leseulun, I will take a look at this and see what I can see with the code that came through in your post. If you want, e-mail me the page. It sounds like something is not right though... The test forum where the mod is on display is virgin. This is really the only thing that is installed.

Just curious, what version of phpBB are you running?

Also, send me a link to the mod you are referring to and I will post the mod code to get it to show random avs.

niksa, excellent idea. I'll see what I can do.
leseulun
Registered User
Posts: 31
Joined: Sun Jul 24, 2005 7:03 pm

details

Post by leseulun »

I have more details on the initial post on page 5 but I am running PHPBB2.0.16 fresh install with some mods as indicated on page 5. The mod in question is not finished either but it has worked great and is by far the best blog mod I have found for PHPBB http://www.phpbb.com/phpBB/viewtopic.ph ... c&start=15 Hyperion did a great job! I also agree with Niksa, having more random avatar ability based on Rank is an awesome idea! I dont have your email address to email to and I cant get to your webpage from here, I had to use a public proxy to download your script. I will pm you my email address, shoot me a message and I will forward you the relevant files. Its above and beyond though, I have no expectations but appreciate any help.

-Shawn
User avatar
mosheen
Registered User
Posts: 259
Joined: Wed Apr 06, 2005 12:16 am
Location: Asheville, NC
Contact:

*** Random Avatar Count By Post Count (add-on) ***

Post by mosheen »

OK... Here is what I have come up with. It's nothing fancy, I promise. Everything is hard-coded into the page. There is no admin-control-panel access.

This is an add-on to the Random Avatars Mod , please make sure to have the latest version installed.

Notice that there is a field that needs to be added to your phpbb_users table.

=================================================

[SQL]
(note: the DEFAULT '5' should be changed to whatever number you want to initially set everyone at. Once the viewtopic page is run, each user's maxavatar number will be updated by their post count.)

Code: Select all

ALTER TABLE `phpbb_users` ADD `user_maxavatars` INT DEFAULT '5' NOT NULL AFTER `user_randomavatars` ;

[OPEN]
viewtopic.php



[FIND]

Code: Select all

$poster_avatar = '';


[AFTER, ADD]

Code: Select all

// Random Avatars By Post Count Mod //
//
/////// note that each level of posts vs. avatar count should be changed below //
//
// if ( $postrow[$i]['user_posts'] >= 100 && $postrow[$i]['user_maxavatars'] < 20 )
//
/////// this says: IF this user has more than 100 posts and their max_avatars is less than 20... //
//
// $sql = "UPDATE " . USERS_TABLE . " SET user_maxavatars = 20 WHERE user_id = " . $postrow[$i]['user_id'];
//
/////// THEN change their max_avatars to 20. //
//
$sql = "";

if ( $postrow[$i]['user_randomavatars'] == 1 && $postrow[$i]['admin_randomavatars'] == 1 )
{
	if ( $postrow[$i]['user_posts'] >= 100 && $postrow[$i]['user_maxavatars'] < 20 )
	{
		$sql = "UPDATE " . USERS_TABLE . " SET user_maxavatars = 20 WHERE user_id = " . $postrow[$i]['user_id'];
	}
	else if ( $postrow[$i]['user_posts'] >= 75 && $postrow[$i]['user_maxavatars'] < 15 )
	{
		$sql = "UPDATE " . USERS_TABLE . " SET user_maxavatars = 15 WHERE user_id = " . $postrow[$i]['user_id'];
	}
	else if ( $postrow[$i]['user_posts'] >= 50 && $postrow[$i]['user_maxavatars'] < 10 )
	{
		$sql = "UPDATE " . USERS_TABLE . " SET user_maxavatars = 10 WHERE user_id = " . $postrow[$i]['user_id'];
	}
	else if ( $postrow[$i]['user_posts'] >= 25 && $postrow[$i]['user_maxavatars'] < 5 )
	{
		$sql = "UPDATE " . USERS_TABLE . " SET user_maxavatars = 5 WHERE user_id = " . $postrow[$i]['user_id'];
	}

	if ( $sql != "" )
	{
		$result = $db->sql_query($sql);
	}
}
//-------------END------------------//

[OPEN]
includes/usercp_register.php


[FIND]

Code: Select all

// Random Avatars Mod //
if ( $userdata['user_randomavatars'] == 1 && $userdata['admin_randomavatars'] == 1 ) 
{
	if ( $user_avatar_upload != "" || $user_avatar_remoteurl != "" || $user_avatar_local != "" )
	{

[AFTER, ADD]

Code: Select all

// Random Avatars By Post Count Mod //
$sql = "SELECT av_id FROM " . AVATARS_TABLE . " WHERE user_id = '$user_id' ";
$result = $db->sql_query($sql);
$av_count = $db->sql_numrows($result);

if ( $av_count < $userdata['user_maxavatars'] )
{
//---------------END----------------//

[FIND]

Code: Select all

message_die(GENERAL_ERROR, 'Could not update the avatars table', '', __LINE__, __FILE__, $sql);
		}

[AFTER, ADD]

Code: Select all

// Random Avatars By Post Count Mod //
}
else
{
	message_die(GENERAL_ERROR, 'Maximum number of random avatars has been reached.');
}
//---------------END----------------//
Interested in Random Avatars for your board? Click here
Need to Enable Avatars By Post Count? Click here
Want HTML in your polls? Click here
User avatar
mosheen
Registered User
Posts: 259
Joined: Wed Apr 06, 2005 12:16 am
Location: Asheville, NC
Contact:

Post by mosheen »

Just clarification, for anyone else experiencing this problem:

The random avatars controls and gallery should show on the ACP > User Management page, NOT the General Configuration page.

Anyone who has installed the mod add-on listed above, please post your results. I'm curious as to whether it works or not :twisted:
naked604boy
Registered User
Posts: 110
Joined: Wed Jul 06, 2005 6:32 pm

Re: [ALPHA] - Random Avatars Mod 1.0.15

Post by naked604boy »

mosheen wrote: MOD Title: Random Avatars Mod
MOD Description: Allows users to upload multiple avatars and will cycle through, randomly choosing an avatar for each of their posts.
MOD Version: 1.0.15 (7/23/2005)

MOD Download: http://test.medinaline.net/Random_Avata ... 1.0.15.mod
Update Code: Random_Avatars_MOD_update.mod
Last Stable version:http://test.medinaline.net/Random_Avata ... 1.0.13.mod

Demo Board: http://test.medinaline.net
Demo Username: james(admin) OR test1 OR sample OR not_random
Demo Password: james OR test1 OR sample OR not_random

NOTES:

Current status:

1.0.15
fixed a minor bug in the new user register page, which was showing the avatar control panel to new users. Thanks, Narc0sis for finding it! The update code is listed above, and also in a post over on page 5 of this thread.

I have upgraded the test board to phpBB 2.0.17 with full compatability. No changes required.

1.0.13
changed all occurances of "<br>" to "<br />" and changed all occurances of "$i = $i+1;" to "$i++;"

the update code is over in page 4 of this thread

1.0.11
changed avatar from gallery handling to use the $board_config['avatar_gallery_path'] instead of hard coding "images/avatars/gallery" into the pages.

the update code is over in page 4 of this thread

1.0.9
Fixed a bug for Internet Explorer users, the random avatar gallery was not properly wrapping to the next line and was pulling the whole page out of shape.

The update code is in a post over in page 3 of this thread.

It is also "Welcome & Avatar on Index mod" compatible now. There is a post on page 4 of this thread with the particulars.

1.0.7
The mod doc has been completely re-written, a more EasyMod friendly (hopefully) syntax is used. I have added a new feature, more like a bug fix as well as eliminating quite a few lines of unnecessary code.

The full ACP funtionality is now there, including adding / deleting avatars to / from the users' random avatar pool.

The user can now choose avatars from the site avatar gallery and they will be automatically added into the random avatars pool.

Previously, if you deleted the most recent avatar from the random pool, it would also remove it from the users table, leaving the user avatar field blank. Now, after deleting the file, deleting the entry from the avatars table, it checks the avatars table for the newest avatar, and updates the users table with that. It works for all types of avatars.

I installed version 1.0.5 directly from the "from scratch" mod doc that I wrote and everything works like a dream! The only change in 1.0.7 is to the admin/admin_users.php page. I completely rewrote that section today. This may be the final release before mod validation.



hi you have a nice mods, i was wondering if you know a code to display 10 random avatars with user's name below the avatar. im trying to make a page in php that display 10 users random avatars..


thanks


thanks
Post Reply

Return to “[2.0.x] MODs in Development”