Author Topic: [MOD] Country Flag in Comment  (Read 26540 times)

0 Members and 1 Guest are viewing this topic.

Offline sigma.

  • Full Member
  • ***
  • Posts: 148
  • cydonian.com/potd
    • View Profile
    • sigma's gallery
[MOD] Country Flag in Comment
« on: May 19, 2006, 05:56:09 PM »
I have this mod installed http://www.4homepages.de/forum/index.php?topic=6709.0

but im having problems displaying the country flag in other areas. One would be in the comment_bit.html

how can I display the users country flag in the comment they post?
« Last Edit: May 02, 2007, 05:56:06 PM by mawenzi »

Offline sigma.

  • Full Member
  • ***
  • Posts: 148
  • cydonian.com/potd
    • View Profile
    • sigma's gallery
Re: Country Flag in Comment?
« Reply #1 on: May 22, 2006, 06:48:04 AM »
I guess this isnt as easy as pasting a code into the comment_bit.html template?

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: Country Flag in Comment?
« Reply #2 on: May 23, 2006, 02:36:13 PM »
Hi sigma. ,
displaying users country flags for comments should based on ...
- IP of the comment owner ... like here ... ?
or
- selected country in the user profile (as used on your site) ... ?
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline sigma.

  • Full Member
  • ***
  • Posts: 148
  • cydonian.com/potd
    • View Profile
    • sigma's gallery
Re: Country Flag in Comment?
« Reply #3 on: May 24, 2006, 03:03:47 AM »
Thanks for the response mawenzi. I like what you have done with your comments. I would like something similar but not in the exact same location as you have it because of teh avatar mod i have installed. maybe something like this?



Im wondering if its also possible to add this for guest comments. The Flag is displayed in ACP for quest, would it be possible to freeze it in the comment when they post a comment?

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: Country Flag in Comment?
« Reply #4 on: May 29, 2006, 12:01:22 PM »
... displaying users country flags for comments based on IP of the comment owner ...

1. find in details.php the following code ...
Code: [Select]
      $site_template->register_vars(array(
        "comment_id" => $comment_row[$i]['comment_id'],
and replace it with this code ...
Code: [Select]
//--- Kommentar-Autor COUNTRY FLAGS ---
    if (!class_exists("GeoIP"))
    {
      include(ROOT_PATH."includes/geoip.inc");
    }
    $gi = geoip_open(ROOT_PATH."includes/GeoIP.dat",GEOIP_STANDARD);
    $countries = array();
    $cid = geoip_country_code_by_addr($gi, $comment_row[$i]['comment_ip']);
    if (empty($cid)) $cid = "lan";
    $countries[$cid] = isset($countries[$cid]) ? $countries[$cid]+1 : 1;
    $comment_user_flag = "<img src=\"".ROOT_PATH."flags/".strtolower($cid).".gif"."\" alt=\"".(($cid != "lan") ? $gi->GEOIP_COUNTRY_NAMES[$gi->GEOIP_COUNTRY_CODE_TO_NUMBER[$cid]] : "Unknown or LAN")."\" border=0>";
//--- Kommentar-Autor COUNTRY FLAGS ---

      $site_template->register_vars(array(
        "comment_id" => $comment_row[$i]['comment_id'],
        "comment_user_flag" => $comment_user_flag,

2. now you can use in your comment_bit.html the following tag where you want for country flags ...
Code: [Select]
{comment_user_flag}

mawenzi
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline sigma.

  • Full Member
  • ***
  • Posts: 148
  • cydonian.com/potd
    • View Profile
    • sigma's gallery
Re: Country Flag in Comment?
« Reply #5 on: May 29, 2006, 06:47:13 PM »
works like a charm. Thanks again mawenzi !

Offline sargnet

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Country Flag in Comment?
« Reply #6 on: June 18, 2006, 10:47:51 AM »
this is a good little mod i have users last comment on the home page mod installed is there a way to do this to those comments as well

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: Country Flag in Comment?
« Reply #7 on: June 18, 2006, 11:31:39 AM »
Wonderful! Thanks Mawenzi   :D
MAяTRIX


Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD] Country Flag in Comment
« Reply #8 on: May 02, 2007, 06:02:51 PM »
This topic has been moved to Mods & Plugins (Releases & Support)
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline AntiNSA2

  • Hero Member
  • *****
  • Posts: 774
  • As long as I can finish my site before I die.
    • View Profile
    • http://www.thelifephotography.com
Re: [MOD] Country Flag in Comment
« Reply #9 on: March 01, 2009, 02:47:46 PM »
Can you tell me how to add thiwws to recent comments on front page mod? Not sure if I should post it to that mod thread or not so I will post to both.
As long as I can finish my site before I die.

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD] Country Flag in Comment
« Reply #10 on: March 10, 2009, 06:35:58 PM »
... sorry ... add thiwws ... ?
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Country Flag in Comment
« Reply #11 on: March 11, 2009, 02:25:00 AM »
When you ask anything related to both topics and you want get a proper response, please don't be lazy and post the link to the topic you are referring to.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline AntiNSA2

  • Hero Member
  • *****
  • Posts: 774
  • As long as I can finish my site before I die.
    • View Profile
    • http://www.thelifephotography.com
Re: [MOD] Country Flag in Comment
« Reply #12 on: March 11, 2009, 04:48:50 AM »
This Mod= Show Flags of visitors

That mod= Show Latest comments on front page


ME: I want to show the flags of people within the recent comment mod http://www.4homepages.de/forum/index.php?topic=15701.0

Two mods.. one Author... one place... one question... Post in this thread or that one? not sure....

Thanks though :) Let me know iif I am missing anything :)
As long as I can finish my site before I die.

Offline AntiNSA2

  • Hero Member
  • *****
  • Posts: 774
  • As long as I can finish my site before I die.
    • View Profile
    • http://www.thelifephotography.com
Re: [MOD] Country Flag in Comment
« Reply #13 on: March 11, 2009, 03:09:16 PM »
I have tried adding this to index.php
Code: [Select]
//--- Kommentar-Autor COUNTRY FLAGS ---
    if (!class_exists("GeoIP"))
    {
      include(ROOT_PATH."includes/geoip.inc");
    }
    $gi = geoip_open(ROOT_PATH."includes/GeoIP.dat",GEOIP_STANDARD);
    $countries = array();
    $cid = geoip_country_code_by_addr($gi, $comment_row[$i]['comment_ip']);
    if (empty($cid)) $cid = "lan";
    $countries[$cid] = isset($countries[$cid]) ? $countries[$cid]+1 : 1;
    $comment_user_flag = "<img src=\"".ROOT_PATH."flags/".strtolower($cid).".gif"."\" alt=\"".(($cid != "lan") ? $gi->GEOIP_COUNTRY_NAMES[$gi->GEOIP_COUNTRY_CODE_TO_NUMBER[$cid]] : "Unknown or LAN")."\" border=0>";
//--- Kommentar-Autor COUNTRY FLAGS ---

      $site_template->register_vars(array(
        "comment_id" => $comment_row[$i]['comment_id'],
        "comment_user_flag" => $comment_user_flag,[code]

and
[code]{comment_user_flag}

But all I get is a gif with a question mark.


I have even tried removing this as index.php has not this code:
Code: [Select]

        "comment_id" => $comment_row[$i]['comment_id'],


but it had no effect.

Sorry... I knew how to do this 5 years ago. I have since been so busy beyond belief and forgotten a lot of stuff. Im now trying to do my site before the world economy falls off cliff, humanity is reset and people start eating their young.[/code][/code]
As long as I can finish my site before I die.

Offline AntiNSA2

  • Hero Member
  • *****
  • Posts: 774
  • As long as I can finish my site before I die.
    • View Profile
    • http://www.thelifephotography.com
Re: [MOD] Country Flag in Comment
« Reply #14 on: March 11, 2009, 03:10:48 PM »
BTW it works great on details.php comments.... jus t not on the front page.... or index.php/home.html
As long as I can finish my site before I die.