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 !

Addon for Auto Group MOD

Postby EGO2000 on Thu 22. Aug, 2002 22:20

hi ...
here is a nice addon for your really cool auto group mod (big thx for it!)
now, you have the possibility to deactivate auto groups for single users, it works 100% ... feel free to use it in your next release

EDIT: OLD CODE NOT TO USE ANY MORE, USE INSTEAD CODE POSTED FURTHER DOWN
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['User_allowavatar'] = 'Can display avatar';

#
#-----[ 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/auth.php

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

      $sql = "SELECT a.forum_id, $a_sql, a.auth_mod
      FROM " . AUTH_ACCESS_TABLE . " a, " . USER_GROUP_TABLE . " ug, ".GROUPS_TABLE." g, ".USERS_TABLE." u
      WHERE
      (
      (
      ug.user_id = ".$userdata['user_id'] ."
      AND ug.user_pending = 0
      AND a.group_id = ug.group_id = g.group_id
      AND g.group_type IN (".GROUP_OPEN.",".GROUP_HIDDEN.")
      )
      OR
      (
      g.group_count<=u.user_posts
      AND g.group_type=".GROUP_POSTS."
      AND a.group_id = g.group_id
      AND u.user_id = ".$userdata['user_id']."
      ))

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

AND a.group_id = g.group_id

#
#-----[ 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>

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


Greetings from Germany !

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

Postby Niels on Mon 26. Aug, 2002 10:58

Thanks for the input, I have though desided to re-write the mod, so the auth.php are not affected, it uses to mutch CPU power
in the future the members will be added to the usergroup like a "regular" user
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby EGO2000 on Mon 26. Aug, 2002 11:45

yeah, i´m very happy, if you re-write the MOD ... but i think the MOD is working quite good ...

i have changed something in the auth.php
Code: Select all
      $sql = "SELECT a.forum_id, $a_sql, a.auth_mod
      FROM " . AUTH_ACCESS_TABLE . " a, " . USER_GROUP_TABLE . " ug, ".GROUPS_TABLE." g, ".USERS_TABLE." u
      WHERE
      (
      (
      ug.user_id = ".$userdata['user_id'] ."
      AND ug.user_pending = 0
      AND a.group_id = ug.group_id = g.group_id
      )
      OR
      (
      g.group_count<=u.user_posts
      AND g.group_type=".GROUP_POSTS."
      AND a.group_id = g.group_id
      AND u.user_allow_ag = 1
      AND u.user_id = ".$userdata['user_id']."
      ))

before removing the line with AND g.group_type IN (".GROUP_OPEN.",".GROUP_HIDDEN.")
page generated in 4.743365 seconds : 20 queries executed : GZIP compression enabled : Debug Mode

and after removing:
page generated in 0.348889 seconds : 20 queries executed : GZIP compression enabled : Debug Mode

now, the single user permissions works correct also, before i´had some problems, only the groups permissions worked, i´ve tested the MOD with some others friends, i´ve created a lot of groups + forums, with a lot of different permissions for each ... and it seems to be work really good :D

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

works also with the actually auto group mod

Postby EGO2000 on Thu 30. Jan, 2003 08:55

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>

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

the only one different is that the check is now in the functions_post.php ...
and it works and works and works *g*

EDIT: Niels
To have this add-on to be compatible with lates how-to, you also need to modify the groupcp.php
Code: Select all
[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;
EGO2000
Poster
Poster
 
Posts: 15
Joined: Wed 14. Aug, 2002 00:51

Postby Niels on Mon 07. Apr, 2003 13:13

this seams pretty good, I migth include this if you allow it ?
this post have been changed to "sticky" and I have modifyed the first post, to awoid users trying to install this "old" version
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby EGO2000 on Mon 07. Apr, 2003 13:38

of course you can include it in your mod/board or whatever ...
EGO2000
Poster
Poster
 
Posts: 15
Joined: Wed 14. Aug, 2002 00:51

Postby Niels on Tue 08. Apr, 2003 22:57

currently PM with EGO2000, please wait with install this add-on
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby Carpe Diem on Sat 24. May, 2003 22:35

Neils,

Is there anything wrong with the add-on since you said we should wait before installning this mod? :?:
Carpe Diem
Poster
Poster
 
Posts: 22
Joined: Thu 02. Jan, 2003 00:35

Next

Return to Auto group [2.0.8/EM]

Who is online

Users browsing this forum: No registered users and 1 guest

cron