We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12878
    • 21 Posts
    I am in the process of creating a user registration script and need to find out what tables need to be modified to create a web user with membership in one group only. so far I know it adds a record to:

    web_users
    web_user_attributes
    web_user_settings

    but when creating a user I still cannot access from the manager, it says no user so I am sure i am missing something.

    anyone know what i am missing?

    thanks,

    Todd
      www.detroitunderground.net
      www.dtwaudi.com
      www.greymatterhosting.com
      new flash site in the works
      • 12878
      • 21 Posts
      oh i forgot about web_groups, updated that too and still no success.
        www.detroitunderground.net
        www.dtwaudi.com
        www.greymatterhosting.com
        new flash site in the works
      • oh i forgot about web_groups, updated that too and still no success.

        Web Users do not have permission to access the manager at all. You would want to create manager users in that case.
          • 12878
          • 21 Posts
          sorry I am creating a web user registration script to be accessed outside of the manager.
            www.detroitunderground.net
            www.dtwaudi.com
            www.greymatterhosting.com
            new flash site in the works
          • Web user signup and automatic creation will be available to you before the weekend is over.
              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
              • 12878
              • 21 Posts
              dude you guys rock!! although this means i could have been out drinking and partying all week...

              thx again!
                www.detroitunderground.net
                www.dtwaudi.com
                www.greymatterhosting.com
                new flash site in the works
                • 12878
                • 21 Posts
                bad news just talked with my client and they 'would like' to see the site up monday so I need to get something together before this weekend.

                does anyone know which tables do need to be updated in order to properly create a user via an external script?

                one other thing, I am trying to figure out how the password is encrypted so I can update the fields for that as well.

                Thanks,

                Todd
                  www.detroitunderground.net
                  www.dtwaudi.com
                  www.greymatterhosting.com
                  new flash site in the works
                  • 32963
                  • 1,732 Posts
                  bad news just talked with my client and they 'would like' to see the site up monday so I need to get something together before this weekend.

                  does anyone know which tables do need to be updated in order to properly create a user via an external script?

                  one other thing, I am trying to figure out how the password is encrypted so I can update the fields for that as well.

                  Thanks,

                  Todd

                  These tables should do the trick:

                  web_users
                  web_user_attributes
                    xWisdom
                    www.xwisdomhtml.com
                    The fear of the Lord is the beginning of wisdom:
                    MODx Co-Founder - Create and do more with less.
                    • 7455
                    • 2,204 Posts
                    bad news just talked with my client and they 'would like' to see the site up monday so I need to get something together before this weekend.

                    does anyone know which tables do need to be updated in order to properly create a user via an external script?

                    one other thing, I am trying to figure out how the password is encrypted so I can update the fields for that as well.

                    Thanks,

                    Todd

                    password is md5 encription

                    should be somthing like this SQL command
                    INSERT INTO `{PREFIX}web_users` VALUES (2, 'USERNAME', MD5('USERPASS'));
                      follow me on twitter: @dimmy01
                      • 12878
                      • 21 Posts
                      ok awesome so i am almost done, just one last little problem. The internalKey is not a auto-incrementing key nor can it be since the id column is already. i need to figure out how to increment this to match the id column, or to copy the id key into the internalKey column. i know there is a way to count the rows and turn that into a variable, just not sure how to do it yet.

                        // add user
                      if($action=='addUser') 
                      
                      	{ 
                      
                      
                      	$username = $_POST['username'];
                      	$password = $_POST['password'];
                      	$password2 = $_POST['password2'];
                      	$company = $_POST['company'];
                      	$fullname = $_POST['fullname'];
                      	$email = $_POST['email'];
                      	$city = $_POST['city'];
                      	$state = $_POST['state'];
                      	$phone = $_POST['phone'];
                      //this needs to be fixed, it has to be the same as the id field of that same row since it is autogenerated.
                      	$internalKey = '***THIS MUST MATCH ID FIELD IN SAME ROW***';
                      
                      	if($password==$password2)
                      		{
                      		$conn = mysql_connect("$dbhost","$dbuser","$dbpass") or die ("Cant connect to Database");
                      
                      		$db = mysql_select_db("$dbname") or die ("database gone."); 
                      
                      		$sql = "INSERT INTO `etomite_web_user_attributes` (id, internalKey, company, fullname, email, city, state, phone) VALUES ('NULL', '$internalKey', '$company', '$fullname', '$email', '$city', '$state', '$phone')";
                      		$sql2 = "INSERT INTO `etomite_web_users` (`id`, `username`, `password`) VALUES ('NULL', '$username', '$password')";
                      		$result = mysql_query($sql) or die ("SQL1 Not working try again"); 
                      
                      		$result2 = mysql_query($sql2) or die ("SQL2 Not working try again"); 
                      
                      		if($result) 
                      
                      			{ 
                      
                      			header("Location: index.php?id=74");
                      
                      			} 
                      
                      		
                      		}
                      	}
                      


                      here are the files as promised, and warning this is a quick hack. I know it could have been done much cleaner and probably will be but i hope this can help out someone else out there.

                      usrProf.php - main php file
                      config_inc.php - db config info
                      addUser.chunk
                      updateProfile.chunk
                      chgPasswd.chunk
                      viewProfile.chunk
                      TemplateVariables.txt
                      getUserID.snippet
                      getLoginName.snippet

                      there is not much, if any, validation being done. but it does work, well except for the above stated issue. but i am looking for some old code i had that did something like what i need done. maybe someone here can help out, either way it will be done by monday morning for sure!

                      Thanks,

                      Todd



                      http://greymatterhosting.com/downloads/modX2_web_usr_reg.tar.gz
                        www.detroitunderground.net
                        www.dtwaudi.com
                        www.greymatterhosting.com
                        new flash site in the works