We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24732 ☆ A M B ☆
    • 300 Posts
    Intriguing. I was reading the old MODX evo wiki here http://wiki.modxcms.com/index.php/Customizing_the_Manager_Homepage

    on how to customize the welcome screen and came across this:

    This applies to editing welcome.html. Add some links to what you want to do. For what I tend to do, it's adding some "Quick links" to create new documents. Here's an example with some links to create new documents under some existing parents (modify the PID values accordingly):
    <h3>QUICK LINKS:</h3>
    <ul style="padding-bottom:30px">
    	<li><a href="/manager/index.php?a=4&pid=19">Create new PR</a></li>
    	<li><a href="/manager/index.php?a=72&pid=21">Create new Media Coverage</a></li>
    </ul>


    and of course I went...hmmm. I wanna add a "add a new blog post" button then.

    However when I try ...a=4 apparently translates to "Action=4" in php, which makes a new resource. "a=72" makes a new weblink.
    p = parent id, I studied the index.php in the manager.

    got it.

    can I define the template we want the new resource to use?

    how? ;-)

    and right now when I load said link into my welcome.html, it gives me a 404. If I try it in the browser to test it, it thinks I am making a CSRF attempt.

    thoughts? Ideas? Insight?
      ________

      Anne
      Toad-in-Chief
      Red Toad Media - Web Design, Louisville KY
      Hear me tweet: http://www.twitter.com/redtoadmedia
      "Bring on the imperialistic condiments." - Rory Gilmore
      • 4041
      • 788 Posts
      That wiki page is kinda outdated and there are three plugin events added to the welcome.html file.
      https://forums.modx.com/thread/25012/event-onmanagerhomerender-onbeforemanagerhomerender?page=2#dis-post-128241


      To fix your links, try removing /manager/.

      To set a parent, try this:
      create a new plugin (named whatever) with the code below, and make sure to check the "On DocFormRender" on the event tab.
      // &tpl=XX
      if(isset($_GET['tpl'])){
          $_REQUEST['newtemplate'] =intval($_GET['tpl']);
      }


      Then in your links, add the &tpl=XX param (replace XX with the id of the preferred template) [ed. note: breezer last edited this post 14 years, 7 months ago.]
        xforum
        http://frsbuilders.net (under construction) forum for evolution
        • 4041
        • 788 Posts
        Here is a plugin of usage examples which might come in handy to someone, create a plugin (named whatever) with the code below, and check the events listed.
        /*
        check events:
          OnManagerWelcomePrerender
          OnManagerWelcomeHome
          OnManagerWelcomeRender
          OnDocFormRender
        
        https://forums.modx.com/thread/25012/event-onmanagerhomerender-onbeforemanagerhomerender?page=2#dis-post-128241
        */
        defined('IN_MANAGER_MODE') or die('<b>UNAUTHORIZED_ACCESS_ERROR</b>');
        $e = &$modx->Event;
        $out ='';
        switch ($e->name) {
        
        
            case 'OnManagerWelcomePrerender':
        
                // send the user an alert to the browser
                //$e->alert("This is an alert of some kind, probably important...");
        
                $out .='
                <div style="border:1px dotted orange; padding:15px;">
                    OnManagerWelcomePrerender content area
                </div>';
        
            break;
        
        
            case 'OnManagerWelcomeHome':
        
                $out .='
                <div style="padding-left:20px;">
                    <b>QUICK LINKS:</b>
                    <ul style="padding-bottom:10px">
                        <li><a href="index.php?a=4&pid=19&tpl=4">Create new PR</a></li>
                        <li><a href="index.php?a=72&pid=21">Create new Media Coverage</a></li>
                    </ul>
                </div>';
        
            break;
        
        
            case 'OnManagerWelcomeRender':
            
                // create a new tab via an included file
                //include MODX_BASE_PATH.'assets/plugins/manager_welcome_screen/omwr_new_tab.php';
        
                $replace = array(
                    '[+tab_id+]'       => 'OnManagerWelcomeRender',  // unique name
                    '[+tab_title+]'    => 'New Tab OMWR',            // tab title
                    '[+header_title+]' => 'OnManagerWelcomeRender'   // page header title
                );
        
                $tpl ='
                <!-- new tab -->
                <div class="tab-page" id="[+tab_id+]" style="padding-left:0; padding-right:0">
                    <h2 class="tab">[+tab_title+]</h2>
                    <script type="text/javascript">tpPane.addTabPage( document.getElementById( "[+tab_id+]" ) );</script>
                    <div class="sectionHeader">[+header_title+]</div>
                    <div class="sectionBody">
        
        <!-- tab content section -->
        
        <p>
        Edit the content here, or add code or whatever
        </p>
        
        <!-- /tab content section -->
                    </div>
                </div>
                <!-- /new tab -->';
        
                $out .= str_replace(array_keys($replace),array_values($replace),$tpl);
        
        
                // create a section which is persistant beneath the main content body
                $out .='
                <div style="border:1px dotted orange; padding:15px;">
                    OnManagerWelcomeRender content area
                </div>';
                
            break;
            
            
            case 'OnDocFormPrerender':
                // &tpl=XX
                if(isset($_GET['tpl'])){
                    $_REQUEST['newtemplate'] =intval($_GET['tpl']);
                }
            break;
        
        
            default: $out ='';
            break;
        }
        
        $e->output($out);
        
        return;
        
          xforum
          http://frsbuilders.net (under construction) forum for evolution
          • 24732 ☆ A M B ☆
          • 300 Posts
          wow.

          gee breezer, what a gift. I didn't get you anything. Definitely owe ya. Humble thanks.
            ________

            Anne
            Toad-in-Chief
            Red Toad Media - Web Design, Louisville KY
            Hear me tweet: http://www.twitter.com/redtoadmedia
            "Bring on the imperialistic condiments." - Rory Gilmore
            • 4041
            • 788 Posts
            Your welcome, glad it helped.
            I should also thank you, familiarizing myself with these events was already on the list for a pet project so your question helped motivate me smiley
              xforum
              http://frsbuilders.net (under construction) forum for evolution