Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

$fromCountryId -- in a messages that was sent from the form on website

$fromCountryId -- in a messages that was sent from the form on website

Hello,
How to do that in the messages that come from the feedback forms was the country code?
For example before the IP address
The following is part of the file that generates the signature in the message.
But my knowledge is not sufficient to add the country code before the IP address.

fadminmailer.php

public function Process()
        {
            $mail = JFactory::getMailer();

            $this->set_from($mail);
            $this->set_to($mail, "to_address", "addRecipient");
            $this->set_to($mail, "cc_address", "addCC");
            $this->set_to($mail, "bcc_address", "addBCC");

            $mail->setSubject(JMailHelper::cleanSubject($this->Params->get("email_subject", "")));

            $body = $this->body();
            $body .= $this->attachments($mail);
            $body .= PHP_EOL;

            // Info about url $geoip->country_code
            $body .= $this->Application->getCfg("sitename") . " - " . $this->CurrentURL() . PHP_EOL;
            // Info about client
            $body .= "Client: " . $this->ClientIPaddress() . " - " . $_SERVER['HTTP_USER_AGENT'] . PHP_EOL;


            $body = JMailHelper::cleanBody($body);
            $mail->setBody($body);

            $this->Logger->Write("---------------------------------------------------" . PHP_EOL . $body);
            return $this->send($mail);
        }

Thanks
Dmytro

Edited By: diim
18-Sep-13 13:35:36

diim
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: $fromCountryId -- in a messages that was sent from the form on website

If the MetaMod class has already been loaded AND has already loaded GeoIP information (ie. module is published, assigned to the current page, in a valid module position, and GeoIP is turned on in the MetaMod parameters) then you can do this once you have the IP address:

list( $fromCountryId, $fromCountryName, $geoip) = modMetaModHelper::geoip_cache_ip_countryid_name_city( $ip );

Then you can use $fromCountryId and $fromCountryName.

The problem you may have is that if your code is in a component, then the modules may not have been executed before your code gets run.

If your code gets run from the MetaMod then that would work fine.

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3329 Posts
User info in posts
Administrator has disabled public posting

Re: $fromCountryId -- in a messages that was sent from the form on website

it work
but need:

session_start();

...

Thanks

diim
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1696
Total Polls:
6
Total Posts:
5941
Posts this week:
7
User Info:
 
Total Users:
5418
Newest User:
outsd2
Members Online:
0
Guests Online:
131

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked