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
    nice tutorial
    you forgot to mention that when creating the plugin the onWebSaveUser event must be selected. else the plugin is not triggerd
      follow me on twitter: @dimmy01
      • 25551 ☆ A M B ☆
      • 1,231 Posts
      There’s always something I miss lol.

      Updated! Thanks Dimmy.
        Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
        AugmentBLU - MODX Partner

        BLUcart - MODX Revolution E-Commerce & Shopping Cart
        • 25551 ☆ A M B ☆
        • 1,231 Posts
        Dimmy,

        Do you think I could tie in a front end manager snippet with this? I have another site for gamers that I would like to create pages that a member can edit so it’s a personal page for them that other members can view but not edit.

        Thanks!
          Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
          AugmentBLU - MODX Partner

          BLUcart - MODX Revolution E-Commerce & Shopping Cart
          • 7455
          • 2,204 Posts
          you could use fdm for that
          I used FDM on a site that way
            follow me on twitter: @dimmy01
            • 25551 ☆ A M B ☆
            • 1,231 Posts
            Yeah that’s the snippet I meant... I’m trying it out now.

            Can see this is going to be fun trying to get this working with permissions! I’m working on it as we speak and I can’t even get the FDM to write the updated info to a document let alone sort the permissions lol.

            I don’t suppose you managed to do it the way I want?

            user signs up and pages are created.
            One of the created pages has the FDM snippet call so that user can edit their own page, all others can see this page but not edit it.


            Checking the FDM docs I see you can set the permissions to groups, do you think your snippet & plugin can set that only the user can edit the document?
              Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
              AugmentBLU - MODX Partner

              BLUcart - MODX Revolution E-Commerce & Shopping Cart
              • 7455
              • 2,204 Posts
              I did exactly what you want.
              Maybe we need a new treat for this.

              hehe
                follow me on twitter: @dimmy01
                • 25551 ☆ A M B ☆
                • 1,231 Posts
                LOL! I’m getting somewhere with it now...

                I’ll get as far as I can and post in the FDM thread to see if there’s a way to set permissions that only the person who created a doc can edit it.

                Thanks anyway!

                Ross grin
                  Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
                  AugmentBLU - MODX Partner

                  BLUcart - MODX Revolution E-Commerce & Shopping Cart
                  • 7455
                  • 2,204 Posts
                  this is my call on the page that can be edited
                  [!FDM? &eform_tpl=`eigenpaginaform` &canpost=`users` &parent=`9` &disableadd=`1` &redirect=`[*id*]` &output=`0` &trusted=`users` &language=`dutch`!]

                  it will look at the loggedin user id and the owner of the page (set by the plugin we made before) if that person is logged in than he can edit.
                    follow me on twitter: @dimmy01
                    • 25551 ☆ A M B ☆
                    • 1,231 Posts
                    I’m needing a little help using the plugin to automatically add the created docs to a webuser group so it’s only accessible to a set group. I took out the clientredirect snippet as this one is for a different site of mine.

                    I had a look through the tables on the database and I suspect all that needs done is the documents added to the document_group which in this case is document_group 2.

                    if($mode=="new"){   
                    $wuid = '-'.$user['internalKey'];
                    	$table_name = $modx->getFullTableName( 'site_content' );
                    	$fields = array(
                                            'type'	=>  'document',
                    			'contentType'	=> 'text/html',
                    			'content'	=> 'info text here',
                    			'pagetitle'	=> 'main page',
                    			'longtitle'	=> 'Main page',
                    			'published'	=> '1', //is the page published?
                    			'parent'	=> '38', //what is the parent of this new page?
                    			'isfolder'	=> '1', // lets make this a folder
                    			'template'	=> '4', //type template id here
                    			'cacheable'	=> '0',
                    			'createdby'	=> $wuid, 
                    			'createdon'	=> time(),
                    			'editedon'	=> time(),
                    			'publishedon'	=> time(),
                    			'hidemenu'	=> '0',
                    			'privateweb'	=> '1',
                    
                    			
                    			);
                    	
                    	$modx->db->insert( $fields, $table_name); // put the fields in the db (id wil be created incremental.)
                    
                    
                    //start of page creation, copy this part and past below for as many docs you want (I know we could use a loop but than the logtitle and page title are all the same)
                    $fields = array(
                                            'type'	=>  'document',
                    			'contentType'	=> 'text/html',
                    			'content'	=> 'jot call in here',
                    			'pagetitle'	=> 'Blog',
                    			'longtitle'	=> 'Blog',
                    			'published'	=> '1', //is the page published?
                    			'parent'	=> $parent, //here we go create a doc in the first doc
                    			'isfolder'	=> '0',
                    			'template'	=> '4', //type template id here
                    			'cacheable'	=> '0',
                    			'createdby'	=> $wuid,
                    			'createdon'	=> time(),
                    			'editedon'	=> time(),
                    			'publishedon'	=> time(),
                    			'hidemenu'	=> '0',
                    			'privateweb'	=> '1',
                    		
                    			);
                    	
                    	$modx->db->insert( $fields, $table_name); // put the fields in the db (id wil be created incremental.)
                    //end of page creation
                    
                    
                       return;
                    }


                    There is the snippet again in basic form. I did have a shot at it, but it totally didn’t work.
                    I added the ’privateweb’ => ’1’, which was easy enough to get working but I’m unsure on how to allocate the documents to a group.

                    Any help would be great.

                    Ross
                      Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
                      AugmentBLU - MODX Partner

                      BLUcart - MODX Revolution E-Commerce & Shopping Cart
                      • 4041
                      • 788 Posts
                      This is untested but should work... add this after your document creation part so it can grab the last id and use it to populate the table


                      [tt]/* grab the last inserted ID so we can set the document group and page id it belongs to*/
                      $last_inserted_id = mysql_insert_id();
                      $table_name = $modx->getFullTableName( ’document_groups’ );
                      $fields = array(
                      ’document_group’ => ’2’,
                      ’document’ => ’$last_inserted_id’,
                      );
                      $modx->db->insert( $fields, $table_name);[/tt]
                        xforum
                        http://frsbuilders.net (under construction) forum for evolution