Auto Group not adding users with more posts

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 !

Auto Group not adding users with more posts

Postby MonsterDK on Sun 04. Dec, 2005 22:12

I have it set so that users with '0' posts make a post and are added to the UserGroup.

So I have it set as 1 & 999999
With the auto add user option enabled.

Any user with more than 1 post even when making another post, is not added.

Why is this?
MonsterDK
Poster
Poster
 
Posts: 21
Joined: Sat 03. Dec, 2005 14:05

Postby MonsterDK on Mon 05. Dec, 2005 00:49

How do I get the Rest of the members into this Usergroup.

I'm refering to 1300+ members :|
MonsterDK
Poster
Poster
 
Posts: 21
Joined: Sat 03. Dec, 2005 14:05

Postby Niels on Mon 05. Dec, 2005 00:52

checking the "add users" and "delete users" inside group management, this will update the curently users in this group (acording to the post count setting)

e.g. all existing users not already added to this group will be added, and any user not meating the postcount requirement ar removed from the usergroup.
(if a how-to is EM ready, it will mostly be bullet prof, since a machine is more picky than a human. :D)
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby MonsterDK on Mon 05. Dec, 2005 20:59

Niels wrote:checking the "add users" and "delete users" inside group management, this will update the curently users in this group (acording to the post count setting)

e.g. all existing users not already added to this group will be added, and any user not meating the postcount requirement ar removed from the usergroup.


ok, well this is not happening :(

I put ticks in all boxes and I get a '0' users etc etc nothing at all is changed.

Here is what I mean.....

The group was successfully updated
0 member(s) have been removed, 0 members are added to this group
MonsterDK
Poster
Poster
 
Posts: 21
Joined: Sat 03. Dec, 2005 14:05

Postby Niels on Mon 05. Dec, 2005 21:35

it should add any user witch have posted and not yet are a member.
if i does not do so, you might lok into the admin_groups.php file, to see if all changes have been done acording to the how-to.
did you install manually or with EM ?
(if a how-to is EM ready, it will mostly be bullet prof, since a machine is more picky than a human. :D)
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby MonsterDK on Mon 05. Dec, 2005 22:38

Niels wrote:it should add any user witch have posted and not yet are a member.
if i does not do so, you might lok into the admin_groups.php file, to see if all changes have been done acording to the how-to.
did you install manually or with EM ?


Manually.




Here is ALL areas I edited from my admin_groups.php. In order as tthey are refered to in the instructions.



Code: Select all
      $template->assign_block_vars('group_edit', array());

   }
   else if ( isset($HTTP_POST_VARS['new']) )
   {
      $group_info = array (
         'group_name' => '',
         'group_description' => '',
         'group_moderator' => '',
         'group_count' => '99999999',
         'group_count_max' => '99999999',
         'group_count_enable' => '0',
         'group_type' => GROUP_OPEN);
      $group_open = ' checked="checked"';

      $mode = 'newgroup';



Code: Select all
   $group_open = ( $group_info['group_type'] == GROUP_OPEN ) ? ' checked="checked"' : '';
   $group_closed = ( $group_info['group_type'] == GROUP_CLOSED ) ? ' checked="checked"' : '';
   $group_hidden = ( $group_info['group_type'] == GROUP_HIDDEN ) ? ' checked="checked"' : '';
   $group_count_enable_checked = ( $group_info['group_count_enable'] ) ? ' checked="checked"' : '';



Code: Select all
   $template->assign_vars(array(
      'GROUP_NAME' => $group_info['group_name'],
      'GROUP_DESCRIPTION' => $group_info['group_description'],
      'GROUP_MODERATOR' => $group_moderator,
      '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'],



Code: Select all
      $group_type = isset($HTTP_POST_VARS['group_type']) ? intval($HTTP_POST_VARS['group_type']) : GROUP_OPEN;
      $group_name = isset($HTTP_POST_VARS['group_name']) ? trim($HTTP_POST_VARS['group_name']) : '';
      $group_description = isset($HTTP_POST_VARS['group_description']) ? trim($HTTP_POST_VARS['group_description']) : '';
      $group_moderator = isset($HTTP_POST_VARS['username']) ? $HTTP_POST_VARS['username'] : '';
      $delete_old_moderator = isset($HTTP_POST_VARS['delete_old_moderator']) ? true : false;
      $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;

      if ( $group_name == '' )



Code: Select all
         }

         $sql = "UPDATE " . GROUPS_TABLE . "
            SET group_type = $group_type, group_name = '" . str_replace("\'", "''", $group_name) . "', group_description = '" . str_replace("\'", "''", $group_description) . "', group_moderator = $group_moderator, group_count='$group_count', group_count_max='$group_count_max', group_count_enable='$group_count_enable'
            WHERE group_id = $group_id";




Code: Select all
         {
            message_die(GENERAL_ERROR, 'Could not update group', '', __LINE__, __FILE__, $sql);
         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++;
            }
         }
         }
   
         $message = $lang['Updated_group'] . '<br />'.sprintf($lang['group_count_updated'],$group_count_remove,$group_count_added). '<br /><br />' . sprintf($lang['Click_return_groupsadmin'], '<a href="' . append_sid("admin_groups.$phpEx") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>');;

         message_die(GENERAL_MESSAGE, $message);
      }
      else if( $mode == 'newgroup' )




Code: Select all
         }
         }
   
         $message = $lang['Updated_group'] . '<br />'.sprintf($lang['group_count_updated'],$group_count_remove,$group_count_added). '<br /><br />' . sprintf($lang['Click_return_groupsadmin'], '<a href="' . append_sid("admin_groups.$phpEx") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>');;

         message_die(GENERAL_MESSAGE, $message);






Code: Select all
      else if( $mode == 'newgroup' )
      {
         $sql = "INSERT INTO " . GROUPS_TABLE . " (group_type, group_name, group_description, group_moderator, group_count, group_count_max, group_count_enable, group_single_user)
            VALUES ($group_type, '" . str_replace("\'", "''", $group_name) . "', '" . str_replace("\'", "''", $group_description) . "', $group_moderator, '$group_count','$group_count_max','$group_count_enable',   '0')";
         if ( !$db->sql_query($sql) )




Code: Select all
message_die(GENERAL_ERROR, 'Could not insert new user-group info', '', __LINE__, __FILE__, $sql);

         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++;
            }
         }
         }
         
         $message = $lang['Added_new_group'] . '<br />'.sprintf($lang['group_count_updated'],$group_count_remove,$group_count_added). '<br /><br />' . sprintf($lang['Click_return_groupsadmin'], '<a href="' . append_sid("admin_groups.$phpEx") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>');;

         message_die(GENERAL_MESSAGE, $message);





Code: Select all
}
         
         $message = $lang['Added_new_group'] . '<br />'.sprintf($lang['group_count_updated'],$group_count_remove,$group_count_added). '<br /><br />' . sprintf($lang['Click_return_groupsadmin'], '<a href="' . append_sid("admin_groups.$phpEx") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>');;

         message_die(GENERAL_MESSAGE, $message);
MonsterDK
Poster
Poster
 
Posts: 21
Joined: Sat 03. Dec, 2005 14:05

Postby MonsterDK on Mon 05. Dec, 2005 23:09

I have just gone over ALL the files and they appear fine as per the instructions.

So I don't know what the problem is :|
MonsterDK
Poster
Poster
 
Posts: 21
Joined: Sat 03. Dec, 2005 14:05

Postby MonsterDK on Mon 05. Dec, 2005 23:31

This part....

Code: Select all
'group_count' => '99999999',
'group_count_max' => '99999999',
'group_count_enable' => '0',


Should the above just be put into the admin_groups.php as it is, or should I change it?

I currently have it as displayed above.
MonsterDK
Poster
Poster
 
Posts: 21
Joined: Sat 03. Dec, 2005 14:05

Next

Return to Auto group [2.0.8/EM]

Who is online

Users browsing this forum: No registered users and 1 guest

cron