3

This is for Joomla 2.5, although I suspect that it is the same for the 3.x series.

I have a server sitting behind a NAT-ing firewall, and because of that the true IP address of the server is a 192.168 address, but for users to reach it they access it as www.mydomain.com, which is set to the outside address of the firewall (not a 192.168 address).

When a user is created, the default message goes out, which includes:

This email contains your username and password to log in to http:// 192.168.1.100

This address is not reachable, and I'd prefer to have the message be:

This email contains your username and password to log in to http://www.mydomain.com

I could go in and change the Joomla source code to force a change to the message, but I'm assuming there is a simpler way to resolve this and I'm just suffering from not seeing the forest because I'm too close to the trees.

I'm wondering if it is a simple as putting an entry in the host table, or a PTR record in the local DNS, that will map 192.168.1.100 onto www.mydomain.com.

1

Edit plugins/user/joomla/joomla.php:

$emailBody = JText::sprintf(
    'PLG_USER_JOOMLA_NEW_USER_EMAIL_BODY',
    $user['name'],
    $this->app->get('sitename'),
    JUri::root(),
    $user['username'],
    $user['password_clear']
);

Replace JUri::root() with http://www.mydomain.com

  • Thank you @csbenjamin for suggested edits, split my answer in two separate answers, kept your edits though. – sovainfo Apr 28 '14 at 20:28
  • This is not a good method. This could potentially be overwritten in an update from Joomla! – Steven Pignataro Apr 28 '14 at 20:34
  • Indeed, not an aswer for everybody. Expecting someone who can configure his server behind a NAT-ing firewall capable of dealing with changes in code. – sovainfo Apr 28 '14 at 20:44
3

You might try setting $live_site in configuration.php.

  • I agree that livesite should resolve this. Just add this variable into your configuration file: public $live_site = 'mysite.com'; The property won't exist but you can add it. Definitely try to avoid hacking core if possible. – Chad Windnagle Apr 28 '14 at 21:54
  • Absolutely agree, now that there are two acceptable workarounds. – sovainfo Apr 28 '14 at 22:05
3

create a language override for 'PLG_USER_JOOMLA_NEW_USER_EMAIL_BODY' in location administator:

PLG_USER_JOOMLA_NEW_USER_EMAIL_BODY="Hello %s,\n\n\nYou have been added as a User to HTTP://www.mydomain.com (%s) by an Administrator.\n\nThis email contains your username and password to log in to %s\n\nUsername: %s\nPassword: %s\n\n\nPlease do not respond to this message as it is automatically generated and is for information purposes only."

Change all %s by %1$s, %2$s, %3$s, %4$s Leaving out %2$s should suppress ip number

1

The most simple way is to edit the language file that contains that entry (hardcode it).

The language file is located in the folder: language (and then inside the language folder for each language installed).

For my sites it does get the domain, so maybe something is not correctly set up in your server.

  • 2
    You don't need to edit the language file. You can override it from the Language Manager in the backend. – Bakual Apr 28 '14 at 18:50
  • I'll have a look a the language file - as I was mentioning in my question, I was wondering if part of the issue is a reverse name lookup issue. I'll know better what I see in detail what the process is to derive that information. – Douglas Pickett Apr 28 '14 at 18:50
  • If you go this route using the language manager should suffice and be upgrade-proof. – Chad Windnagle Apr 28 '14 at 21:55
1

Found out what was going on - thanks for the suggestions which sent me down the right path.

In this case, the issue was because the admin creating the accounts was behind the same firewall as the server. The name for the system that was put in the message was created by picking up the "HTTP_HOST" value from the session environment and reflects the URL you connect with - which was not a name but an IP address in this situation. If you're behind the firewall, you get the behind the firewall value - if you're outside the firewall, you get the outside the firewall value, which is why this normally gives the correct answer when the server is in a hosted environment.

In order to get this to behave properly, I should have set up a DNS with split views - so that the admin is always connecting to www.mydomain.com. If you're behind the firewall, the DNS gives you the 192.168 address, if you're outside the firewall you receive the external IP when the symbol www.mydomain.com is resolved to an IP address.

Then, when the message is sent out, the body of the message contains www.mydomain.com in both cases.

As for how to override the http:// value sent out, yes, the suggestions about re-writing the code in plugins/user/joomla/joomla.php are correct. Except in this case - the site was using an extension "Login One" to limit simultaneous user sessions, and the extension replaced the standard Joomla code with a plugin of their own, so it needed to be changed in the extension code not the standard place.

So, thanks for all the suggestions, it would have been a lot harder to reach the answer without them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.