Code: Selecteer alles
##############################################################
## MOD Title: Avatar Limits by Role and Post Count
## MOD Author: drathbun < drathbun@forumtopics.com > (Dave Rathbun)
## MOD Description:
## This mod allows you to do several things
## 1. Restrict avatars to users that exceed a certain post count
## This allows you to "reward" active users by allowing them to
## select an avatar. No avatar selection is available on the
## registration screen. If desired, simply set the post count
## limit (see below) to 1 and all users can select an avatar.
## 2. Provide specialized (and restricted) avatars for Moderators
## Create any number of folders, following a specified naming
## convention, and place moderator-only avatars in that location.
## Normal users will not be able to see these avatars during the
## selection process. Administrators are always able to see all
## avatars. Note: I don't make any provision for user uploaded
## avatars. If you allow your users to access remote or uploaded
## avatars then they can select whatever they want. That's outside
## the scope for this mod, which deals with local hosted avatars
## only. I don't see any need to change the code to support
## other types of avatars.
## 3. Provide specialized (and restricted) avatars for Administrators.
## Same logic as above.
##
## The net result of this mod is that your users will have to attain
## a certain post count before they can select an avatar, while moderators
## and administrators can always have one. You can also provide special
## avatars that only moderators (or admins) can see.
##
## No table changes are required for this mod.
##
## MOD Version: 1.0.0
##
## Installation Level: (easy)
## Installation Time: 10 Minutes
## Files To Edit: constants.php, usercp_register.php,
## usercp_avatar.php, viewtopic.php
## Included Files: n/a
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/
##############################################################
## Author Notes:
##
## I believe that this is a very clean mod, with minimal code changes.
## As such, it should do well with future upgrades to phpBB, but no
## guarantees are made. I use the "switch" technique to turn off the
## avatar selection process rather than resort to more difficult code,
## so the decision on whether a user gets to select (display) an avatar
## or not is made in only two files: usercp_register.php and viewtopic.php.
##
## Because of this, I rated this an easy install.
##
## If you skip the modifications to usercp_avatar.php you will still
## get the functionality of item 1 listed above, but you won't get 2 or 3.
## That may be enough for some forums, and makes the mod even easier to
## implement and (hopefully) upgrade. If this is what you want to do,
## follow the mod notes below up to the first SAVE/CLOSE instruction.
## If you want to include the restriction for Mod/Admin avatars, continue
## to the end of the mod.
##
## Part of the code changes include an additional level of nesting.
## I don't know how to represent that using the MOD instructions.
## Basically, find the line
## if ($filepass)
## {
## ... and you'll want to indent everything up to the closing bracket for
## that logic. There doesn't appear to be a way to set that up in the MOD
## instructions. And it's not required for the functionality of this mod.
##############################################################
## MOD History:
##
## 1.0.0 - Initial Release (March 7, 2003)
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
includes/constants.php
#
#-----[ FIND ]-------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]-------------------------------------
#
// define limit for standard avatar
define('AVATAR_POST_LIMIT', 50);
#
#-----[ OPEN ]--------------------------------------------
#
includes/usercp_register.php
#
#-----[ FIND ]--------------------------------------------
#
if ( $userdata['user_allowavatar'] && ( $board_config['allow_avatar_upload'] || $board_config['allow_avatar_local'] || $board_config['allow_avatar_remote'] ) )
#
#-----[ REPLACE WITH ]------------------------------------
#
if ( $userdata['user_allowavatar'] && ( $board_config['allow_avatar_upload'] || $board_config['allow_avatar_local'] || $board_config['allow_avatar_remote'] ) && ( $userdata['user_posts'] >= AVATAR_POST_LIMIT || $userdata['user_level'] == MOD || $userdata['user_level'] == ADMIN ) )
#
#-----[ OPEN ]--------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]--------------------------------------------
#
$sql = "SELECT u.username, u.user_id, u.user_posts,
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
u.user_level,
#
#-----[ FIND ]--------------------------------------------
#
if ( $postrow[$i]['user_avatar_type'] && $poster_id != ANONYMOUS && $postrow[$i]['user_allowavatar'] )
#
#-----[ REPLACE WITH ]------------------------------------------
#
if ( $postrow[$i]['user_avatar_type'] && $poster_id != ANONYMOUS && $postrow[$i]['user_allowavatar'] && ($postrow[$i]['user_posts'] >= AVATAR_POST_LIMIT || $postrow[$i]['user_level'] == MOD || $postrow[$i]['user_level'] == ADMIN) )
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_avatar.php
#
#-----[ FIND ]------------------------------------------
#
$dir = @opendir($board_config['avatar_gallery_path']);
#
#-----[ BEFORE, ADD ]------------------------------------------
#
global $userdata;
#
#-----[ FIND ]------------------------------------------
#
$dir = @opendir($board_config['avatar_gallery_path']);
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Restricted Avatar Mod (dgr)
// Any "moderator only" gallery directories will start
// with the following token
$modprefix = 'mod';
// Likewise for admin only avatars
$adminprefix = 'admin';
// end Restricted Avatar Mod (dgr)
#
#-----[ FIND ]------------------------------------------
#
$sub_dir = @opendir($board_config['avatar_gallery_path'] . '/' . $file);
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// begin Restricted Avatar Mod (dgr)
// check for user level before opening directory
// first, check for file name. If it doesn't start
// with a moderator tag or an admin tag, then it is
// okay to use
$filepass = FALSE;
if ( strpos(' ' . $file, $modprefix) || strpos(' ' . $file, $adminprefix) )
{
$filepass = ( $userdata['user_level'] == MOD && strpos(' '. $file, $modprefix ) ) ;
$filepass = ( $userdata['user_level'] == ADMIN ) ? TRUE : $filepass;
}
else // file doesn't start with restricted token
{
$filepass = TRUE;
}
// Restricted Avatar Mod
if ($filepass)
{
#
#-----[ FIND ]------------------------------------------
#
$avatar_col_count = 0;
}
}
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
}
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Er zit zeker iets fout in usercp_avatar.php, want als ik constants.php, usercp_register.php en viewtopic.php, die al geupdate zijn volgens deze MOD) upload en de usercp_avatar.php op originele staat laat staan, werkt alles gewoon perfect. Maar wanneer ik de usercp_avatar.php update volgens deze MOD, krijg ik deze error en ik kom er maar steeds niet uit welk fout er in zit.Parse error: parse error in /home/www/ocnewport2.freeprohost.com/board/includes/usercp_avatar.php on line 251
Fatal error: Call to undefined function: display_avatar_gallery() in /home/www/ocnewport2.freeprohost.com/board/includes/usercp_register.php on line 756
Weet iemand misschien hier raad mee?
Alvast bedankt!
Clement
PS. De url naar de topic bij phpbb.com (http://www.phpbb.com/phpBB/viewtopic.php?t=82958)