Answers.Body: <p>Based on your code excerpts, things look good.  I've encountered issues with spelling and caps  when referencing controllers and templates within my controllers...so pay close attention to them.</p>
  
  <p>I would suggest referencing the 'Cocktail Recipes' sample plugin: <a href="https://github.com/seandelaney/cocktailrecipes" rel="nofollow">https://github.com/seandelaney/cocktailrecipes</a> (Craft 2.x) as it contains an example of what you're trying to do.</p>
  
  <p>EDIT: Updated link to Craft 2.x version as per comment below.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-28T03:03:09.787Z
Answers.Text: For future reference, that plugin is outdated and has been forked to this repo with updates: https://github.com/seandelaney/cocktailrecipes
Answers.UserDisplayName: Jason McCallister
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-28T01:34:12.080Z
Answers.LastActivityDate: 2015-06-12T13:14:14.767Z
Answers.LastEditDate: 2015-06-12T13:14:14.767Z
Answers.UserDisplayName: nateiler
Answers.Body: <p>Dumb ass typo : "siteadministator" instead of siteadministRator <em>sigh</em> ... Sorry for taking up bytes. </p>
  
  <p>Working method now is: </p>
  
  <pre><code>public function hookRegisterCpRoutes()
  {
      return array(
          'siteadministrator/currentusers' =&gt; array('action' =&gt; 'siteAdministrator/user/current'),
      );
  }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-28T18:42:55.550Z
Answers.LastActivityDate: 2014-07-28T18:42:55.550Z
Answers.UserDisplayName: pythic
Answers.Body: <p>The documentation on Craft's website covers registering control panel routes here: </p>
  
  <p><a href="http://buildwithcraft.com/docs/plugins/controllers#how-controller-actions-fit-into-routing" rel="nofollow">Posting to Controller Actions</a></p>
  
  <p><strong>Troubleshooting</strong></p>
  
  <p>According to the documentation your route is setup correctly. I have had an experience where a route would not register. I took the following steps to troubleshoot:</p>
  
  <ol>
  <li>Uninstalled the plugin</li>
  <li>Reinstalled the plugin</li>
  <li>Checked spelling on the controller and the main plugins class 'registerCpRoutes' method.</li>
  </ol>
  
  <p>However, if you are at a point where uninstalling is out of the question, I would again check for spelling and make sure there are no typos or missing brackets in the controller and main plugin class. In my case, I found a small typo and that corrected my issue. </p>
  
  <p><strong>Debugging/Linters</strong> </p>
  
  <p>Depending on what text editor you are using, you might also want to look at using a Linter. A linter for PHP essentially runs the command line <code>php -l</code> which will check the syntax on your PHP file.</p>
  
  <p>I use Atom on a daily basis and use the <a href="https://atom.io/packages/linter-php" rel="nofollow">Atom Linter</a> package. However, I know Sublime has a Linter package as well but I am not familiar with that one.</p>
  
  <p><strong>Helper Plugins</strong> </p>
  
  <p>You may also want to look into installing this plugin from Matt Stauffer: <a href="https://github.com/mattstauffer/craftPluginDevHelpers" rel="nofollow">Plugin Dev Helpers</a>. This will allow you to use the 'die and dump' helper that exists in the Laravel framework. Essentially allowing you to use <code>dd($anyVariableName)</code>, which will dump and die but allows you to pass variables to the output.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-27T20:48:17.603Z
Answers.Text: Computer says no...:(
Answers.UserDisplayName: pythic
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-27T20:50:06.153Z
Answers.Text: Yeah, you are right. Just looked at some of my code and realized I was wrong. Looking into it now.
Answers.UserDisplayName: Jason McCallister
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-27T21:10:12.677Z
Answers.Text: I updated the answer, let me know if I can help.
Answers.UserDisplayName: Jason McCallister
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-27T21:15:38.660Z
Answers.Text: I'll try the above tomorrow, its getting kind of late over here. I have a client waiting in the morning :) Thank you so far
Answers.UserDisplayName: pythic
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-28T18:42:40.467Z
Answers.Text: Thanks for all the tips above. What I did notice is that in the cocktailrecipe example the registerCpRoutes method is not used, he uses hookRegisterCpRoutes. Not sure that the difference is but they both get called by the framework. Anyway that didn't solve my problem... What did solve it is that after 14 hrs of coding I made a typo, its hiding in plain sight...  "siteadministator" instead of siteadministRator *sigh* ... Sorry for taking up bytes.
Answers.UserDisplayName: pythic
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-28T18:44:03.647Z
Answers.Text: btw sometimes I use phpstorm, sometimes sublime. Depends on my mood. I'll take a look at that lint thing you suggested
Answers.UserDisplayName: pythic
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-27T20:47:09.983Z
Answers.LastActivityDate: 2014-07-27T21:34:44.983Z
Answers.LastEditDate: 2014-07-27T21:34:44.983Z
Answers.UserDisplayName: Jason McCallister
Body: <p>I'm having trouble registering a CP route. What I have is a "working" SiteAdministrator_UserController.php (other form save actions already work through this controller, so its functional). Inside the controller I have a function :</p>
  
  <pre><code>public function actionCurrent()
  {
      die ('Works!');
  }
  </code></pre>
  
  <p>In my Plugin I have the following:</p>
  
  <pre><code>public function registerCpRoutes()
  {
      return array(
          'siteadministator/currentusers' =&gt; array('action' =&gt; 'siteAdministrator/user/current')
      );
  }
  </code></pre>
  
  <p>trying the uri <a href="http://cms.craft.dev/admin/siteadministrator/currentusers" rel="nofollow">http://cms.craft.dev/admin/siteadministrator/currentusers</a></p>
  
  <p>Craft says its a  404. </p>
  
  <p>What am I doing wrong and/or is there a way to debug this?</p>
  
  <p>Thanks in advance</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-07-27T21:01:20.237Z
Comments.Text: Can you post your entire controller code? Minus any details you do not want to share of course.
Comments.UserDisplayName: Jason McCallister
Tags: <plugin-development><routes>
Title: Havin trouble with registerCpRoutes
ThreadText: # Havin trouble with registerCpRoutes
  
  (Asked by: username_0 on 2014-07-27)
  
  I'm having trouble registering a CP route. What I have is a "working" SiteAdministrator\_UserController.php (other form save actions already work through this controller, so its functional). Inside the controller I have a function :
  
  ```
  public function actionCurrent()
  {
      die ('Works!');
  }
  
  ```
  
  In my Plugin I have the following:
  
  ```
  public function registerCpRoutes()
  {
      return array(
          'siteadministator/currentusers' => array('action' => 'siteAdministrator/user/current')
      );
  }
  
  ```
  
  trying the uri <http://cms.craft.dev/admin/siteadministrator/currentusers>
  
  Craft says its a 404.
  
  What am I doing wrong and/or is there a way to debug this?
  
  Thanks in advance
  
  **Tags:** plugin-development, routes
  
  > **Comments:**
  > **username_1**: Can you post your entire controller code? Minus any details you do not want to share of course.  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_2 on 2014-07-28. Score: 5
  
  Based on your code excerpts, things look good. I've encountered issues with spelling and caps when referencing controllers and templates within my controllers...so pay close attention to them.
  
  I would suggest referencing the 'Cocktail Recipes' sample plugin: <https://github.com/seandelaney/cocktailrecipes> (Craft 2.x) as it contains an example of what you're trying to do.
  
  EDIT: Updated link to Craft 2.x version as per comment below.
  
  > **Comments:**
  > **username_1**: For future reference, that plugin is outdated and has been forked to this repo with updates: https://github.com/seandelaney/cocktailrecipes  
  
  ---
  
  ### Answer by username_0 on 2014-07-28. Score: 4
  
  Dumb ass typo : "siteadministator" instead of siteadministRator *sigh* ... Sorry for taking up bytes.
  
  Working method now is:
  
  ```
  public function hookRegisterCpRoutes()
  {
      return array(
          'siteadministrator/currentusers' => array('action' => 'siteAdministrator/user/current'),
      );
  }
  
  ```
  
  
  ---
  
  ### Answer by username_1 on 2014-07-27. Score: 3
  
  The documentation on Craft's website covers registering control panel routes here:
  
  [Posting to Controller Actions](http://buildwithcraft.com/docs/plugins/controllers#how-controller-actions-fit-into-routing)
  
  **Troubleshooting**
  
  According to the documentation your route is setup correctly. I have had an experience where a route would not register. I took the following steps to troubleshoot:
  
  1. Uninstalled the plugin
  2. Reinstalled the plugin
  3. Checked spelling on the controller and the main plugins class 'registerCpRoutes' method.
  
  However, if you are at a point where uninstalling is out of the question, I would again check for spelling and make sure there are no typos or missing brackets in the controller and main plugin class. In my case, I found a small typo and that corrected my issue.
  
  **Debugging/Linters**
  
  Depending on what text editor you are using, you might also want to look at using a Linter. A linter for PHP essentially runs the command line `php -l` which will check the syntax on your PHP file.
  
  I use Atom on a daily basis and use the [Atom Linter](https://atom.io/packages/linter-php) package. However, I know Sublime has a Linter package as well but I am not familiar with that one.
  
  **Helper Plugins**
  
  You may also want to look into installing this plugin from Matt Stauffer: [Plugin Dev Helpers](https://github.com/mattstauffer/craftPluginDevHelpers). This will allow you to use the 'die and dump' helper that exists in the Laravel framework. Essentially allowing you to use `dd($anyVariableName)`, which will dump and die but allows you to pass variables to the output.
  
  > **Comments:**
  > **username_0**: Computer says no...:(  
  > **username_1**: Yeah, you are right. Just looked at some of my code and realized I was wrong. Looking into it now.  
  > **username_1**: I updated the answer, let me know if I can help.  
  > **username_0**: I'll try the above tomorrow, its getting kind of late over here. I have a client waiting in the morning :) Thank you so far  
  > **username_0**: Thanks for all the tips above. What I did notice is that in the cocktailrecipe example the registerCpRoutes method is not used, he uses hookRegisterCpRoutes. Not sure that the difference is but they both get called by the framework. Anyway that didn't solve my problem... What did solve it is that after 14 hrs of coding I made a typo, its hiding in plain sight...  "siteadministator" instead of siteadministRator *sigh* ... Sorry for taking up bytes.  
  > **username_0**: btw sometimes I use phpstorm, sometimes sublime. Depends on my mood. I'll take a look at that lint thing you suggested  
  
  ---
  
  