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?
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---------//
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 != '' )
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)
Code: Select all
ALTER TABLE `phpbb_users` ADD `user_maxavatars` INT DEFAULT '5' NOT NULL AFTER `user_randomavatars` ;
Code: Select all
$poster_avatar = '';
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------------------//
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 != "" )
{
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----------------//
Code: Select all
message_die(GENERAL_ERROR, 'Could not update the avatars table', '', __LINE__, __FILE__, $sql);
}
Code: Select all
// Random Avatars By Post Count Mod //
}
else
{
message_die(GENERAL_ERROR, 'Maximum number of random avatars has been reached.');
}
//---------------END----------------//
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.