4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: sigma. on May 19, 2006, 05:56:09 PM

Title: [MOD] Country Flag in Comment
Post by: sigma. 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?
Title: Re: Country Flag in Comment?
Post by: sigma. on May 22, 2006, 06:48:04 AM
I guess this isnt as easy as pasting a code into the comment_bit.html template?
Title: Re: Country Flag in Comment?
Post by: mawenzi 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 (http://klick.kl.funpic.de/details.php?image_id=2520) ... ?
or
- selected country in the user profile (as used on your site) ... ?
Title: Re: Country Flag in Comment?
Post by: sigma. 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?

(http://cydonian.com/gallery/uer/flagincomment.jpg)

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?
Title: Re: Country Flag in Comment?
Post by: mawenzi 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
Title: Re: Country Flag in Comment?
Post by: sigma. on May 29, 2006, 06:47:13 PM
works like a charm. Thanks again mawenzi !
Title: Re: Country Flag in Comment?
Post by: sargnet 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
Title: Re: Country Flag in Comment?
Post by: martrix on June 18, 2006, 11:31:39 AM
Wonderful! Thanks Mawenzi   :D
Title: Re: [MOD] Country Flag in Comment
Post by: mawenzi on May 02, 2007, 06:02:51 PM
This topic has been moved to Mods & Plugins (Releases & Support)
Title: Re: [MOD] Country Flag in Comment
Post by: AntiNSA2 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.
Title: Re: [MOD] Country Flag in Comment
Post by: mawenzi on March 10, 2009, 06:35:58 PM
... sorry ... add thiwws ... ?
Title: Re: [MOD] Country Flag in Comment
Post by: V@no 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.
Title: Re: [MOD] Country Flag in Comment
Post by: AntiNSA2 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 :)
Title: Re: [MOD] Country Flag in Comment
Post by: AntiNSA2 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]
Title: Re: [MOD] Country Flag in Comment
Post by: AntiNSA2 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
Title: Re: [MOD] Country Flag in Comment
Post by: zakaria666 on August 10, 2010, 04:34:48 PM
@Mawenzi


1) The below image from what u can see from the black arrow gives each user that makes a comment a flag, now that flag corresponds to there IP, and mawenzi was kind enough to help out another member who wanted this MOD, i thoght i have fixed it but everytime a user makes a comment it goes from a flag to {comment_user_flag} until i refresh the page. Below the image is the code that mawezni created, its pretty simple i just put it in the details.php script, One minute i can see flags, then when i make a comment the flag vanishes and i am left with  {comment_user_flag} :(. Is there a problem inside the code by any chance or is just me i have done mistake? :-( 
(http://i34.tinypic.com/2yvtaow.jpg)

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,

Thank u sir
Title: Re: [MOD] Country Flag in Comment
Post by: V@no on August 10, 2010, 05:06:03 PM
are you still using ajax comments? if so, you'll need add the same code inside ajaxcomments.php
Title: Re: [MOD] Country Flag in Comment
Post by: zakaria666 on August 10, 2010, 05:41:05 PM
@ VANO

I really dont know what to say to u, if i say thank u it will not show u anything, if i say THANK U in capital letters it will display how much gratitude i have for u, thank u a million times, u r a fantastic and most remarkable individual and im not saying this for fun, i mean that. God bless u vano and i really hope that everyone who uses 4images shows the same respect and gratitude i have for u.

thank u so much vano more than i can show