We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4429
    • 429 Posts

    Using webloginPE is there anyway to pull off or produce a list of users that includes all their details such as address, email, telephone etc..

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Yes. Your WebLoginPE display template just needs to have all of the placeholders for the data you want to display, which will include all fields in the usual MODx tables plus the custom table you’re using with WebLoginPE. Take a look a the defaultViewProfileTpl.html.txt file, in assets/snippets/webloginpe/Default Forms.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 4429
        • 429 Posts
        I’m talking about a way to download the data for use in say excel, or whatever.

        Obviously i can export the table from the database but that is hardly user friendly and it used codes for certain items, e.g UK is recorded as 222, which is useless to admins if i give them the exported tables.
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Create a document with no template, and an Internet Media Type of application/excel. Not sure if the content-disposition should be attachment; give that a try. Anyway, just have the WebLoginPE snippet call be the only content in that document, and use a custom chunk template for it to output whatever structure you need.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 4429
            • 429 Posts
            Quote from: sottwell at Nov 30, 2009, 04:22 PM

            Create a document with no template, and an Internet Media Type of application/excel. Not sure if the content-disposition should be attachment; give that a try. Anyway, just have the WebLoginPE snippet call be the only content in that document, and use a custom chunk template for it to output whatever structure you need.

            application/excel doesn’t exist. I can only choose text/plain text/html text/java etc...

            also looking here http://www.lucidgreen.net/modxGuides/wlpedocs/parameters.html

            what call would i use to point to my custom template? None of those seem appropriate
              • 4429
              • 429 Posts
              I haven’t made any progree on this.

              Obviously i can download an excel file from the databse using PHPMYADMIN but i want to be able to view and download the table from within modx
                • 4429
                • 429 Posts
                Right, so i have created a snippet as follows:

                <?php
                $output = '';//create variable for holding the output
                $sql = $modx->db->query( 'SELECT * FROM `ebmonthlyweb_user_attributes_extended` LIMIT 0, 1000');//define the DB query, in this case the table is named 'tblprojects', add WHERE AND etc. as needed
                $resultArray = $modx->db->makeArray( $sql );//put it into an array
                foreach($resultArray as $item)//go through each record in the array
                {//start looping through the data array
                $params['gender']=$item['gender'];
                $params['name']=$item['fullname'];
                $params['businessname']=$item['username'];
                $params['sector']=$item['business_type'];
                $params['subscriber']=$item['subscriber'];//set the placeholders, the $params sets the name of the placeholder, the $item is the column name from the DB table
                $params['address']=$item['address'];
                $params['city']=$item['city'];
                $params['county']=$item['state'];
                $params['postcode']=$item['zip'];
                $params['country']=$item['country'];
                $params['phone']=$item['phone'];
                $params['fax']=$item['fax'];
                $params['email']=$item['email'];
                $output.=$modx->parseChunk('databaseTpl', $params, '[+', '+]');//define the chunk name and process the content, here it's ProjectTpl which has the placeholders for the data
                }//finish looping through the data array
                return $output;//now return the output from the processed chunk
                ?>


                I have a chunk called databaseTpl:

                [+gender+],[+name+],[+sector+],[+subscriber+],[+address+],[+city+],[+county+],[+postcode+],[+country+],[+phone+],[+fax+],[+email+]<br/>


                This displays a comma deliminated list of the contents of my required table.

                But I need to be able to download this this list either as a plain txt file for importing into excel or as a CSV file.
                  • 27442
                  • 103 Posts
                  You can add custom content types in the modx configuration. I use application/vnd.ms-excel successfuly to generate excel files.
                    • 4429
                    • 429 Posts
                    Quote from: sottwell at Nov 30, 2009, 04:22 PM

                    Create a document with no template, and an Internet Media Type of application/excel. Not sure if the content-disposition should be attachment; give that a try. Anyway, just have the WebLoginPE snippet call be the only content in that document, and use a custom chunk template for it to output whatever structure you need.

                    Tried this and all got in the excel sheet was the actually php code for webloginPE

                    Have you successfully done this?

                    Cheers
                      • 4429
                      • 429 Posts
                      Anyone?

                      I really need the basic ability to just login click on a link and download all the data from the webusers_extended group and inport this into excel.