We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7455
    • 2,204 Posts
    We are working on a maillinglist module that uses webgroups its almost finished but what we are looking for is a way to disable /hide the newsgroups that are mailgroups in the webuser admin/edit part of the manager. so that a manager can not add or remove people from a mailinglist. removing can be done in the module.
    so I looked at the code and noticed the part where the webgroups are gathered:
    <?php
    	echo $_lang['access_permissions_user_message']."<p />";
    	$sql = "SELECT name, id FROM $dbase.`".$table_prefix."webgroup_names` ORDER BY name";
    	$rs = mysql_query($sql);
    	$limit = mysql_num_rows($rs);
    	for($i=0; $i<$limit; $i++) {
    		$row=mysql_fetch_assoc($rs);
    		echo "<input type='checkbox' name='user_groups[]' value='".$row['id']."'".(in_array($row['id'], $groupsarray) ? " checked='checked'" : "")." />".$row['name']."<br />";
    	}
    ?>
    


    for us a small hack would do the trick:
    <?php
    	echo $_lang['access_permissions_user_message']."<p />";
    	$sql = "SELECT name, id FROM $dbase.`".$table_prefix."webgroup_names` WHERE type=0 ORDER BY name";
    	$rs = mysql_query($sql);
    	$limit = mysql_num_rows($rs);
    	for($i=0; $i<$limit; $i++) {
    		$row=mysql_fetch_assoc($rs);
    		echo "<input type='checkbox' name='user_groups[]' value='".$row['id']."'".(in_array($row['id'], $groupsarray) ? " checked='checked'" : "")." />".$row['name']."<br />";
    	}
    ?>
    


    just adding WHERE type=0 would do the trick

    but can this be done using a plugin or maybe jquery to hide those fields?
    or is it only possible by hacking the core?

    If we want to release this to the public that this issue must be fixed its not realy a cool idea to make user hack the core to make this module dummy proof.
      follow me on twitter: @dimmy01
      • 7455
      • 2,204 Posts
      I had to change 2 core files for this to work:

      manager/actions/mutate_web_user.dynamic.php
      line 545
      $sql = "SELECT name, id FROM $dbase.".$table_prefix."webgroup_names WHERE type = 0 ORDER BY name"; //added WHERE type=0

      and:

      manager/processors/save_web_user.processor.php
      line 356
      $sql = "DELETE FROM $dbase.".$table_prefix."web_groups WHERE webuser=$id AND date=’’;"; //added AND date=’’

      for now I settle with this I think
      Maybe when I release the mail module some people can think about a better way to keep webgroups and not hack the core

      Dimmy
        follow me on twitter: @dimmy01