I would like to remove register button in Elgg login page - Elgg 3.3?

Is there any way to remove register button in Elgg login page while I would like to allow users to invite friends via email. I would like to prevent random visiters to register in my elgg site. Thank you in advance.

Closed2K views

Answers (2)

  • Download My plugin [Elgg 3]

    UnZip it and open file

    /my_plugin/classes/MyPlugin/Bootstrap.php

    Paste between line 43-45

    public function init() {


    }

    This code:

    elgg_unregister_plugin_hook_handler('register', 'menu:login', '_elgg_login_menu_setup');

    elgg_register_plugin_hook_handler('register', 'menu:login', function (\Elgg\Hook $hook) {
    $return = $hook->getValue();

    $return[] = \ElggMenuItem::factory([
    'name' => 'forgotpassword',
    'href' => elgg_generate_url('account:password:reset'),
    'text' => elgg_echo('user:password:lost'),
    'link_class' => 'forgot_link',
    ]);

    return $return;
    });

    So full code is;

    public function init() {
       elgg_unregister_plugin_hook_handler('register', 'menu:login', '_elgg_login_menu_setup');
    elgg_register_plugin_hook_handler('register', 'menu:login', function (\Elgg\Hook $hook) {
    $return = $hook->getValue();

    $return[] = \ElggMenuItem::factory([
    'name' => 'forgotpassword',
    'href' => elgg_generate_url('account:password:reset'),
    'text' => elgg_echo('user:password:lost'),
    'link_class' => 'forgot_link',
    ]);

    return $return;
    });
    }

    Save file.

    Copy the plugin's folder to /mod directory on your server.

    Activate 'My plugin' on the Plugins page

    Run 'Flush the caches' via Administration.

  • You can disable the registration on your site globally via Administration -> Site settings.

    On this page:

    • Disable 'Allow visitors to register' option

    In this case, users can't register on your site and you should add the new users manually.

    and/or

    • Enable 'New users require manual validation by an administrator' option

    In this case, users can register on your site but you should validate them manually before they can use the site.

     

    This is the best way than customization the login/register forms and routes.