Notice

The forum is in read only mode.

Support Forum

Welcome! Support Forums have been reactivated
Welcome the Technical Support section. Help us in assisting you by providing us with a concise and descriptive elaboration of your issues. Be specific and if possible, provide us with a step-by-step instruction in replicating your problem.

Making a country default in country field on registration form

10 years 3 months ago
  • Roland's Avatar
    Topic Author
  • Roland
  • Offline
  • Fresh Boarder
  • Posts: 76
  • Thank you received: 3
Licenses:
JomSocial Expired

I want to make the "Country" field on the user registration page default to "United States". I was looking here in the support forum and found one thread that seemed to work for one person but not for me.

I tried to follow that thread:
www.jomsocial.com/forum/design-and-custo...-united-states#60572

But that solution did not work for me.

Any other solution?
Thank you

10 years 3 months ago
  • Dimas Tekad Santosa's Avatar
  • Dimas Tekad Santosa
  • Visitor
  • Thank you received: 0
Licenses:

Hi Ronald,

What country do you want to use as default?

10 years 3 months ago
  • Roland's Avatar
    Topic Author
  • Roland
  • Offline
  • Fresh Boarder
  • Posts: 76
  • Thank you received: 3
Licenses:
JomSocial Expired

United States

Thank you

10 years 3 months ago
  • Dimas Tekad Santosa's Avatar
  • Dimas Tekad Santosa
  • Visitor
  • Thank you received: 0
Licenses:

You need follow my hack www.jomsocial.com/forum/design-and-custo...-united-states#60572 very carefully, Josh Weeman already did it and successfully.

10 years 3 months ago
  • Roland's Avatar
    Topic Author
  • Roland
  • Offline
  • Fresh Boarder
  • Posts: 76
  • Thank you received: 3
Licenses:
JomSocial Expired

No, it does not work. I already read this thread and tried it before I posted here. I tried it now again and I can confirm that this does not work.

10 years 3 months ago
  • Dimas Tekad Santosa's Avatar
  • Dimas Tekad Santosa
  • Visitor
  • Thank you received: 0
Licenses:

I did it, please check again, should work fine default USA right now.

10 years 3 months ago
  • Roland's Avatar
    Topic Author
  • Roland
  • Offline
  • Fresh Boarder
  • Posts: 76
  • Thank you received: 3
Licenses:
JomSocial Expired

That is weird - no it does not. However, I changed teh country.php file maybe around the same time and overwritten yoru changes. If you do changes, please make sure that the values of the options are real names (United States) and not these Community variables. Thank you!
:-)

10 years 3 months ago
  • Dimas Tekad Santosa's Avatar
  • Dimas Tekad Santosa
  • Visitor
  • Thank you received: 0
Licenses:

Ok Done, I reapplied the code...

We are using the string varibale instead realname, for making the countries is translateable.

10 years 3 months ago
  • Roland's Avatar
    Topic Author
  • Roland
  • Offline
  • Fresh Boarder
  • Posts: 76
  • Thank you received: 3
Licenses:
JomSocial Expired

Now the country list is screwed up again. The parameters are again "COM_COMMUNITY_LANG_NAME_" with country code.
Now, it's saved in the database with this screwed up format and all existing users from same country are not found with the new ones from same country. PLEASE Jomsocial codesrs: before yopu throw in some fancy new codes in future versions, please check that it is BACKWARD compatible! The programmers did not consider that people UPGRADE Jomsocial - meaning that they already have many (thousands) of existing users. Now I am spending New Year fixing these &%! bugs. Happy New Year!

The following user(s) said Thank You: Xristoph Conrad
10 years 3 months ago
  • Roland's Avatar
    Topic Author
  • Roland
  • Offline
  • Fresh Boarder
  • Posts: 76
  • Thank you received: 3
Licenses:
JomSocial Expired

Quick fix applied:

For everyone who faces the same problem:
Exchange
$name
with
JText::_($name)

That throws the real name and not that com_community code.
Happy New Year

10 years 3 months ago
Licenses:
JomSocial Expired

I am having a similar problem, when a users selects his COUNTRY we get this
"Country
COM_COMMUNITY_LANG_NAME_AUSTRALIA"
Where do I modify the code to get "AUSTRALIA"
I need it selectable not a default country..

$name appears in several places in this file.. Which one/s do I change to.. I also note jtext::_($name):? is already there in <option value >

<select id="field<?php echo $field->id;?>" name="field<?php echo $field->id;?>" class="<?php echo !empty( $field->tips ) ? 'jomNameTips tipRight ' : '';?>select validate-country<?php echo $class;?>"<?php echo $tooltips;?>>
<option value=""<?php echo empty($field->value) ? ' selected="selected"' : '';?>><?php echo JText::_('COM_COMMUNITY_SELECT_A_COUNTRY');?></option>
<?php
for($a=0;$a<count($countries->country);$a++ )
{
$name = $countries->country[$a]->name;

?>
<option value="<?php echo $name;?>"<?php echo ($field->value == $name) ? ' selected="selected"' : '';?>><?php echo JText::_($name);?></option>
<?php
}
?>
</select>

Thanks

10 years 3 months ago
  • Roland's Avatar
    Topic Author
  • Roland
  • Offline
  • Fresh Boarder
  • Posts: 76
  • Thank you received: 3
Licenses:
JomSocial Expired

Hi Arthur,
Find the file "country.php" in the directory:
"components/com_community/libraries/fields"

Change the line:
<option value="<?php echo $name;?>"<?php echo ($field->value == $name) ? ' selected="selected"' : '';?> <?php echo (empty($field->value) && $name=='United States') ? ' selected="selected"' : '';?>><?php echo $name;?></option>


to:

<option value="<?php echo JText::_($name);?>"<?php echo ($field->value == JText::_($name)) ? ' selected="selected"' : '';?> <?php echo (empty($field->value) && JText::_($name)=='United States') ? ' selected="selected"' : '';?>><?php echo JText::_($name);?></option>


Basically, change
$name
to
JText::_($name)

By the way, you can change the "United States" to "Australia" to make it default, or just delete " && JText::_($name)=='United States'"

Happy New Year! (Was a nice fireworks in Sydney :-)

The following user(s) said Thank You: Arthur
10 years 3 months ago
  • Dimas Tekad Santosa's Avatar
  • Dimas Tekad Santosa
  • Visitor
  • Thank you received: 0
Licenses:

Hi Arthur,

Can you create new topic for your issue please? because I am sure your issue is different with this.

thx

10 years 3 months ago
Licenses:
JomSocial Expired

Thanks Roland, unfortunately it seems like a different problem.. Dimas has asked me to open a new topic which i have done..
We are lucky here with the warm weather at midnight..

Moderators: Piotr Garasiński
Powered by Kunena Forum

Join 180,000 websites creating Amazing communities

JomSocial is the most complete, easy-to-use addon that turns Joomla CMS into a
full -fledged, social networking site

TRY NOW BUY NOW