[RELEASE v2.0.x] Country Flag Hack v2.0

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AJR
    Member
    • Aug 2001
    • 61
    • 2.3.2

    [RELEASE v2.0.x] Country Flag Hack v2.0

    Version 2.0 - September 6, 2001
    ====================================================
    This is the second release of the Country Hack. I have
    converted it to make it work with Bain's vBStats hack
    that will be released sometime in the near future. Bain
    and I have been working together because both the Country
    Hack and vBStats Hack require all the flags. We didn't
    want you to have to have double images with different
    names (which would mean over 450 files in the flags
    directory!)

    By changing the flag names from their country code to
    their country name, it is now possible to have the ALT
    tag show the name of the country when you put your mouse
    pointer over the flag image.

    Thanks to Stasik for starting the Admin Control Panel
    Addon. I modified it to use the same country list in
    the modifyprofile_country, so adding countries or making
    changes need only one template change and an upload of
    the flag .gif file. I also made it so you can not only
    edit the Country Flag in the CP user profile edit, but
    also choose a flag when adding a user with the CP.

    Those that have installed Country Hack
    v1.0 and are upgrading, you will need to do all the
    steps below except for steps 2 and 8 (no changes in these
    steps from v1.0). For changes in the other steps, just
    overwrite everything between the // Country Hack Start/End
    comments in your php files from v1.0 with what is in the
    steps below.

    Changes from v1.0:
    - Images have been changed from country codes to country names
    - Flags will now have their ALT text as country name.
    - Modified Hack to work with Bane's vbStats hack that will be released in the future.
    - Added CP Addon by Stasik and modded it for new country names
    - Changed country field in USER table from CHAR(2) to VARCHAR(50)
    - Support for 226 countries

    Known Problems:
    - Countries with a dash (-) or comma (,) will not show up
    automatically in as selected when you or the member edit
    their profile (Congo, Korea, and Micronesia are the only 3)
    Anyone know a fix please let me know.
    - The 'modifyprofile_country' template needs to be changed
    to a default original templatesetid of -1 (changed templates
    have the templatesetid set to 2) or else the Admin CP addon
    will not work (Any ideas why?). To do this, use phpMyAdmin
    and run this query:
    UPDATE template SET templatesetid="-1" where title="modifyprofile_country"
    This will move the template from the custom to default templates
    and will be found in the 'User Option Templates' group.

    Any questions or comments can be posted here. Enjoy!
    ¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤
    AJ
    AJ's VPinMAME Table Downloads
    Visual Pinball Forums
    ¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤
  • express
    Senior Member
    • Apr 2001
    • 1470
    • 3.6.x

    #2
    AJR

    Thanks for the update.

    Question, I am upgrading, in the new zip file I only see the small flags, I am using the large flags.Do you also have them somewhere laying around with full names like the small flags in your new zip file?
    Real Web Host

    Comment

    • AJR
      Member
      • Aug 2001
      • 61
      • 2.3.2

      #3
      Large flags not available because...

      Webhost... I do not have the large flag names converted because the vBStats Hack by Bane, when released, will require the small flags as the same name as the Country Hack.

      If you want to use the large flags and don't plan on using the vBStats hack, rename the large flags that you have with the names from the modifyprofile_country template. If I get a chance I'll do it and post them, but it won't be for a day or two. If you are planning on using the vbstats hack, for now you can keep the names as country codes and just use the modifyprofile_country template from v1.0 text file... make sure to only grab from:

      <select name="country">
      .
      .
      .
      </select></smallfont>

      Do not at the <td><smallfont> or </td> before and after since they are being put into the other templates. The plus is you won't have the problem with the 3 countries that have - or ,. The only drawback to this is the ALT name will not be shown as the full country name. If anyone gets time to convert the large flags from country code to country name before I do, please post them here.
      ¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤
      AJ
      AJ's VPinMAME Table Downloads
      Visual Pinball Forums
      ¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤

      Comment

      • aldamon
        Member
        • Jun 2001
        • 78
        • 3.8.x

        #4
        Nevermind, my bad....

        Great work! Excellent hack!
        Last edited by aldamon; Fri 7 Sep '01, 4:40am.

        Comment

        • redrat

          #5
          Great hack
          Thanks a lot

          Comment

          • TheComputerGuy
            Senior Member
            • Apr 2001
            • 998

            #6
            I get a dB error on the member.php file when I try to go edit my country

            the error is saying that it is sending an email to me...just a slight problem as it says

            Comment

            • Typhon
              Member
              • Nov 2000
              • 74
              • 3.7.x

              #7
              Greak hack!

              This is a great hack... and it works like a charm on my site. I'm currently in the process of converting all the flags to a beveled 30x15 pixels, and I'll post the ZIP files when I get it done. Thanks!
              ::Typhon::
              www.realmworx.com

              Comment

              • AJR
                Member
                • Aug 2001
                • 61
                • 2.3.2

                #8
                What' the exact error message in the email?

                Originally posted by TheComputerGuy
                I get a dB error on the member.php file when I try to go edit my country

                the error is saying that it is sending an email to me...just a slight problem as it says
                And......what was the email that was sent to you (the db error)? That is the key to helping you with your problem.
                ¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤
                AJ
                AJ's VPinMAME Table Downloads
                Visual Pinball Forums
                ¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤

                Comment

                • TheComputerGuy
                  Senior Member
                  • Apr 2001
                  • 998

                  #9
                  > Database error in vBulletin: Invalid SQL: SELECT country FROM user WHERE
                  userid=1
                  > mysql error: Unknown column 'country' in 'field list'
                  > mysql error number: 1054
                  > Date: Saturday 08th of September 2001 01:44:45 PM
                  > Script: /forums/member.php?s=&action=getinfo&find=lastposter&forumid=31
                  > Referer: http://www.moneytec.com/forums/index.php?s=

                  Comment

                  • AJR
                    Member
                    • Aug 2001
                    • 61
                    • 2.3.2

                    #10
                    &quot;Unknown column COUNTRY&quot;

                    Originally posted by TheComputerGuy
                    > mysql error: Unknown column 'country' in 'field list'
                    It tells you the problem right in the error message. You didn't do STEP 1 in the country_flag_hack_20.txt file:

                    STEP 1:
                    ======
                    In phpMyAdmin, you can run this query to create the country field:
                    ALTER TABLE user ADD country VARCHAR (50) NOT NULL


                    If the field 'country' is not there it can't save the country selection!

                    AJ
                    ¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤
                    AJ
                    AJ's VPinMAME Table Downloads
                    Visual Pinball Forums
                    ¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤

                    Comment

                    • Dunny
                      Member
                      • Aug 2001
                      • 50

                      #11
                      1 - Add to database-Table user, field named: country
                      properties: ( country varchar(50) NOT NULL )

                      In phpMyAdmin, you can run this query:
                      ALTER TABLE user ADD country VARCHAR (50) NOT NULL


                      any chance of making this step better for the simple people among us

                      Comment

                      • express
                        Senior Member
                        • Apr 2001
                        • 1470
                        • 3.6.x

                        #12
                        Checking my installation and I have a question, look at this below the first instruction I can only find this line one time in user.php, it also mentions user.cp what is this, something doesn't look right in this section can you explain?

                        PHP Code:
                        Open admin/user.php

                        Find the FIRST line of this code 
                        (this shows up 2 times in user.cp):
                              
                        makeinputcode("Birthday<br>(Format yyyy-mm-dd)","birthday");

                        Below it add:
                        // Country Hack CP Addon by Stasik (modded by AJ)
                              
                        echo "<tr class='".getrowbg()."'><td>Country Flag</td><td nowrap>";
                              eval(
                        "\$countrytext.= \"".gettemplate("modifyprofile_country")."\";");
                              echo 
                        "$countrytext</td></tr>";
                        // Country Hack CP Addon End


                        Find the SECOND line of this code (this shows up 2 times in user.cp):
                              
                        makeinputcode("Birthday<br>(Format yyyy-mm-dd)","birthday");

                        Below it add:
                        // Country Hack CP Addon by Stasik (modded by AJ)
                              
                        $country=$user[country];
                              
                        $countryalt str_replace("%20"," ",$country);
                              
                        $countrysel str_replace("%20","_",$country);
                              if(
                        $user[country] == ""){
                                
                        $ctrydefaultselected "selected";
                                
                        $flag "No flag selected yet.";
                              } else {
                                  
                        $ctryname "ctry".$countrysel."selected";
                                  $
                        $ctryname "selected";
                                
                        $flag "<img src=\"../images/flags/$user[country].gif\" alt=\"$countryalt\" border=\"0\">";
                              }
                              echo 
                        "<tr class='".getrowbg()."'><td>Flag<br>$flag</td><td nowrap>";
                              eval(
                        "\$countrytext.= \"".gettemplate("modifyprofile_country")."\";");
                              echo 
                        "$countrytext</td></tr>";
                        // Country Hack CP Addon End


                        Find:
                          
                        $DB_site->query("UPDATE user SET birthday='$birthday',options='$options',usergroupid='$usergroupid',username='".addslashes(htmlspecialchars($ausername))."'$pwdinclude,email='".addslashes(htmlspecialchars($email))."',styleid='$styleid',parentemail='".addslashes(htmlspecialchars($parentemail))."',coppauser=$coppauser,homepage='".addslashes(htmlspecialchars($homepage))."',icq='".addslashes(htmlspecialchars($icq))."',aim='".addslashes(htmlspecialchars($aim))."',yahoo='".addslashes(htmlspecialchars($yahoo))."',signature='".addslashes($signature)."',adminemail=$adminemail,showemail=$showemail,invisible=$invisible,usertitle='".addslashes($usertitle)."',customtitle=$customtitle,joindate=$joindate,cookieuser=$cookieuser,nosessionhash=$nosessionhash,daysprune='$daysprune',lastvisit=$lastvisit,lastactivity=$lastactivity,lastpost=$lastpost,posts='$posts',timezoneoffset='$timezoneoffset',emailnotification=$emailnotification,receivepm='$receivepm',emailonpm='$emailonpm',ipaddress='".addslashes($aipaddress)."',pmpopup=IF(pmpopup=2 AND $pmpopup=1,pmpopup,'$pmpopup') WHERE userid=$userid");

                        Replace it with:
                        // Country Hack CP Addon by Stasik (modded by AJ) Replace
                        //  $DB_site->query("UPDATE user SET birthday='$birthday',options='$options',usergroupid='$usergroupid',username='".addslashes(htmlspecialchars($ausername))."'$pwdinclude,email='".addslashes(htmlspecialchars($email))."',styleid='$styleid',parentemail='".addslashes(htmlspecialchars($parentemail))."',coppauser=$coppauser,homepage='".addslashes(htmlspecialchars($homepage))."',icq='".addslashes(htmlspecialchars($icq))."',aim='".addslashes(htmlspecialchars($aim))."',yahoo='".addslashes(htmlspecialchars($yahoo))."',signature='".addslashes($signature)."',adminemail=$adminemail,showemail=$showemail,invisible=$invisible,usertitle='".addslashes($usertitle)."',customtitle=$customtitle,joindate=$joindate,cookieuser=$cookieuser,nosessionhash=$nosessionhash,daysprune='$daysprune',lastvisit=$lastvisit,lastactivity=$lastactivity,lastpost=$lastpost,posts='$posts',timezoneoffset='$timezoneoffset',emailnotification=$emailnotification,receivepm='$receivepm',emailonpm='$emailonpm',ipaddress='".addslashes($aipaddress)."',pmpopup=IF(pmpopup=2 AND $pmpopup=1,pmpopup,'$pmpopup') WHERE userid=$userid");
                          
                        $DB_site->query("UPDATE user SET birthday='$birthday',options='$options',usergroupid='$usergroupid',username='".addslashes(htmlspecialchars($ausername))."'$pwdinclude,email='".addslashes(htmlspecialchars($email))."',styleid='$styleid',parentemail='".addslashes(htmlspecialchars($parentemail))."',coppauser=$coppauser,homepage='".addslashes(htmlspecialchars($homepage))."',icq='".addslashes(htmlspecialchars($icq))."',aim='".addslashes(htmlspecialchars($aim))."',yahoo='".addslashes(htmlspecialchars($yahoo))."',signature='".addslashes($signature)."',adminemail=$adminemail,showemail=$showemail,invisible=$invisible,usertitle='".addslashes($usertitle)."',customtitle=$customtitle,joindate=$joindate,cookieuser=$cookieuser,nosessionhash=$nosessionhash,daysprune='$daysprune',lastvisit=$lastvisit,lastactivity=$lastactivity,lastpost=$lastpost,posts='$posts',timezoneoffset='$timezoneoffset',country='$country',emailnotification=$emailnotification,receivepm='$receivepm',emailonpm='$emailonpm',ipaddress='".addslashes($aipaddress)."',pmpopup=IF(pmpopup=2 AND $pmpopup=1,pmpopup,'$pmpopup') WHERE userid=$userid");
                        // Country Hack CP Addon End 
                        Real Web Host

                        Comment

                        • Dunny
                          Member
                          • Aug 2001
                          • 50

                          #13
                          makeinputcode("Birthday<br>(Format yyyy-mm-dd)","birthday",$user[birthday],0);

                          i think the 2nd one looks like this mate...does anyone know how you do the first step exactly?

                          Comment

                          • express
                            Senior Member
                            • Apr 2001
                            • 1470
                            • 3.6.x

                            #14
                            just go to your database for your forums. Find table named user open up find field name country and edit it change to VARCHAR (50) and save.

                            Anyone got the large flags renamed yet?
                            Real Web Host

                            Comment

                            • Dunny
                              Member
                              • Aug 2001
                              • 50

                              #15
                              can anyone really simplify the 1st step, I take it the person who owns the board has to do it?

                              I just have FTP access to install the hacks so Im completly lost and the board owner doesnt have a clue!

                              cheers

                              Comment

                              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                              Working...