News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

CountryFlags

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

Previous topic - Next topic

Plutuss

Is the flag supposed to show in the Profile Summary too? If not, what code could I add to make it appear? SMF 2 :)

Branko.

#921
Of course, Summary and Forum Profile Information also. First check the default theme, if it's okay ( all visible) then look (via FTP)  in Themes/[your_theme]/Profile.template.php 

Find // Always fun - select boxes!
elseif ($field['type'] == 'select')
{
echo '
<select name="', $key, '" id="', $key, '">';


and Replace with         // Always fun - select boxes!
         elseif ($field['type'] == 'select')
         {
            if ($key == 'country_flag')
            {
               echo '
                        <script type="text/javascript" language="JavaScript">
                           function show_country_flags()
                           {
                              document.images.flags.src = document.forms.creator.country_flag.options[document.forms.creator.country_flag.selectedIndex].value != \'\' ? \'' . $settings['images_url'] . '/flags/\' + document.forms.creator.country_flag.options[document.forms.creator.country_flag.selectedIndex].value + \'.png\' : \'' . $settings['images_url'] . '/flags/blank.gif\';
                           }
                        </script>
                        <select name="', $key, '" id="', $key, '" onchange="show_country_flags()">';
                       
                     foreach ($field['options'] as $value => $name)
                        echo '
                           <option value="', $value, '" ', isset($context['member']['country_flag']) &&  $context['member']['country_flag'] == $value ? 'selected="selected"' : '', '>', $name, '</option>';
                     
                     echo '
                        </select>
                        <img id="flags" src="', $settings['images_url'], '/', isset($context['member']['country_flag']) && !empty($context['member']['country_flag']) ? 'flags/' . $context['member']['country_flag'] . '.png': 'blank.gif', '" width="25" height="15" align="top" />';   
            }
            else
            {
               echo '
                     <select name="', $key, '" id="', $key, '">';

            if (isset($field['options']))
            {
               // Is this some code to generate the options?
               if (!is_array($field['options']))
                  $field['options'] = eval($field['options']);
               // Assuming we now have some!
               if (is_array($field['options']))
                  foreach ($field['options'] as $value => $name)
                     echo '
                        <option value="', $value, '" ', $value == $field['value'] ? 'selected="selected"' : '', '>', $name, '</option>';
            }

            echo '
                     </select>';
         }
         }


Strong people don't put others down, they lift them up.
A clever person solves a problem. A wise person avoids it.

Plutuss

That code is already in my profiletemplate....but I replaced it with yours anyway, and still nothing.

Branko.

#923
After install this modification you must go in your profile and choose your country, but in the summary really is not visible only in Forum Profile Information.Both only in versions SMF1.1.x versions.Sorry, it's a job for vbgamer45

EDIT: Hmm, maybe is good solution for you... try in ACP»Features and Options »Profile Fields then in Custom Profile Fields down right you see box New field
Add Profile Field :
-Name:Country
-Description:Please insert your country name
-Profile Section:choose place for edit e.g. Account Settings
-Show on Registration:Yes, and require entry
-Show on Topic View:
-Choose Placement:

etc, etc

Sorry for the inconvenience
Strong people don't put others down, they lift them up.
A clever person solves a problem. A wise person avoids it.

smitch6

i've had this installed for ages and i've never been able to figure out why .........
when a newbie registers it asks them for their country but it never shows up on their profile?
it has to be done manually afterwards, any ideas please
i have both boxes ticked as well in the settings
Friendly, reliable web hosting at affordable prices
www.normanboatforum.co.uk l www.PatTesterSuffolk.co.uk

Branko.

#925
Quote from: smitch6 on August 12, 2011, 03:57:20 AM
...it has to be done manually afterwards...

For all newly registered? I ask you because there (first position in the drop down menu) is a blank field (provided for no country)  for the selection of the flag...Its possible that they confirm that field?

I have already said, SMF 2.0 :
1.Profile Summary...not visible
2.Forum Profile...visible (see image)
3.Member Post Profile...visible (see image)

Make a print screen and put it here....forum link also.

Strong people don't put others down, they lift them up.
A clever person solves a problem. A wise person avoids it.

cryptic3

I am trying to uninstall my mods to upgrade and country flags is one of the 2 that shows errors

1.   Adapt Database   install.php   
   2.   Execute Modification   ./Sources/Load.php   Test successful
   3.   Execute Modification   ./Sources/ManageSettings.php   Test successful
   4.   Execute Modification   ./Sources/Profile-Modify.php   Test successful
   5.   Execute Modification   ./Sources/Subs.php   Test failed
   1.   Add Before   ./Sources/Subs.php   Test failed
   6.   Execute Modification   ./Themes/default/Display.template.php   Test successful
   7.   Execute Modification   ./Themes/default/Profile.template.php   Test successful
   8.   Execute Modification   ./Themes/default/Register.template.php   Test successful
   9.   Execute Modification   ./Sources/Register.php   Test successful
   10.   Execute Modification   ./Themes/default/languages/Modifications.english.php   Test successful
11.   Execute Modification   ./Themes/default/languages/Modifications.english-utf8.php   Skipping file

can anyone advise what to do please.

Thanks

Branko.

#927
It's very simple.Just uninstall the mod and after manually remove that part in /Sources/Subs.php via FTP .Of course, previously copy this code (in add) to PC

EDIT: In some discussions I have read like "not necessary manually remove parts of modification" ...but in my case,after upgrade and reinstall mod) with this CountryFlags  I have problem with country double display (profile field,name and flag) in members profile and posts
Strong people don't put others down, they lift them up.
A clever person solves a problem. A wise person avoids it.

aselmani

I have just installed country flag mods to SMF 2.0 - everything went smooth and without warning.

However, after setting the options and everything, the flags do not appear in the forum?

I have done everything as requested in the mod page.

Any idea what may be wrong? Thanks

Branko.

Quote from: aselmani on August 15, 2011, 08:47:20 AM..the flags do not appear in the forum?...
Where?In which part?Profile or post?
Settings
ACP>Modification Settings>Miscellaneous :
Ask for country flag on......both
Show flags on Display page (Where posts are shown). ...check


Strong people don't put others down, they lift them up.
A clever person solves a problem. A wise person avoids it.

aselmani

Quote from: Branko. on August 15, 2011, 09:13:19 AM
Quote from: aselmani on August 15, 2011, 08:47:20 AM..the flags do not appear in the forum?...
Where?In which part?Profile or post?
Settings
ACP>Modification Settings>Miscellaneous :
Ask for country flag on......both
Show flags on Display page (Where posts are shown). ...check


I did this before asking for help and still don`t see them.  I don`t see the flags anywhere.
I repeated the step after your advise and still don`t see the flag.

Branko.

Strong people don't put others down, they lift them up.
A clever person solves a problem. A wise person avoids it.

Branko.

#932
Hm, I see that field in the registration form....please approve my account to your forum
Strong people don't put others down, they lift them up.
A clever person solves a problem. A wise person avoids it.

aselmani

Quote from: Branko. on August 15, 2011, 09:39:25 AM
Hm, I see that field in the registration form....please approve my account to your forum

Approved!

Branko.

You are right .. do not see in my post profile.You do not have the code in the Display template.


EDIT:Theme on your forum?
Strong people don't put others down, they lift them up.
A clever person solves a problem. A wise person avoids it.

aselmani

Quote from: Branko. on August 15, 2011, 10:02:59 AM
You are right .. do not see in my post profile.You [nofollow] do not have the code in the Display template.


EDIT:Theme on your forum?


What does this mean, can you elaborate please?
What do I have to do?

Branko.

Change forum default theme to another and check, maybe that is not compatible
Strong people don't put others down, they lift them up.
A clever person solves a problem. A wise person avoids it.

aselmani

Quote from: Branko. on August 15, 2011, 10:11:47 AM
Change forum default theme to another and check, maybe that is not compatible


I don`t think that`s the case! It worked with 2.0 RC3 with this same default theme without problems.

Branko.

In this case you need perform changes in some php's via FTP
Strong people don't put others down, they lift them up.
A clever person solves a problem. A wise person avoids it.

aselmani

Quote from: Branko. on August 15, 2011, 10:24:52 AM
In this case you need perform changes in some php's via FTP


Which php and can I do it through control panel?

Advertisement: