Custom Login


I'm running Elgg 3.3.12 and attempting to create a custom login page. I've created the plugin as per Elgg 3.0 recommended structure, but I'm having problems with redirecting the action to use the login script in my_plugin > actions > myplugin. I have read many pages of documentation and looked at other plugins, but I cannot get it work. Either it defaults to the Elgg login script or says "You don't have permission to view the requested page" or the "action/login cannot be found". I'm now completely lost.

Could someone please point me in the right direction or to an example?

Many thanks.

  • Have you defined 'action/login' in your plugin?

    In elgg-plugin.php:

    'actions' => [
       'login' => [
           'access' => 'public',
    The mentioned code means you have your own custom login action in /mod/YOUR_COOL_PLUGIN/actions/login.php
  • You're a star! I needed both your suggestions. 
    The problem was I had read so many different examples and docs relating to earlier Elgg versions I ended up with a muddle of actions, routes and calls to registers. i.e. in elgg-plugin.php I had tried:
    'actions' => [ 'login' => [], ],
    'login' => ['path' => '/actions/my_plugin', 'resource' => 'actions/my_plugin', ],]
    'actions' => ['login' => ['access' => 'public', 'filename' => __DIR__ . '/actions/login.php']

    I was also a little confused about the correct directory structure, I had incorrectly placed the login script in my_plugin/actions/my_plugin

    Thanks again.

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking