Skip to content

Commit

Permalink
Add registration menu to login module
Browse files Browse the repository at this point in the history
Add option in login module to set a menu item for registration page. Useful to override default registration link "index.php?option=com_users&view=registration" to a custom page
  • Loading branch information
Giuse69 committed Oct 13, 2019
1 parent 5400710 commit 245a9d8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 2 additions & 0 deletions language/en-GB/en-GB.mod_login.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ MOD_LOGIN_FIELD_LOGIN_REDIRECTURL_DESC="Select or create the page the user will
MOD_LOGIN_FIELD_LOGIN_REDIRECTURL_LABEL="Login Redirection Page"
MOD_LOGIN_FIELD_LOGOUT_REDIRECTURL_DESC="Select or create the page the user will be redirected to after ending their current session by logging out. The default is to stay on the same page."
MOD_LOGIN_FIELD_LOGOUT_REDIRECTURL_LABEL="Logout Redirection Page"
MOD_LOGIN_FIELD_REGISTRATION_MENU_LABEL="Registration link"
MOD_LOGIN_FIELD_REGISTRATION_MENU_DESC="Link to registration page: do not set anything for default Joomla link or set a specific menu item"
MOD_LOGIN_FIELD_NAME_DESC="Displays name or username after logging in."
MOD_LOGIN_FIELD_NAME_LABEL="Show Name/Username"
MOD_LOGIN_FIELD_POST_TEXT_DESC="This is the text or HTML that is displayed below the login form."
Expand Down
14 changes: 14 additions & 0 deletions modules/mod_login/mod_login.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,20 @@
<option value="">JDEFAULT</option>
</field>

<field
name="customRegLinkMenu"
type="modal_menu"
label="MOD_LOGIN_FIELD_REGISTRATION_MENU_LABEL"
description="MOD_LOGIN_FIELD_REGISTRATION_MENU_DESC"
disable="separator,alias,heading,url"
select="true"
new="true"
edit="true"
clear="true"
>
<option value="">JDEFAULT</option>
</field>

<field
name="greeting"
type="radio"
Expand Down
12 changes: 11 additions & 1 deletion modules/mod_login/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,17 @@
<ul class="unstyled">
<?php if ($usersConfig->get('allowUserRegistration')) : ?>
<li>
<a href="<?php echo JRoute::_('index.php?option=com_users&view=registration'); ?>">
<?php $regLinkMenuId = $params->get('customRegLinkMenu', 0);
if($regLinkMenuId == '' || $regLinkMenuId == '0')
{
$regLink = 'index.php?option=com_users&view=registration';
}
else
{
$regLink = 'index.php?Itemid=' . $regLinkMenuId;
}
?>
<a href="<?php echo JRoute::_($regLink); ?>">
<?php echo JText::_('MOD_LOGIN_REGISTER'); ?> <span class="icon-arrow-right"></span></a>
</li>
<?php endif; ?>
Expand Down

0 comments on commit 245a9d8

Please sign in to comment.