Auto group 1.2.2 - http://www.phpbbhacks.com/download/2203
The MOD seemingly is working, less in your main function, that is to add the user automatically to the group after putting his first post. I have to go in ACP and select "Add/Update new users" and later in "sending" to add (this function is not marked when I go back to the screen, after clicking in sending).
In spite of the option "Users automatic added when posting" be always marked, it is not adding automatically.
Below, the screen of ACP of groups, the install of the mod and the only necessary file for uploading of the mod (auto_group_db_update.php)

- Code: Select all
##############################################################
## MOD Title: Auto group
## MOD Author: Niels < ncr@db9.dk > (Niels Chr. Rød) http://mods.db9.dk
## MOD Description: This mod will make it posible to add member
## to a user group, depending on there post count
## MOD Version: 1.2.2
## Compatibility: 2.0.5->2.0.6
##
## Installation Level: Intermediate
## Installation Time: 10 Minutes (1mn by EasyMOD of Nuttzy)
## Files To Edit: 8
## groupcp.php
## modcp.php
## admin/admin_groups.php
## include/functions_post.php
## include/usercp_register.php
## language/lang_english/lang_admin.php
## language/lang_english/lang_main.php
## templates/subSilver/admin/group_edit_body.tpl
##
## Included Files: 2
## auto_group_db_update.php
## tool/sync_postcount.php
##
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ 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/
##############################################################
## Author Notes:
##
## 1. Full MOD description
## -----------
## This mod will make it posible to add member to a user group,
## depending on there post count. This makes it posible to make a
## group "Everyone" (0 posts) where all members are members by default
## or a group like "Posters" (1 posts) where all users witch have
## posted are a member.
## Now also support MAX post count, so the users will be removed
## if they have more posts than required
##
## 2. EasyMOD
## -----------
## This MOD is compatible and can be installed by EasyMOD
## of Nuttzy (but is not officially EasyMOD Compliant)!
## http://area51.phpbb.com/phpBB22/viewforum.php?sid=&f=15
##
## However, on alpha releases of EM and meanwhile beta or
## final release some actions are NOT performed.
## You'll have to do them manually !
##
## 2.1 SQL commands are not performed
## -----------
## This MOD need a database update.
## Then, in any case if you install this MOD manually or using
## an alpha release of EM, please copying the *_db_update.php
## in your phpBB root directory, run it with your navigator,
## and then delete it from the phpBB root directory.
##
## Please, do it NOW! Before editing phpBB files by EM or manually!!!
## Otherwise, you may have an error message during your next
## connection.
##
## 2.2 Translation are not managed
## -----------
## Moreover, EM can not already manage actions for any other
## language than English (but language intructions are proceed
## to all installed languages in order to prevent errors).
## So the translations provided with this MOD must be installed
## manually if you need them.
##
## 3. Official last version link
## -----------
## Meanwhile the phpBB group validation and as the MOD is not yet
## in the phpBB MOD database, check this official link for updates...
## http://mods.db9.dk/viewtopic.php?t=115
##
## 4. Installation notes
## -----------
## I have included the optional sync_postcount.php, witch will
## syncronise the users post count. This is only nessesary to
## run this, if you think your users post count are not rigth.
##
##############################################################
## MOD History:
##
## 2003-12-06 - Version 1.2.2
## - phpBB template & EasyMOD compliance enhancement
##
## 2003-10-04 - Version 1.2.1.
## - changed some of the syntax used in the how-to
##
## 2003-08-24 - Version 1.2.0
## - EM ready for 2.0.6
##
## ????-??-?? - Version 1.1.9
## - corrected admin_groups.php, a spell error prevented
## the user list to show, when add/update users
##
## ????-??-?? - Version 1.1.8
## - corrected admin_groups.php, a missing language variable added
##
## ????-??-?? - Version 1.1.7
## - corrected a typo in the how-to related to groupcp.php,
## witch caused a SQL error
##
## ????-??-?? - Version 1.1.6
## - bugs in version 1.1.3 corrected (functions_post.php
## and modcp.php)
##
## ????-??-?? - Version 1.1.5
## - changed groupcp.php to prevent SQL error
##
## ????-??-?? - Version 1.1.4
## - corrected a bug in modcp.php, witch caused a SQL error
##
## ????-??-?? - Version 1.1.3
## - now support maximum number of posts
##
## ????-??-?? - Version 1.1.2
## - corrected groupcp.php, to allow re-join of a hidden group
##
## ????-??-?? - Version 1.1.1
## - missed some changes into the lang_main.php
##
## ????-??-?? - Version 1.1.0
## - if a user have unsubscribed from a autogroup, they are now
## allowed to re-join "closer/hidden groups" later
##
## ????-??-?? - Version 1.0.5
## - typo in the how-to, regarding modcp.php
##
## ????-??-?? - Version 1.0.4
## - not include change into modcp.php
##
## ????-??-?? - Version 1.0.3
## - the how-to for admin_groups.php was corrected
##
## ????-??-?? - Version 1.0.2
## - fixed that guest users was added to autogroups, upon posting
##
## ????-??-?? - Version 1.0.1
## - corrected the placement of the code in usercp_register.php
##
## ????-??-?? - Version 1.0.0
## - now considerd as final
##
## ????-??-?? - Version 0.10.2
## - users are added to "0" groups when register even if "Users
## automatic added when posting" are disabled
##
## ????-??-?? - Version 0.10.1
## - minor change to the language file
##
## ????-??-?? - Version 0.10.0
## - re-written code, now users are true members of user groups,
## code consider as BETA
##
## ????-??-?? - Version 0.9.9
## - minor changes to lang_admin.php
##
## ????-??-?? - Version 0.9.8
## - now posible to mass email a auto group
##
## ????-??-?? - Version 0.9.7
## - now display the groups members when changing the groups permissions
##
## ????-??-?? - Version 0.9.6
## - improved the SQL in auth.php
##
## ????-??-?? - Version 0.9.5
## - I had put a "update" find in the script instead of a original code
##
## ????-??-?? - Version 0.9.4
## - Important security update, in auth.php
##
## ????-??-?? - Version 0.9.3
## - changed the explanation text in group permissions, admin panel
##
## ????-??-?? - Version 0.9.2
## - Fixed some typos in the how-to, regarding admin_ug_auth.php,
## and corrected where groupcp.php are located
##
## ????-??-?? - Version 0.9.1
## - cosmetic change, "post group" are now "Auto group"
##
## ????-??-?? - Version 0.9.0
## - initial BETA release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ COPY ]------------------------------------------------
#
copy auto_group_db_update.php to auto_group_db_update.php
#
# This MOD need a database update.
# Then, as you must have now copied the auto_group_db_update.php file
# in your phpBB root directory, run it with your navigator...
# http://www.yourWebSite.xxx/phpbbRootDir/auto_group_db_update.php
#
# ...and then delete it from the phpBB root directory!!!
#
# Please, do it NOW! Before editing phpBB files by EM or manually!!!
# Otherwise, you may have an error message during your next
# connection.
#
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
# NOTE, replace complete line of code....
#
$lang['This_closed_group']
$lang['This_hidden_group']
#
#-----[ REPLACE WITH ]------------------------------------------
#
$lang['This_closed_group'] = 'This is a closed group: %s';
$lang['This_hidden_group'] = 'This is a hidden group: %s';
#
#-----[ FIND ]------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
//added to autogroup mod
$lang['No_more'] = 'no more users accepted';
$lang['No_add_allowed'] = 'automatic user addition is not allowed';
$lang['Join_auto'] = 'You may join this group, since your post count meet the group criteria';
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_admin.php
#
#-----[ FIND ]------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// addded to Auto group mod
$lang['group_count'] = 'Number of required posts';
$lang['group_count_max'] = 'Number of max posts';
$lang['group_count_updated'] = '%d member(s) have been removed, %d members are added to this group';
$lang['Group_count_enable'] = 'Users automatic added when posting';
$lang['Group_count_update'] = 'Add/Update new users';
$lang['Group_count_delete'] = 'Delete/Update old users';
$lang['User_allow_ag'] = "Activate Auto Group";
$lang['group_count_explain'] = 'When users have posted more posts than this value <i>(in any forum)</i> then they will be added to this usergroup<br/> This only applys if "'.$lang['Group_count_enable'].'" are enabled';
#
#-----[ OPEN ]------------------------------------------
#
admin/admin_groups.php
#
#-----[ FIND ]------------------------------------------
#
'group_moderator' => '',
#
#-----[ AFTER, ADD ]------------------------------------------
#
'group_count' => '99999999',
'group_count_max' => '99999999',
'group_count_enable' => '0',
#
#-----[ FIND ]------------------------------------------
#
$group_hidden = ( $group_info['group_type'] == GROUP_HIDDEN ) ? ' checked="checked"' : '';
#
#-----[ AFTER, ADD ]------------------------------------------
#
$group_count_enable_checked = ( $group_info['group_count_enable'] ) ? ' checked="checked"' : '';
#
#-----[ FIND ]------------------------------------------
#
'GROUP_MODERATOR' => $group_moderator,
#
#-----[ AFTER, ADD ]------------------------------------------
#
'GROUP_COUNT' => $group_info['group_count'],
'GROUP_COUNT_MAX' => $group_info['group_count_max'],
'GROUP_COUNT_ENABLE_CHECKED' => $group_count_enable_checked,
'L_GROUP_COUNT' => $lang['group_count'],
'L_GROUP_COUNT_MAX' => $lang['group_count_max'],
'L_GROUP_COUNT_EXPLAIN' => $lang['group_count_explain'],
'L_GROUP_COUNT_ENABLE' => $lang['Group_count_enable'],
'L_GROUP_COUNT_UPDATE' => $lang['Group_count_update'],
'L_GROUP_COUNT_DELETE' => $lang['Group_count_delete'],
#
#-----[ FIND ]------------------------------------------
#
$delete_old_moderator = isset($HTTP_POST_VARS['delete_old_moderator']) ? true : false;
#
#-----[ AFTER, ADD ]------------------------------------------
#
$group_count = isset($HTTP_POST_VARS['group_count']) ? intval($HTTP_POST_VARS['group_count']) : 0;
$group_count_max = isset($HTTP_POST_VARS['group_count_max']) ? intval($HTTP_POST_VARS['group_count_max']) : 0;
$group_count_enable = isset($HTTP_POST_VARS['group_count_enable']) ? true : false;
$group_count_update = isset($HTTP_POST_VARS['group_count_update']) ? true : false;
$group_count_delete = isset($HTTP_POST_VARS['group_count_delete']) ? true : false;
#
#-----[ FIND ]------------------------------------------
#
$sql = "UPDATE " . GROUPS_TABLE . "
SET group_type =
WHERE
#
#-----[ IN-LINE FIND ]------------------------------------------
#
$group_moderator
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
# *
, group_count='$group_count', group_count_max='$group_count_max', group_count_enable='$group_count_enable'
#
#-----[ FIND ]------------------------------------------
#
# this line must be found rigth below the abouve find tag, as this line are pressent 2 places
message_die(GENERAL_ERROR, 'Could not update group', '', __LINE__, __FILE__, $sql);
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
if ($group_count_delete)
{
//removing old users
$sql = "DELETE FROM " . USER_GROUP_TABLE . "
WHERE group_id=$group_id
AND user_id NOT IN ('$group_moderator','".ANONYMOUS."')";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not remove users, group count', '', __LINE__, __FILE__, $sql);
}
$group_count_remove=$db->sql_affectedrows();
}
if ( $group_count_update)
{
//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
AND u.user_id NOT IN ('$group_moderator','".ANONYMOUS."')";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, $sql.'Could not select new users, group count', '', __LINE__, __FILE__, $sql);
}
//inserting new users
$group_count_added=0;
while ( ($new_members = $db->sql_fetchrow($result)) )
{
$sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending)
VALUES ($group_id, " . $new_members['user_id'] . ", 0)";
if ( !($result2 = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error inserting user group, group count', '', __LINE__, __FILE__, $sql);
}
$group_count_added++;
}
}
#
#-----[ FIND ]------------------------------------------
#
$message = $lang['Updated_group'] . '<br />
#
#-----[ IN-LINE FIND ]----------------------------------------
#
$lang['Updated_group'] .
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
# *
'<br />'.sprintf($lang['group_count_updated'],$group_count_remove,$group_count_added).
#
#-----[ FIND ]------------------------------------------
#
else if( $mode == 'newgroup' )
{
$sql = "INSERT INTO " . GROUPS_TABLE . " (
VALUES (
#
#-----[ IN-LINE FIND ]------------------------------------------
#
, group_moderator
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
# *
, group_count,group_count_max,group_count_enable
#
#-----[ IN-LINE FIND ]------------------------------------------
#
, $group_moderator
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
# *
, '$group_count','$group_count_max','$group_count_enable'
#
#-----[ FIND ]------------------------------------------
#
message_die(GENERAL_ERROR, 'Could not insert new user-group info', '', __LINE__, __FILE__, $sql);
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
if ($group_count_delete)
{
//removing old users
$sql = "DELETE FROM " . USER_GROUP_TABLE . "
WHERE group_id=$new_group_id
AND user_id NOT IN ('$group_moderator','".ANONYMOUS."')";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not remove users, group count', '', __LINE__, __FILE__, $sql);
}
$group_count_remove=$db->sql_affectedrows();
}
if ( $group_count_update)
{
//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
AND u.user_id NOT IN ('$group_moderator','".ANONYMOUS."')";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, $sql.'Could not select new users, group count', '', __LINE__, __FILE__, $sql);
}
//inserting new users
$group_count_added=0;
while ( ($new_members = $db->sql_fetchrow($result)) )
{
$sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending)
VALUES ($new_group_id, " . $new_members['user_id'] . ", 0)";
if ( !($result2 = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error inserting user group, group count', '', __LINE__, __FILE__, $sql);
}
$group_count_added++;
}
}
#
#-----[ FIND ]------------------------------------------
#
$message = $lang['Added_new_group'] . '<br />
#
#-----[ IN-LINE FIND ]------------------------------------------
#
$lang['Added_new_group'] .
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
'<br />'.sprintf($lang['group_count_updated'],$group_count_remove,$group_count_added).
#
#-----[ OPEN ]------------------------------------------
#
includes/functions_post.php
#
#-----[ FIND ]------------------------------------------
#
return;
}
//
// Delete a post/poll
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$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
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";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error geting users post stat', '', __LINE__, __FILE__, $sql);
}
while ($group_data = $db->sql_fetchrow($result))
{
$user_already_added = (empty($group_data['user_id'])) ? FALSE : TRUE;
$user_add = ($group_data['group_count'] == $group_data['user_posts'] && $user_id!=ANONYMOUS) ? TRUE : FALSE;
$user_remove = ($group_data['group_count'] > $group_data['user_posts'] || $group_data['group_count_max'] < $group_data['user_posts']) ? TRUE : FALSE;
if ($user_add && !$user_already_added)
{
//user join a autogroup
$sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending)
VALUES (".$group_data['g_id'].", $user_id, '0')";
if ( !($db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error insert users, group count', '', __LINE__, __FILE__, $sql);
}
} else
if ( $user_already_added && $user_remove)
{
//remove user from auto group
$sql = "DELETE FROM " . USER_GROUP_TABLE . "
WHERE group_id=".$group_data['g_id']."
AND user_id=$user_id";
if ( !($db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not remove users, group count', '', __LINE__, __FILE__, $sql);
}
}
}
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_register.php
#
#-----[ FIND ]------------------------------------------
#
$email_template = 'user_welcome';
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
$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 ug.user_id is NULL
AND g.group_count=0
AND g.group_single_user=0
AND g.group_moderator<>$user_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error geting users post stat', '', __LINE__, __FILE__, $sql);
}
while ($group_data = $db->sql_fetchrow($result))
{
//user join a autogroup
$sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending)
VALUES (".$group_data['g_id'].", $user_id, 0)";
if ( !($db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error inserting user group, group count', '', __LINE__, __FILE__, $sql);
}
}
#
#-----[ OPEN ]------------------------------------------
#
modcp.php
#
#-----[ FIND ]------------------------------------------
#
$count_sql = array();
#
#-----[ AFTER, ADD ]------------------------------------------
#
$user_updated = array();
#
#-----[ FIND ]------------------------------------------
#
WHERE user_id = " . $row['poster_id'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
$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
LEFT JOIN ". USER_GROUP_TABLE." ug ON g.group_id=ug.group_id AND ug.user_id=".$row['poster_id']."
WHERE u.user_id=".$row['poster_id']."
AND g.group_single_user=0
AND g.group_count_enable=1
AND g.group_moderator<>".$row['poster_id'];
#
#-----[ FIND ]------------------------------------------
#
$sql = "SELECT post_id
#
#-----[ BEFORE, ADD ]------------------------------------------
#
if ( sizeof($user_updated) )
{
for($i = 0; $i < sizeof($user_updated); $i++)
{
if ( !($result = $db->sql_query($user_updated[$i])) )
{
message_die(GENERAL_ERROR, 'Error geting users post stat', '', __LINE__, __FILE__, $user_updated[$i]);
}
while ($group_data = $db->sql_fetchrow($result))
{
$user_already_added = (!empty($group_data['user_id']) || $group_data['u_id']==ANONYMOUS) ? TRUE : FALSE;
$user_add = ($group_data['group_count'] == $group_data['user_posts'] && $group_data['u_id']!=ANONYMOUS) ? TRUE : FALSE;
$user_remove = ($group_data['group_count'] > $group_data['user_posts'] && $group_data['u_id']!=ANONYMOUS) ? TRUE : FALSE;
if ($user_add && !$user_already_added)
{
//user join a autogroup
$sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending)
VALUES (".$group_data['g_id'].", ".$group_data['u_id'].", '0')";
if ( !($db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error insert users, group count', '', __LINE__, __FILE__, $sql);
}
} else
if ( $user_already_added && $user_remove)
{
//remove user from autogroup
$sql = "DELETE FROM " . USER_GROUP_TABLE . "
WHERE group_id=".$group_data['g_id']."
AND user_id=".$group_data['u_id'];
if ( !($db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not remove users, group count', '', __LINE__, __FILE__, $sql);
}
}
unset ($group_data);
}
$db->sql_freeresult($result);
}
}
#
#-----[ OPEN ]------------------------------------------
#
groupcp.php
#
#-----[ FIND ]------------------------------------------
#
$sql = "SELECT ug.user_id, g.group_type
FROM " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g
WHERE g.group_id = $group_id
AND
AND
#
#-----[ IN-LINE FIND ]------------------------------------------
#
ug.user_id, g.group_type
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, group_count, group_count_max
#
#-----[ IN-LINE FIND ]------------------------------------------
#
AND g.group_type <> " . GROUP_HIDDEN . "
#
#-----[ IN-LINE REPLACE WITH ]------------------------------------------
#
AND ( g.group_type <> " . GROUP_HIDDEN . " OR (g.group_count <= '".$userdata['user_posts']."' AND g.group_count_max > '".$userdata['user_posts']."'))
#
#-----[ FIND ]------------------------------------------
#
if ( $row = $db->sql_fetchrow($result) )
{
if ( $row['group_type'] == GROUP_OPEN )
#
#-----[ REPLACE WITH ]------------------------------------------
#
if ( $row = $db->sql_fetchrow($result) )
{
$is_autogroup_enable = ($row['group_count'] <= $userdata['user_posts'] && $row['group_count_max'] > $userdata['user_posts']) ? true : false;
if ( $row['group_type'] == GROUP_OPEN || $is_autogroup_enable)
#
#-----[ FIND ]------------------------------------------
#
$sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending)
VALUES ($group_id, " . $userdata['user_id'] . ", 1)";
#
#-----[ IN-LINE FIND ]------------------------------------------
#
, 1
#
#-----[ IN-LINE REPLACE WITH ]------------------------------------------
#
,'".(($is_autogroup_enable)? 0 : 1)."'
#
#-----[ FIND ]------------------------------------------
#
$moderator = $db->sql_fetchrow($result);
#
#-----[ AFTER, ADD ]------------------------------------------
#
if (!$is_autogroup_enable)
{
#
#-----[ FIND ]------------------------------------------
#
$emailer->reset();
$template->assign_vars(array(
'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("index.$phpEx") . '">')
#
#-----[ IN-LINE FIND ]------------------------------------------
#
$emailer->reset();
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
}
#
#-----[ FIND ]------------------------------------------
#
$message = $lang['Group_joined'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
#
#-----[ IN-LINE FIND ]------------------------------------------
#
$lang['Group_joined']
#
#-----[ IN-LINE REPLACE WITH ]------------------------------------------
#
($is_autogroup_enable) ? $lang['Group_added'] : $lang['Group_joined']
#
#-----[ FIND ]------------------------------------------
#
$is_group_pending_member = 0;
#
#-----[ AFTER, ADD ]------------------------------------------
#
$is_autogroup_enable = ($group_info['group_count'] <= $userdata['user_posts'] && $group_info['group_count_max'] > $userdata['user_posts']) ? true : false;
#
#-----[ FIND ]------------------------------------------
#
if ( $group_info['group_type'] == GROUP_CLOSED )
{
$group_details = $lang['This_closed_group'];
$s_hidden_fields = '';
}
else if ( $group_info['group_type'] == GROUP_HIDDEN )
{
$group_details = $lang['This_hidden_group'];
$s_hidden_fields = '';
}
#
#-----[ REPLACE WITH ]------------------------------------------
#
if ( $group_info['group_type'] == GROUP_CLOSED )
{
if ($is_autogroup_enable)
{
$template->assign_block_vars('switch_subscribe_group_input', array());
$group_details = sprintf ($lang['This_closed_group'],$lang['Join_auto']);
$s_hidden_fields = '<input type="hidden" name="' . POST_GROUPS_URL . '" value="' . $group_id . '" />';
} else
{
$group_details = sprintf ($lang['This_closed_group'],$lang['No_more']);
$s_hidden_fields = '';
}
}
else if ( $group_info['group_type'] == GROUP_HIDDEN )
{
if ($is_autogroup_enable)
{
$template->assign_block_vars('switch_subscribe_group_input', array());
$group_details = sprintf ($lang['This_hidden_group'],$lang['Join_auto']);
$s_hidden_fields = '<input type="hidden" name="' . POST_GROUPS_URL . '" value="' . $group_id . '" />';
} else
{
$group_details = sprintf ($lang['This_closed_group'],$lang['No_add_allowed']);
$s_hidden_fields = '';
}
}
#
#-----[ FIND ]------------------------------------------
#
$sql = "SELECT group_id, group_name, group_type
FROM " . GROUPS_TABLE . " g
WHERE group_single_user <> " . TRUE . "
$ignore_group_sql
#
#-----[ IN-LINE FIND ]------------------------------------------
#
group_type
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, group_count , group_count_max
#
#-----[ FIND ]------------------------------------------
#
$s_group_list_opt = '';
while
{
#
#-----[ AFTER, ADD ]------------------------------------------
#
$is_autogroup_enable = ($row['group_count'] <= $userdata['user_posts'] && $row['group_count_max'] > $userdata['user_posts']) ? true : false;
#
#-----[ FIND ]------------------------------------------
#
if ( $row['group_type'] != GROUP_HIDDEN || $userdata['user_level'] == ADMIN )
#
#-----[ IN-LINE FIND ]------------------------------------------
#
$userdata['user_level'] == ADMIN
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
|| $is_autogroup_enable
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/admin/group_edit_body.tpl
#
#-----[ FIND ]------------------------------------------
#
{L_GROUP_HIDDEN}</td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<tr>
<td class="row1" width="38%"><span class="gen">{L_GROUP_COUNT}:<br/>{L_GROUP_COUNT_MAX}:</span><br/>
<span class="gensmall">{L_GROUP_COUNT_EXPLAIN}</span></td>
<td class="row2" width="62%"><input type="text" class="post" name="group_count" maxlength="12" size="12" value="{GROUP_COUNT}" /><br/><input type="text" class="post" name="group_count_max" maxlength="12" size="12" value="{GROUP_COUNT_MAX}" />
<br/> <span class="gen"></span><input type="checkbox" name="group_count_enable" {GROUP_COUNT_ENABLE_CHECKED} > {L_GROUP_COUNT_ENABLE}
<br/> <input type="checkbox" name="group_count_update" value="0"/> {L_GROUP_COUNT_UPDATE}
<br/> <input type="checkbox" name="group_count_delete" value="0"/> {L_GROUP_COUNT_DELETE}</span>
</td>
</tr>
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
- Code: Select all
<?php
#########################################################
## SQL commands to phpBB2
## Author: Niels Chr. Rød
## Nickname: Niels Chr. Denmark
## Email: ncr@db9.dk
##
## Ver 1.0.7
##
## phpBB2 database update script for mods
## this file is intended to use with phpBB2, when installing mods
## after so you may delete this file, but only admin can use so it really doesen't matter
## The script will look what prefix you are using, and use the existing DB defined by congig.php
## The execution of this script's included SQL is harmless, so you can run it as meny times you like
## note, though that the users last visit, will be set back to his/her last login,
## but that is a minor cosmetic isue, that will correct it self next time the use logs in
##
## the following example are from my mods, and you can add some self, for other mods if you like
## you will after execution get a list over those commands that are run with succes and those with warnings !
## delete the sample lines if you are using it only for other mods
##
#########################################################
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/functions_selects.'.$phpEx);
###################################################################################################
##
## put the SQL commands below here, the SQL commands listed below are only exampels, substitude them with the one you need ##
##
###################################################################################################
$sql=array(
'ALTER TABLE '. GROUPS_TABLE .' ADD group_count INT (4) UNSIGNED DEFAULT "99999999"',
'ALTER TABLE '. GROUPS_TABLE .' ADD group_count_max INT (4) UNSIGNED DEFAULT "99999999"',
'ALTER TABLE '. GROUPS_TABLE .' ADD group_count_enable SMALLINT (2) UNSIGNED DEFAULT "0"'
);
$mods = array (
'Auto group Mod2','Auto group Mod2',
'Auto group Mod2'
);
############################################### Do not change anything below this line #######################################
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
if ($userdata['user_level']!=ADMIN)
message_die(GENERAL_ERROR, "You are not Authorised to do this");
$n=0;
$message="<b>This list is a result of the SQL queries needed for mod</b><br/><br/>";
while($sql[$n])
{
$message .= ($mods[$n-1] != $mods[$n]) ? '<p><b><font size=3>'.$mods[$n].'</font></b><br/>' : '';
if(!$result = $db->sql_query($sql[$n]))
$message .= '<b><font color=#FF0000>[Already added]</font></b> line: '.($n+1).' , '.$sql[$n].'<br />';
else $message .='<b><font color=#0000fF>[Added/Updated]</font></b> line: '.($n+1).' , '.$sql[$n].'<br />';
$n++;
}
message_die(GENERAL_MESSAGE, $message);
?>

