News:

Wondering if this will always be free?  See why free is better.

Main Menu

CountryFlags

Started by SMFHacks.com Team, August 14, 2006, 01:07:43 PM

Previous topic - Next topic

Zuća


vbgamer45

Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

4Kstore

I have this error in the register page using CountryFlags_v2.0.1a

Fatal error: Call to undefined function country_flags() in /usr/home/todo-apuestas.es/web/foro/Sources/Load.php(2394) : eval()'d code on line 215

I fixed changin this:

In subs.php
function CountryFlag()

replace:
function country_flags()

¡¡NEW MOD: Sparkles User Names!!!

Matthew K.

In addition to the fix that 4Kstore posted, there's another THREE problems in the latest package, for SMF 2.0.2.

I'm going to go ahead and post the fixes here.

./Themes/default/Register.template.php
Code (Find) Select
// If flags is set for registration show it.
if (!empty($modSettings['country_flag_ask']) && $modSettings['country_flag_ask'] == 2 || $modSettings['country_flag_ask'] == 3)
{
// Call the function that has all the flag info
$flags = CountryFlag();

echo '
<script language="JavaScript" type="text/javascript">
function showflags()
{
document.images.flags.src = document.forms.registration.country.options[document.forms.registration.country.selectedIndex].value != \'\' ? \'' . $settings['default_theme_url'] . '/images/flags/\' + document.forms.registration.country.options[document.forms.registration.country.selectedIndex].value + \'.png\' : \'' . $settings['default_theme_url'] . '/images/flags/blank.gif\';
}
</script>
<dl class="register_form" id="country_flag">
<dt><strong>', $txt['country_flag_label'], ':</strong></dt>
<dd>
<select name="country" onchange="showflags()">
<option value=""></option>';

// Loop and show the drop down.
foreach ($flags as $key => $name)
echo '
<option value="', $key, '">', $name, '</option>';

echo '
</select>
<img id="flags" src="', $settings['default_theme_url'], '/images/blank.gif" alt="" width="25" height="15" align="top" />
</dd>
</dl>';
}

Code (Replace) Select
// If flags is set for registration show it.
if (!empty($modSettings['country_flag_ask']) && ($modSettings['country_flag_ask'] == 2 || $modSettings['country_flag_ask'] == 3))
{
// Call the function that has all the flag info
$flags = country_flags();

echo '
<script language="JavaScript" type="text/javascript">
function showflags()
{
document.images.flags.src = document.forms.registration.country.options[document.forms.registration.country.selectedIndex].value != \'\' ? \'' . $settings['default_theme_url'] . '/images/flags/\' + document.forms.registration.country.options[document.forms.registration.country.selectedIndex].value + \'.png\' : \'' . $settings['default_theme_url'] . '/images/flags/blank.gif\';
}
</script>
<dl class="register_form" id="country_flag">
<dt><strong>', $txt['country_flag_label'], ':</strong></dt>
<dd>
<select name="country" onchange="showflags()">
<option value=""></option>';

// Loop and show the drop down.
foreach ($flags as $key => $name)
echo '
<option value="', $key, '">', $name, '</option>';

echo '
</select>
<img id="flags" src="', $settings['default_theme_url'], '/images/blank.gif" alt="" width="25" height="15" align="top" />
</dd>
</dl>';
}

echo '
</fieldset>
<span class="botslice"><span></span></span>
</div>';

So, what changed?

The if conditions statements were improperly grouped if the setting was empty, causing undefined errors.
Code (This) Select
if (!empty($modSettings['country_flag_ask']) && $modSettings['country_flag_ask'] == 2 || $modSettings['country_flag_ask'] == 3)
Code (Should Be) Select
if (!empty($modSettings['country_flag_ask']) && ($modSettings['country_flag_ask'] == 2 || $modSettings['country_flag_ask'] == 3))Notice the grouping of the 2 || 3, without the grouping it is if the setting is NOT empty and the value is 2, OR if the value is 3, which is fine, but there's no isset();, so if the variable is not set, that's when it becomes undefined because it's not combined with the !empty();, and doesn't have an isset();.

The second is the function name...
$flags = CountryFlags();
The function name was apparently changed to "country_flags", and the corresponding function calls were not updated with the name change update. So simply changing it to$flags = country_flags();Resolved this error, which throws an undefined function error.

The final issue was that the closing of the windowbg was replaced, and not added in the flags code, so it screws up the registration layout without adding it back.

Code (Below the Flags Code) Select
echo '
</fieldset>
<span class="botslice"><span></span></span>
</div>';

Like so.

Hope this helps.

vbgamer45

I did an update last night that should have changed all calls to CountryFlags();
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Matthew K.

Well I downloaded the package today, and all four issues listed above were present. I'd suggest fixing them asap.

vbgamer45

Thanks Labradoodle-360 made all the changes except for $flags = country_flags(); since i do not have a country_flags() function in the code at all.
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

vinzbomb

hello,

i use country flags on two forums, one in english, and one in french, so i need coutry flags in french mod, i can translate it for you, but don't know how to do !

let me know i will translate it, or is there another quicker way to translate it ?!

tahnsk laters !!

vbgamer45

To translate find the text in themes/default/modifications.english.php
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Matthew K.

Quote from: vbgamer45 on February 16, 2012, 10:28:36 PM
Thanks Labradoodle-360 made all the changes except for $flags = country_flags(); since i do not have a country_flags() function in the code at all.
Not a problem :) Hope you're doing well!

vbgamer45

Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

distante

Quote from: vbgamer45 on February 17, 2012, 11:39:45 AM
Doing well just busy as always.

Hello vbgamer45!

The actual file is bug free? (at least, reported bug free?)

vbgamer45

Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

distante


vbgamer45

Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

distante

Hey vbgamer45, a little question, I saw in a part of the code this:

document.forms.creator.country_flag.options[document.forms.creator.country_flag.selectedIndex].value + \'.png\' : \'' . $settings['images_url'] . '/flags/blank.gif\';


But in the mod package isn't any blank.gif file...

mrselnombre

Quote from: tank_fv101 on December 30, 2011, 02:20:08 PM
Hello all,

I hope you can help with an error I have on my forum with this mod.  I'm using 2.0.2.

When members have had a look at the selection of flags in their profile, but decided not to choose one, it would come up with "Country" under their avatar and a broken picture called 00.png   So, as a temporary measure to make it look nicer I created a 00.png which is transparent and uploaded (as the file didn't even exist).  I'm not sure why choosing a blank option should select a picture?

Can anyone help with the "Couuntry" not appearing, and also the picture not appearing as well.

Thanks for your time.
yup, same here..
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination.
Total Twaddle.

cachimbo.pt

#1077
I really don't understand the way the mods are supposed to work, I've been trying but no luck, so far... So, excuse me for another dumb question.

I managed to instal the Country Flags mod, the directory ./Themes/default/images/flags got created with all the pics, but I see no flags (after configuring the profile).
A search on httpd error log showed me that there were some requests for files inside ./Themes/core/images/flags, which of course does not exists.
So, I went into every theme and made a symlink to the correct place "ln -s ../../default/images/flags flags", ok, now when I select the country in the change profile page I can see the flag pic (including when using core theme) and no more errors in error_log.

My problem is that when seeing posts the text Country: [flagpic] does not show up ONLY WHEN I'm using the core theme.

I only have more 5 themes installed default Curve, Curve_Black_Gray_Light, DVP-Smoke-Machine, rusty-white and Skm_Night, but all my users are using the core theme (my fault, I set that as the default when I started the forum) and I don't want to force them to change, what do I do for the pic to show up with core theme ?

I'm using SMF 2.0.2, mod is CountryFlags_v2.1.zip (174925 bytes)
Thanks in advance

cachimbo.pt

Ok, solved it.
Had to edit Display.template.php in core by hand and pasted the line


// Show the country they hail from!
                        if (isset($message['member']['country_flag']) && !empty($modSettings['country_flag_show']) && !empty($message['member']['country_flag']))
                        {
                                $flags = CountryFlag();
                                echo '<li class="gender">', $txt['country_flag'], ': <img src="', $settings['images_url'], '/flags/', $message['member']['country_flag'], '.png" alt="', $message['member']['country_flag'], '" title="', $flags[$message['member']['country_flag']], '" /></li>';
                        }


from the default theme... I wonder why it failed, permissions are the same rw-r--r--
Still have to find the right place to put it but it's ok now.

RoCKeT-88

I am trying to install this on a 2.02 but tells me the current version is not compatible with that 2.0.2
Insert Witty Signature Here.

Advertisement: