Addon for Auto Group MOD

You'll automatically gain access to this forum when you will post your first post in another forum. That way it will demonstrate how the Auto Group MOD works.
Forum rules
The content in this forum is dated Dec. 21 2005 and can be used as Archive only. This Forum is LOCKED and READ ONLY !

Postby Niels on Mon 26. May, 2003 10:47

No nothig wrong, you can install it, there is how-ever some minor isues, e.g. missing changes to the admin_groups page, modcp and groupcp - but this isen't importent
the add-on is exelent and in fact implemented here on mods.db9.dk
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby FX on Tue 03. Jun, 2003 18:54

it's possible to edit the first post of this subject and add the mods into a zip files or put the code (final mods add-on). 8)
FX
Poster
Poster
 
Posts: 46
Joined: Fri 01. Nov, 2002 21:41
Location: France

Postby Hmmm on Tue 10. Feb, 2004 18:25

That would be nice, wouldn't it?
:roll: Or is this thing already part of the current release?
Hmmm
Poster
Poster
 
Posts: 4
Joined: Wed 14. Jan, 2004 15:40

Postby kermit_criminal on Tue 04. May, 2004 02:37

can this mod be integrated with the points or cash system? make people pay for access to a certain board?
kermit_criminal
Poster
Poster
 
Posts: 4
Joined: Tue 27. Apr, 2004 10:39

Postby Berbe Nanard on Sat 05. Jun, 2004 15:57

I sum up to make all clear. Please change code if it's wrong...

Code: Select all
#
#-----[ ADD SQL ]---------------------------------------------
#

ALTER TABLE phpbb_users ADD user_allow_ag TINYINT(1) DEFAULT '1' NOT NULL;

#
#-----[ OPEN ]------------------------------------------------


language/{your_language}/lang_admin.php

#
#-----[ FIND ]------------------------------------------------
#
$lang['Group_count_delete'] = 'Delete/Update old users';

#
#-----[ ADD AFTER ]-------------------------------------------
#

$lang['User_allow_ag'] = "Activate Auto Group";

#
#-----[ OPEN ]------------------------------------------------


admin/admin_users.php

#
#-----[ FIND ]------------------------------------------------
#

$user_allowsig = ( !empty($HTTP_POST_VARS['user_allowsig']) ) ? intval( $HTTP_POST_VARS['user_allowsig'] ) : 0;

#
#-----[ ADD AFTER ]-------------------------------------------
#

$user_allow_ag = ( !empty($HTTP_POST_VARS['user_allow_ag']) ) ? intval( $HTTP_POST_VARS['user_allow_ag'] ) : 0;

#
#-----[ FIND ]------------------------------------------------
#

$user_allowsig = $this_userdata['user_allowsig'];

#
#-----[ ADD AFTER ]-------------------------------------------
#

$user_allow_ag = $this_userdata['user_allow_ag'];

#
#-----[ FIND ]------------------------------------------------
#

$s_hidden_fields .= '<input type="hidden" name="user_allowavatar" value="' . $user_allowavatar . '" />';

#
#-----[ ADD AFTER ]-------------------------------------------
#

$s_hidden_fields .= '<input type="hidden" name="user_allow_ag" value="' . $user_allow_ag . '" />';

#
#-----[ FIND ]------------------------------------------------
#

'ALLOW_AVATAR_YES' => ($user_allowavatar) ? 'checked="checked"' : '',
'ALLOW_AVATAR_NO' => (!$user_allowavatar) ? 'checked="checked"' : '',

#
#-----[ ADD AFTER ]-------------------------------------------
#

'ALLOW_AG_YES' => ($user_allow_ag) ? 'checked="checked"' : '',
'ALLOW_AG_NO' => (!$user_allow_ag) ? 'checked="checked"' : '',

#
#-----[ FIND ]------------------------------------------------
#

$sql = "UPDATE " . USERS_TABLE . "

#-----[ FIND IN NEXT LINE ]-----------------------------------

, user_allowavatar = $user_allowavatar

#
#-----[ ADD AFTER ]-------------------------------------------
#

, user_allow_ag = $user_allow_ag

#
#-----[ FIND ]------------------------------------------------
#

'L_ALLOW_AVATAR' => $lang['User_allowavatar'],

#
#-----[ ADD AFTER ]-------------------------------------------
#

'L_ALLOW_AG' => $lang['User_allow_ag'],

#
#-----[ OPEN ]------------------------------------------------
#

includes/functions_post.php

#
#-----[ FIND ]------------------------------------------------
#

   $sql = "SELECT ug.user_id, g.group_id as g_id, g.group_name , u.user_posts, g.group_count FROM " . GROUPS_TABLE . " g, ".USERS_TABLE." u
      LEFT JOIN ". USER_GROUP_TABLE." ug ON g.group_id=ug.group_id AND ug.user_id=$user_id
      WHERE u.user_id=$user_id
      AND g.group_single_user=0
      AND g.group_count_enable=1
      AND g.group_moderator<>$user_id";

#-----[ FIND IN THIS BLOCK ]----------------------------------

AND g.group_count_enable=1

#
#-----[ ADD AFTER ]-------------------------------------------
#

AND u.user_allow_ag = 1

#
#-----[ OPEN ]------------------------------------------------


/templates/{your_template}/admin/user_edit_body.tpl

#
#-----[ FIND ]------------------------------------------------
#

   <tr>
     <td class="row1"><span class="gen">{L_ALLOW_AVATAR}</span></td>
     <td class="row2">
      <input type="radio" name="user_allowavatar" value="1" {ALLOW_AVATAR_YES} />
      <span class="gen">{L_YES}</span>&nbsp;&nbsp;
      <input type="radio" name="user_allowavatar" value="0" {ALLOW_AVATAR_NO} />
      <span class="gen">{L_NO}</span></td>
   </tr>

#
#-----[ ADD AFTER ]-------------------------------------------
#

   <tr>
     <td class="row1"><span class="gen">{L_ALLOW_AG}</span></td>
     <td class="row2">
      <input type="radio" name="user_allow_ag" value="1" {ALLOW_AG_YES} />
      <span class="gen">{L_YES}</span>&nbsp;&nbsp;
      <input type="radio" name="user_allow_ag" value="0" {ALLOW_AG_NO} />
      <span class="gen">{L_NO}</span></td>
   </tr>

#
#-----[ OPEN ]------------------------------------------------


groupcp.php

#
#-----[ FIND ]------------------------------------------------
#

$is_autogroup_enable = ($row['group_count'] <= $userdata['user_posts'] && $row['group_count_max'] > $userdata['user_posts'] ) ? true : false;

#
#-----[ REPLACE WITH ]-------------------------------------------
#

$is_autogroup_enable = ($row['group_count'] <= $userdata['user_posts'] && $row['group_count_max'] > $userdata['user_posts'] && $userdata['user_allow_ag']) ? true : false;

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
Berbe Nanard
Poster
Poster
 
Posts: 15
Joined: Sun 07. Mar, 2004 02:49

mod completed and updated for v1.2.2

Postby EGO2000 on Sun 27. Mar, 2005 02:53

Code: Select all
##############################################################
## MOD Title:     Auto Group Addon
## MOD Author:
## MOD Required:  MOD Title:  Auto Group 1.2.2
##                MOD Author: Niels < ncr@db9.dk >
##                (Niels Chr. Rød) http://mods.db9.dk
##
## MOD Description: This Addon will make it possible to de-/activate
##                  the auto group feature for a single user
##                - no autojoin to an auto group for the user
##                - no subscribing to an auto group it´s possible
##                - not adding the user by using the add/update function in group settings
##                - removing the user from an autogroup, when user is posting next time
##                  or a mod/admin will delete a post (if he is still in an autogroup)
##
## Compatibility:   Tested on phpBB 2.1.3, should work on each version
##                  on which you can install the great auto group mod
##
## Installation Level:  Easy
## Installation Time:   10 Minutes
## Files To Edit:       6
##      groupcp.php
##      modcp.php
##      admin/admin_groups.php
##      admin/admin_users.php
##      includes/functions_post.php
##      templates/{your_template}/admin/user_edit_body.tpl
##
##############################################################

#
#-----[ ADD SQL ]---------------------------------------------
#

ALTER TABLE phpbb_users ADD user_allow_ag TINYINT(1) DEFAULT '1' NOT NULL;

#
#-----[ OPEN ]------------------------------------------------
#
admin/admin_users.php

#
#-----[ FIND ]------------------------------------------------
#

        //finding new users
        $sql = "SELECT u.user_id FROM " . USERS_TABLE . " u
          LEFT JOIN " . USER_GROUP_TABLE ." ug ON u.user_id=ug.user_id AND ug.group_id='$group_id'
          WHERE u.user_posts>='$group_count' AND u.user_posts<'$group_count_max'
          AND ug.group_id is NULL

#
#-----[ ADD AFTER ]-------------------------------------------
#

          AND u.user_allow_ag=1


#
#-----[ FIND ]------------------------------------------------
#

        //finding new users
        $sql = "SELECT u.user_id FROM " . USERS_TABLE . " u
          LEFT JOIN " . USER_GROUP_TABLE ." ug ON u.user_id=ug.user_id AND ug.group_id='$new_group_id'
          WHERE u.user_posts>='$group_count' AND u.user_posts<'$group_count_max'
          AND ug.group_id is NULL

#
#-----[ ADD AFTER ]-------------------------------------------
#

          AND u.user_allow_ag=1

#
#-----[ OPEN ]------------------------------------------------
#
admin/admin_users.php

#
#-----[ FIND ]------------------------------------------------
#

$user_allowavatar = ( !empty($HTTP_POST_VARS['user_allowavatar']) ) ? intval( $HTTP_POST_VARS['user_allowavatar'] ) : 0;

#
#-----[ ADD AFTER ]-------------------------------------------
#

$user_allow_ag = ( !empty($HTTP_POST_VARS['user_allow_ag']) ) ? intval( $HTTP_POST_VARS['user_allow_ag'] ) : 0;

#
#-----[ FIND ]------------------------------------------------
#

$sql = "UPDATE " . USERS_TABLE . "
  SET " . $username_sql . $passwd_sql .

#-----[ FIND IN NEXT LINE ]-----------------------------------

, user_allowavatar = $user_allowavatar

#
#-----[ ADD AFTER ]-------------------------------------------
#

, user_allow_ag = $user_allow_ag

#
#-----[ FIND ]------------------------------------------------
#

$user_allowavatar = $this_userdata['user_allowavatar'];

#
#-----[ ADD AFTER ]-------------------------------------------
#

$user_allow_ag = $this_userdata['user_allow_ag'];

#
#-----[ FIND ]------------------------------------------------
#

$s_hidden_fields .= '<input type="hidden" name="user_allowavatar" value="' . $user_allowavatar . '" />';

#
#-----[ ADD AFTER ]-------------------------------------------
#

$s_hidden_fields .= '<input type="hidden" name="user_allow_ag" value="' . $user_allow_ag . '" />';

#
#-----[ FIND ]------------------------------------------------
#

'ALLOW_AVATAR_YES' => ($user_allowavatar) ? 'checked="checked"' : '',
'ALLOW_AVATAR_NO' => (!$user_allowavatar) ? 'checked="checked"' : '',

#
#-----[ ADD AFTER ]-------------------------------------------
#

'ALLOW_AG_YES' => ($user_allow_ag) ? 'checked="checked"' : '',
'ALLOW_AG_NO' => (!$user_allow_ag) ? 'checked="checked"' : '',

#
#-----[ FIND ]------------------------------------------------
#

'L_ALLOW_AVATAR' => $lang['User_allowavatar'],

#
#-----[ ADD AFTER ]-------------------------------------------
#

'L_ALLOW_AG' => $lang['User_allow_ag'],

#
#-----[ OPEN ]------------------------------------------------
#

includes/functions_post.php

#
#-----[ FIND ]------------------------------------------------
#

  $sql = "SELECT ug.user_id, g.group_id as g_id, u.user_posts, g.group_count, g.group_count_max FROM " . GROUPS_TABLE . " g, ".USERS_TABLE." u

#-----[ FIND IN LINE ]----------------------------------

u.user_posts,

#
#-----[ ADD AFTER ]-------------------------------------------
#

, u.user_allow_ag

#
#-----[ FIND ]------------------------------------------------
#

if ($user_add && !$user_already_added)

#
#-----[ REPLACE WITH ]------------------------------------------
#

if ($user_add && !$user_already_added && $group_data['user_allow_ag'] == 1)

#
#-----[ FIND ]------------------------------------------------
#

if ( $user_already_added && $user_remove)

#
#-----[ REPLACE WITH ]------------------------------------------
#

if ( $user_already_added && $user_remove OR $group_data['user_allow_ag'] == 0) // i'am so bad

#
#-----[ OPEN ]------------------------------------------------
#

modcp.php

#
#-----[ FIND ]------------------------------------------------
#

  $user_updated [] = "SELECT ug.user_id, g.group_id as g_id, u.user_posts, g.group_count, g.group_count_max, ".$row['poster_id']." as u_id FROM " . GROUPS_TABLE . " g, ".USERS_TABLE." u
 
#-----[ FIND IN LINE ]----------------------------------

u.user_posts,

#
#-----[ ADD AFTER ]-------------------------------------------
#

, u.user_allow_ag

#
#-----[ FIND ]------------------------------------------------
#

if ($user_add && !$user_already_added)

#
#-----[ REPLACE WITH ]------------------------------------------
#

if ($user_add && !$user_already_added && $group_data['user_allow_ag'] == 1)

#
#-----[ FIND ]------------------------------------------------
#

if ( $user_already_added && $user_remove)

#
#-----[ REPLACE WITH ]------------------------------------------
#

if ( $user_already_added && $user_remove OR $group_data['user_allow_ag'] == 0) // i'am so bad again

#
#-----[ OPEN ]------------------------------------------------

groupcp.php

#
#-----[ FIND ]------------------------------------------------
#

$is_autogroup_enable = ($row['group_count'] <= $userdata['user_posts'] && $row['group_count_max'] > $userdata['user_posts']) ? true : false;

#
#-----[ REPLACE WITH ]-------------------------------------------
#

$is_autogroup_enable = ($row['group_count'] <= $userdata['user_posts'] && $row['group_count_max'] > $userdata['user_posts'] && $userdata['user_allow_ag']) ? true : false;

#
#-----[ FIND ]------------------------------------------------
#

$is_autogroup_enable = ($group_info['group_count'] <= $userdata['user_posts'] && $group_info['group_count_max'] > $userdata['user_posts']) ? true : false;

#
#-----[ REPLACE WITH ]-------------------------------------------
#

$is_autogroup_enable = ($group_info['group_count'] <= $userdata['user_posts'] && $group_info['group_count_max'] > $userdata['user_posts'] && $userdata['user_allow_ag']) ? true : false;

#
#-----[ FIND ]------------------------------------------------
#

$is_autogroup_enable = ($row['group_count'] <= $userdata['user_posts'] && $row['group_count_max'] > $userdata['user_posts']) ? true : false;

#
#-----[ REPLACE WITH ]-------------------------------------------
#

$is_autogroup_enable = ($row['group_count'] <= $userdata['user_posts'] && $row['group_count_max'] > $userdata['user_posts'] && $userdata['user_allow_ag']) ? true : false;

#
#-----[ OPEN ]------------------------------------------------
#
/templates/{your_template}/admin/user_edit_body.tpl

#
#-----[ FIND ]------------------------------------------------
#

  <tr>
    <td class="row1"><span class="gen">{L_ALLOW_AVATAR}</span></td>
    <td class="row2">
    <input type="radio" name="user_allowavatar" value="1" {ALLOW_AVATAR_YES} />
    <span class="gen">{L_YES}</span>&nbsp;&nbsp;
    <input type="radio" name="user_allowavatar" value="0" {ALLOW_AVATAR_NO} />
    <span class="gen">{L_NO}</span></td>
  </tr>

#
#-----[ ADD AFTER ]-------------------------------------------
#

  <tr>
    <td class="row1"><span class="gen">{L_ALLOW_AG}</span></td>
    <td class="row2">
    <input type="radio" name="user_allow_ag" value="1" {ALLOW_AG_YES} />
    <span class="gen">{L_YES}</span>&nbsp;&nbsp;
    <input type="radio" name="user_allow_ag" value="0" {ALLOW_AG_NO} />
    <span class="gen">{L_NO}</span></td>
  </tr>

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#

# EoM


hope i forgot nothing ...
thx for your greats mods, good work Niels :D

Greets EGO2000
EGO2000
Poster
Poster
 
Posts: 15
Joined: Wed 14. Aug, 2002 00:51

Postby Drevlyanin on Fri 30. Sep, 2005 12:12

In MOD

Code: Select all
#
#-----[ OPEN ]------------------------------------------------
#
admin/admin_users.php


Replace on

Code: Select all
#
#-----[ OPEN ]------------------------------------------------
#
admin/admin_groups.php
Drevlyanin
Poster
Poster
 
Posts: 2
Joined: Thu 17. Mar, 2005 19:27

Previous

Return to Auto group [2.0.8/EM]

Who is online

Users browsing this forum: No registered users and 0 guests

cron