Limitare folosire avatar

Aici sunt anunţate şi prezentate MODificările realizate de comunitatea phpBB internaţională şi românească pentru forumul phpBB 2.0.x.
Închis
Avatar utilizator
bogdan
AdministratorAdministrator
Mesaje: 10888
Membru din: 18-Oct-2002, 13:14:27
Versiune: 3.0.11
Ext: Da
Server: UNIX/Linux
Nivel phpBB: Experimentat
Nivel php: Mediu
Localitate: Bucuresti
Contact:

Limitare folosire avatar

Mesaj de bogdan »

Acest mod este creat de drathbun. Ultima versiune este 1.0.0 (3 septembrie 2003);

Ce anume face acest mod ?
Modul restrictioneaza folosirea imaginilor asociate/avatar-urilor in doua moduri:
1. Doar utilizatorii care au depasit un anumit numar de mesaje pot selecta un avatar. Daca se seteaza limita de mesaje (numar) pe 1, atunci aceasta functiune va fi dezactivata. Aceasta valoare se modifica manual in fisierul includes/constants.php (vezi mai jos);
2. Moderatorii si administratorii pot selecta din lista cu avatar-uri. Utilizatorii normali nu pot vedea avatar-urile restrictionate.
- administratorii pot folosi avatar-urile destinate administratorilor, moderatorilor si utilizatorilor normali
- moderatorii pot folosi avatar-urile destinate moderatorilor si utilizatorilor normali
- utilizatorii normali pot folosi avatar-urile destinate utilizatorilor normali dupa ce au depasit conditia pusa pentru folosirea avatar-urilor.

Discutii: http://www.phpbb.com/phpBB/viewtopic.php?t=82958

Exemplu
http://www.forumtopics.com/phpBBDemo

Iata si codul:

Cod: Selectaţi tot

############################################################## 
## MOD Title: Avatar Limits by Role and Post Count 
## MOD Author: drathbun < drathbun@aol.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: includes/constants.php, includes/usercp_register.php, 
##        includes/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 includes/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 
Închis

Înapoi la “2.0.x Anunţuri şi prezentări de MODificări”

Cine este conectat

Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 10 vizitatori