ACP >> Modules >> HTML & JAVASCRIPT >> Javascript codes management >> Create a new javascript
- Title * : Login Redirect
- Placement : In all the pages
- Javascript Code * :
- Code:
/* Login Redirect by devs.forumvi.com */
$(function () {
0 == _userdata.session_logged_in && ($("a[href^='/login']").attr("href", function () {
if ("" == this.search || !/(\?|\&)redirect=.+/.test(this.search)) return "/login?redirect=" + location.pathname
}), $('form[action^="/login"] input[name="redirect"]').length || $('form[action^="/login"]').append('<input type="hidden" name="redirect" value="' + location.pathname + '" />'))
});