We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16085
    • 203 Posts
    I’m trying to limit using the manager backend for adding webusers, mainly because I need to add some custom fields and I don’t want to edit anything backend. I’ve used WebLoginPE to create the ’New User’ and ’Mange User’ templates which works really well.

    Edit: I’ve found the core files ’mutate_web_user.dynamic.php’ & ’english.inc.php’ that allows me to add/change and display the custom fields I used in WebLoginPE &customFields for Manager editing. Which does what I need but it’s a bit hacky as I’m not 100% sure how I then manage future updates..

    But how do I pull the webgroup data via WebLoginPE into a drop down list and allow me to change it?
      • 28033
      • 925 Posts
      I don’t think Scotty implemented that before he stopped working on WLPE, AFAIK.
        My Snippets
        -> PopUpChunk v1.0
        • 16085
        • 203 Posts
        @Soshite, I think your right. &inputHandler is documented but example is based on given inputs. However I’ve just tried to use &customTable=`web_groups` &customFields=`webgroup` but it’s given me parse error.

        « Execution of a query to the database failed - Unknown column ’domainx.modx_web_groups.internalKey’ in ’where clause’ »
        SQL: SELECT * FROM `domainx`.`modx_web_groups`, `domainx`.`modx_web_user_attributes` WHERE `domainx`.`modx_web_user_attributes`.`internalKey` = '2' AND `domainx`.`modx_web_groups`.`internalKey` = '2' 


        Although I’m not sure I’m looking in the right table!?! huh
          • 4310
          • 2,310 Posts
          WHERE `domainx`.`modx_web_user_attributes`.`internalKey` = ’2’ AND `domainx`.`modx_web_groups`.`internalKey` = ’2’
          I think it would need to be :
          WHERE `domainx`.`modx_web_user_attributes`.`internalKey` = '2' AND `domainx`.`modx_web_groups`.`webuser` = '2'

          As there is no field internalKey in the modx_web_group table, not sure if that helps or not wink
            • 4172
            • 5,888 Posts
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 16085
              • 203 Posts
              That parse error was what MODx spat out.

              I’ve noticed in ’mutate_web_user.dynamic.php’ some code for WebGroup permissions. So just trying to see if that can be modified to work.

              <?php
              if($use_udperms==1) {
              $groupsarray = array();
              
              if($_GET['a']=='88') { // only do this bit if the user is being edited
              	$sql = "SELECT * FROM $dbase.`".$table_prefix."web_groups` where webuser=".$_GET['id']."";
              	$rs = mysql_query($sql);
              	$limit = mysql_num_rows($rs);
              	for ($i = 0; $i < $limit; $i++) {
              		$currentgroup=mysql_fetch_assoc($rs);
              		$groupsarray[$i] = $currentgroup['webgroup'];
              	}
              }
              
              // retain selected user groups between post
              if(is_array($_POST['user_groups'])) {
              	foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
              }
              
              ?>
              
              <div class="sectionHeader"><?php echo $_lang['web_access_permissions']; ?></div><div class="sectionBody">
              <?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 />";
              	}
              ?>
              </div>
                • 16085
                • 203 Posts
                @Bruno17, thanks that works perfectly. I’m ale to see what WebGroups are available and I’m able to switch or combine selections.

                *this hack should be added to the fix list.