[OzzModz] Country Flags by IP Address

[OzzModz] Country Flags by IP Address 2.2.1 Patch Level 3

No permission to download
Thank you, gentlemen.

I'm not savvy enough to know the difference, so I suppose I'll try them one at a time and see what happens.

Appreciate the help!
 
@Snog

Sitelock doesn't seem to be working.

Should I disable that before implementing @ozzy47's suggestion above?
It SHOULD work if CloudFlare is setting HTTP_X_FORWARDED_FOR like they say they do.

But yes you should probably disable that before trying what Ozzy suggested.

If Ozzy's suggestion doesn't work, you'll need to contact Cloudflare to find out why the user's IP address isn't being returned.

And I didn't ask... is the IP address (and flag) the same for every user or is it different for every user?
 
And I didn't ask... is the IP address (and flag) the same for every user or is it different for every user?
So far, 3 different members in the UK are all displaying a Netherlands flag.

The IP addresses for all are different. Not seeing any consistencies.
 
So far, 3 different members in the UK are all displaying a Netherlands flag.

The IP addresses for all are different. Not seeing any consistencies.
Are they using a proxy to connect to the internet? If they are, that would explain the flag showing from the Netherlands. Especially if the proxy is in that country.

To check that, we would need their IP address and if possible a log of from the add-on with the user IDs in question. You can turn the logging on in the add-on options. Send the info by PC to either myself or Ozzy47 and we'll have a look at it.
 
Last edited:
I can add it to the wish list, but I have no idea when I would even begin to look into adding it, if ever.
 
I mean, a configuration for it would be nice :)

Some users care about their privacy and don't wish to have it publicly listed. I think an option to make people opt in to show their flags would be better than showing everyone's flags by default and make them opt out
 
Are they using a proxy to connect to the internet? If they are, that would explain the flag showing from the Netherlands. Especially if the proxy is in that country.

To check that, we would need their IP address and if possible a log of from the add-on with the user IDs in question. You can turn the logging on in the add-on options. Send the info by PC to either myself or Ozzy47 and we'll have a look at it.
Just to echo the PM for @ozzy47's sake:

I received the error:

"You may not start a conversation with the following recipients: ozzy47."

So had to remove @ozzy47 from the PM with the log attached.
 
As I had suspected, Cloudflare is returning it's IP address in HTTP_X_FORWARDED_FOR. The add-on is detecting the proxy as intended.

You need to contact Cloudflare to find out how to get the user's real IP address sent in HTTP_X_FORWARED_FOR.
 
You could also try this in your src/config.php file

Code:
// FIX IP ADDRESS FOR PROXY
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_REAL_IP'];
Hi Ozzy.

I removed the Cloudflare suggested config.php edit, and added this in it's place.
This has resulted in every user getting the "?" / Unknown flag.

Just FYI. I guess I will try to remove all config.php edits, leave Sitelock disabled, and reach out to Cloudflare.

As an FYI, the Cloudflare suggested Config.php tweak didn't seem to fix all users, but the addon was working generally well without it.
 
Yeah at this point it’s a crap shoot as to what is causing your issues. I really wish it was something easily identifiable that we could fix up right away, but it seems this gremlin is a bit feisty.
 
Hi Snog i am having an SQL error with Country Flags by IP Address 2.0.12 under XF2.1.3

Code:
XF\Db\Exception: MySQL query error [1366]: Incorrect string value: '\xF0\x9F\x98\xB2 \xC3...' for column 'message' at row 1 src/XF/Db/AbstractStatement.php:217

INSERT  INTO `xf_draft` (`user_id`, `draft_key`, `message`, `extra_data`, `draft_id`, `last_update`) VALUES (?, ?, ?, ?, ?, ?)
------------

#0 src/XF/Db/Mysqli/Statement.php(196): XF\Db\AbstractStatement->getException('MySQL query err...', 1366, 'HY000')
#1 src/XF/Db/Mysqli/Statement.php(77): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1366, 'HY000')
#2 src/XF/Db/AbstractAdapter.php(94): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Db/AbstractAdapter.php(221): XF\Db\AbstractAdapter->query('INSERT  INTO `x...', Array)
#4 src/XF/Mvc/Entity/Entity.php(1452): XF\Db\AbstractAdapter->insert('xf_draft', Array, false)
#5 src/XF/Mvc/Entity/Entity.php(1184): XF\Mvc\Entity\Entity->_saveToSource()
#6 src/XF/Draft.php(44): XF\Mvc\Entity\Entity->save()
#7 src/XF/ControllerPlugin/Draft.php(29): XF\Draft->save()
#8 src/XF/ControllerPlugin/Draft.php(11): XF\ControllerPlugin\Draft->updateMessageDraft(Object(XF\Draft), Array, 'message')
#9 src/XF/Pub/Controller/Forum.php(529): XF\ControllerPlugin\Draft->actionDraftMessage(Object(XF\Draft), Array)
#10 src/XF/Mvc/Dispatcher.php(321): XF\Pub\Controller\Forum->actionDraft(Object(XF\Mvc\ParameterBag))
#11 src/XF/Mvc/Dispatcher.php(248): XF\Mvc\Dispatcher->dispatchClass('XF:Forum', 'Draft', Object(XF\Mvc\RouteMatch), Object(Snog\Flags\XF\Pub\Controller\Forum), NULL)
#12 src/XF/Mvc/Dispatcher.php(100): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(Snog\Flags\XF\Pub\Controller\Forum), NULL)
#13 src/XF/Mvc/Dispatcher.php(50): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#14 src/XF/App.php(2178): XF\Mvc\Dispatcher->run()
#15 src/XF.php(390): XF\App->run()
#16 index.php(20): XF::runApp('XF\\Pub\\App')
#17 {main}

array(4) {
  ["url"] => string(37) "/forum/forums/canal-detente.437/draft"
  ["referrer"] => string(78) "https://www.tutoriaux-excalibur.com/forum/forums/canal-detente.437/post-thread"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(11) {
    ["title"] => string(0) ""
    ["message_html"] => string(898) "<p>Nous avons consacré toutes nos énergies de ces dernières semaines à la réalisation d'un projet assez particulier</p><p><br></p><div data-xf-p="1"><p>NOM DE CODE : RICARD 50</p><p><br></p><p>Ce véhicule est doté d'une mécanique Subaru à double injection directe 😲 à réservoirs externes permettant d'obtenir 567 CV à 9300 tours/minutes 😎 ce qui fait du RICARD 50 une arme redoutable&nbsp;</p><p><br></p><p>Une version destinée aux forces de l'ordre pourrait être proposée &nbsp;ainsi, le RICARD50 pourrait équiper la brigade du "ça va aller" &nbsp;à ce titre, en premier commentaire vous verrez la vidéo du prototype dûment équipé qui sera proposé afin de remplacer la très connue Mégane RS&nbsp;</p><p>En ce vendredi estivale, nous vous souhaitons à tous un bon week-end, et remercions l'équipe du garage RICARD 50 pour leur imagination&nbsp;</p></div><p><br></p>"
    ["attachment_hash"] => string(32) "c477875fb862e2f8821479ec0f10a580"
    ["attachment_hash_combined"] => string(83) "{"type":"post","context":{"node_id":437},"hash":"c477875fb862e2f8821479ec0f10a580"}"
    ["tags"] => string(0) ""
    ["_xfSet"] => array(1) {
      ["watch_thread"] => string(1) "1"
    }
    ["poll"] => array(5) {
      ["question"] => string(0) ""
      ["new_responses"] => array(1) {
        [0] => string(0) ""
      }
      ["max_votes_type"] => string(6) "single"
      ["change_vote"] => string(1) "1"
      ["view_results_unvoted"] => string(1) "1"
    }
    ["_xfRequestUri"] => string(43) "/forum/forums/canal-detente.437/post-thread"
    ["_xfWithData"] => string(1) "1"
    ["_xfToken"] => string(8) "********"
    ["_xfResponseType"] => string(4) "json"
  }
}
 
Hi Snog i am having an SQL error with Country Flags by IP Address 2.0.12 under XF2.1.3

Code:
XF\Db\Exception: MySQL query error [1366]: Incorrect string value: '\xF0\x9F\x98\xB2 \xC3...' for column 'message' at row 1 src/XF/Db/AbstractStatement.php:217

INSERT  INTO `xf_draft` (`user_id`, `draft_key`, `message`, `extra_data`, `draft_id`, `last_update`) VALUES (?, ?, ?, ?, ?, ?)
------------

#0 src/XF/Db/Mysqli/Statement.php(196): XF\Db\AbstractStatement->getException('MySQL query err...', 1366, 'HY000')
#1 src/XF/Db/Mysqli/Statement.php(77): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1366, 'HY000')
#2 src/XF/Db/AbstractAdapter.php(94): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Db/AbstractAdapter.php(221): XF\Db\AbstractAdapter->query('INSERT  INTO `x...', Array)
#4 src/XF/Mvc/Entity/Entity.php(1452): XF\Db\AbstractAdapter->insert('xf_draft', Array, false)
#5 src/XF/Mvc/Entity/Entity.php(1184): XF\Mvc\Entity\Entity->_saveToSource()
#6 src/XF/Draft.php(44): XF\Mvc\Entity\Entity->save()
#7 src/XF/ControllerPlugin/Draft.php(29): XF\Draft->save()
#8 src/XF/ControllerPlugin/Draft.php(11): XF\ControllerPlugin\Draft->updateMessageDraft(Object(XF\Draft), Array, 'message')
#9 src/XF/Pub/Controller/Forum.php(529): XF\ControllerPlugin\Draft->actionDraftMessage(Object(XF\Draft), Array)
#10 src/XF/Mvc/Dispatcher.php(321): XF\Pub\Controller\Forum->actionDraft(Object(XF\Mvc\ParameterBag))
#11 src/XF/Mvc/Dispatcher.php(248): XF\Mvc\Dispatcher->dispatchClass('XF:Forum', 'Draft', Object(XF\Mvc\RouteMatch), Object(Snog\Flags\XF\Pub\Controller\Forum), NULL)
#12 src/XF/Mvc/Dispatcher.php(100): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(Snog\Flags\XF\Pub\Controller\Forum), NULL)
#13 src/XF/Mvc/Dispatcher.php(50): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#14 src/XF/App.php(2178): XF\Mvc\Dispatcher->run()
#15 src/XF.php(390): XF\App->run()
#16 index.php(20): XF::runApp('XF\\Pub\\App')
#17 {main}

array(4) {
  ["url"] => string(37) "/forum/forums/canal-detente.437/draft"
  ["referrer"] => string(78) "https://www.tutoriaux-excalibur.com/forum/forums/canal-detente.437/post-thread"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(11) {
    ["title"] => string(0) ""
    ["message_html"] => string(898) "<p>Nous avons consacré toutes nos énergies de ces dernières semaines à la réalisation d'un projet assez particulier</p><p><br></p><div data-xf-p="1"><p>NOM DE CODE : RICARD 50</p><p><br></p><p>Ce véhicule est doté d'une mécanique Subaru à double injection directe 😲 à réservoirs externes permettant d'obtenir 567 CV à 9300 tours/minutes 😎 ce qui fait du RICARD 50 une arme redoutable&nbsp;</p><p><br></p><p>Une version destinée aux forces de l'ordre pourrait être proposée &nbsp;ainsi, le RICARD50 pourrait équiper la brigade du "ça va aller" &nbsp;à ce titre, en premier commentaire vous verrez la vidéo du prototype dûment équipé qui sera proposé afin de remplacer la très connue Mégane RS&nbsp;</p><p>En ce vendredi estivale, nous vous souhaitons à tous un bon week-end, et remercions l'équipe du garage RICARD 50 pour leur imagination&nbsp;</p></div><p><br></p>"
    ["attachment_hash"] => string(32) "c477875fb862e2f8821479ec0f10a580"
    ["attachment_hash_combined"] => string(83) "{"type":"post","context":{"node_id":437},"hash":"c477875fb862e2f8821479ec0f10a580"}"
    ["tags"] => string(0) ""
    ["_xfSet"] => array(1) {
      ["watch_thread"] => string(1) "1"
    }
    ["poll"] => array(5) {
      ["question"] => string(0) ""
      ["new_responses"] => array(1) {
        [0] => string(0) ""
      }
      ["max_votes_type"] => string(6) "single"
      ["change_vote"] => string(1) "1"
      ["view_results_unvoted"] => string(1) "1"
    }
    ["_xfRequestUri"] => string(43) "/forum/forums/canal-detente.437/post-thread"
    ["_xfWithData"] => string(1) "1"
    ["_xfToken"] => string(8) "********"
    ["_xfResponseType"] => string(4) "json"
  }
}

I’ll look into this as soon as I get a chance. How long have you been running this addon?
 
We have been using Snog's add-on ever since we have moved to XF (there used to be a similar mod for vB). We are now looking into changing the flag set as we're not so fond of the bevelled flag icons.

I know that there'd be a lot of work involved, but would it be possible to offer different sets in the future?
 
Will this addon allow us to display country flags on the 'current visitors' page to admins?
If no, will you consider this?
 
Top Bottom