MyBB Community Forums

Full Version: [release - plugin] IP-based Country Flag in postbit
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Plugin: Social Bookmarking Sites

Description: Add user country flag in PostBit based on user IP.

How to install:

Copy the file ipcountry.php in: /inc/plugins folder
Copy the file ip-to-country.csv in: /inc/plugins folder do not edit this file under any circumstances!!!!
Copy the folder flags and all the files in it in the /images folder
Install and activate from AdminCP


Please, let me know if you find any bugs - here or by PM.
Enjoy!
Download:
HERE
Live Demo:
Live Domo

The file is big (900k) and I will have to ask someone from the team if they are OK with me adding it to the mod section.
Does this check on every post for the IP dynamically? Or is it something written static one-time into the database?
(2009-01-27, 04:21 AM)labrocca Wrote: [ -> ]Does this check on every post for the IP dynamically? Or is it something written static one-time into the database?

It is a file that is written one time in the data base.
I know the file is written to the database but what method does the plugin use to place the flag in the post. I don't want to bother downloading it to see.

EDIT: wow...I just decided to register to see..and sure enough you run a query that's fairly big on every single post. This isn't an efficient method to do this. IMHO this would be best if a column (flag?) was added to user table and upon signup their country was added based on the signup up. Then you can use $post['flag'] in postbit. That's a much better method with a lot lower overhead.
(2009-01-27, 04:51 AM)labrocca Wrote: [ -> ]I know the file is written to the database but what method does the plugin use to place the flag in the post. I don't want to bother downloading it to see.

EDIT: wow...I just decided to register to see..and sure enough you run a query that's fairly big on every single post. This isn't an efficient method to do this. IMHO this would be best if a column (flag?) was added to user table and upon signup their country was added based on the signup up. Then you can use $post['flag'] in postbit. That's a much better method with a lot lower overhead.

Yes, but this plugin already exist (I think Zaher or Lex wrote it). It is a very good one and I am using it on one site. And for this one you have to "trust" the members of your site.
This one is based on the user IP and it never lies. Big Grin
Edit: I read again your post, and you are right, this will help a lot with the database queries. It is Ok if I use your suggestion in this plugin? Or do you want to use it?

Edit 2:
For some of the forums your suggestion can be tricky as an example: I have a immigration forum, and my users are changing countries; some of them twice a year. For this kind of forum it is nice to know from where the user posted, because in one way can be helped in his country of origin or when the user is in one of the countries of destination.
If the environment is static: users are not moving around, or users are not traveling a lot; yes, the suggestion is great, and can help with the numbers of queries.
If you do not want to release a new version based on your suggestion, I will do it giving the credits of the idea to you, but I will live both plugins so, admins can chose what to use.
Before I go on I just want to say I did not download this.
This would not work on my forum for one reason. There is a member on my site who says she is from Florida but Ip origin is from Canada. She says this is for all sites. Therefore it will be inaccurate for my site.
(2009-01-27, 02:38 PM)Chasingu Wrote: [ -> ]Before I go on I just want to say I did not download this.
This would not work on my forum for one reason. There is a member on my site who says she is from Florida but Ip origin is from Canada. She says this is for all sites. Therefore it will be inaccurate for my site.

If you are sure that you member is from Florida... Big Grin
Only one question: How do you know that this is not working if you haven't tried yet?
The IP data base is very accurate and if this plugin will show your mermber is from Canada then trust me - your member is from Canada and not from Florida. (by the way, it has only countries and NOT states or provinces)
You can possibly hook into the usercp and when they update something you can have the check for the IP to update again. Realistically you can never be 100% accurate on this thing with your method. Those country IP databases change and aren't 100% accurate to begin with.

You can use my idea. I was thinking of doing this but I would rather someone else make it. I just think that you need to avoid the check for IP on every single post. It will add overhead that won't be worth it just to add a flag to a post. You can also probably create a system for users to alter or update their flag in usercp.
(2009-01-27, 06:50 PM)labrocca Wrote: [ -> ]You can possibly hook into the usercp and when they update something you can have the check for the IP to update again. Realistically you can never be 100% accurate on this thing with your method. Those country IP databases change and aren't 100% accurate to begin with.

You can use my idea. I was thinking of doing this but I would rather someone else make it. I just think that you need to avoid the check for IP on every single post. It will add overhead that won't be worth it just to add a flag to a post. You can also probably create a system for users to alter or update their flag in usercp.

Thank you, I will do it, and you will be credited for the ideas (are yours not mine). Also let me know if you want this version of the plugin on your site: considering are your ideas, it should be there.
Please no credit. Ideas can't be copyrighted. Smile
Pages: 1 2 3