Disabling the registration page for logged-in users

Hi
We are using OJS 2.4.6 and in this version logged-in users can enter the registration page and register with a new username. I added this code to RegistrationForm.inc.php in order to redirect the user:

if(Validation::isLoggedIn()){ header("Location: " . $baseUrl); /* Redirect browser */ exit(); }
but $baseUrl variable is not accessible in this page and I should replace it with the absolute Url of the website, which is not a good idea.
Is there a better way to prohibit the users from registration page?
How can I access the baseurl?

Best,
Al

You probably want this check as part of the registration handler, instead of the registration form. See:

You can generate a redirect via the Request object. An example is nearby in that file:

The redirect function is very flexible and well documented as to the parameters:

Please do open an Issue and Pull Request on Github for this, if you are able.

thank you @ctgraham,
problem solved.
I created the Issue