How to make United States at top of list?

How can I make the United States (or any country) appear at the top of the list above Afghanistan in join.php?  I mean really, is anyone from Afghanistan joining?  I tried moving the US within Admin > Settings > Predefined Values but that doesn't seem to do anything.

I have 6.1.4, and I will totally modify the underlying PHP if necessary if only someone will point me in the right direction.

Thanks!

Quote · 3 Sep 2008

Yes, go to admin--->settings---->Predefined values--->Select a list---->country.....then scroll down until you see the country you want to set first and move it up using "UP arrow" all the way to the right. Its slow process but thats how you do it.

I hope this helps..

Quote · 9 Sep 2008

Did that, it did not work. Do you need to re-compile languages?

Stuart

Yes, go to admin--->settings---->Predefined values--->Select a list---->country.....then scroll down until you see the country you want to set first and move it up using "UP arrow" all the way to the right. Its slow process but thats how you do it.

I hope this helps..

There are none so blind as those that will not see.
Quote · 9 Sep 2008

No need to compile....give it some time for your server to process the changes or try to do it using different browser. I use firefox when Im in admin section...IE wont make any changes...

Let us know

Quote · 9 Sep 2008

Yes, go to admin--->settings---->Predefined values--->Select a list---->country.....then scroll down until you see the country you want to set first and move it up using "UP arrow" all the way to the right. Its slow process but thats how you do it.

I hope this helps..

Won't work because if you notice this list is NOT sorted  but the list is sorted alpha when displayed  .....

Quote · 9 Sep 2008

You are correct Rumpy...doesn't work!

Quote · 9 Sep 2008

Wow, so I would have just spent all that time moving those and it wouldn't have worked! Phew, Thanks again Rumpy Cool

Quote · 9 Sep 2008

Thats how i moved mine and it shows that way on join page an on edit profile page.

I went to sleep but this issue got me going and now my wife is upset....but I loged back in to my admin and looked around...

 

Its been awile when I moved those....but now I noticed that in admin----->bulders----->fields builder----->join form--->country(block)----->advanced(link)---->default value is set to USA (Capital letters). maybe look there.

 

you also can get to predefined values using "Country" under the same advanced section.

 

I moved up 5 countries of my interest and those 5 are up and the rest of them are not under alpha.order...thats one of the things I wanted to line up but never got time to sort....oh well...

 

you can see it at balkanlink dot net

Nurke

Quote · 9 Sep 2008
<select class="input_select" name="Country[0]">
<option selected="selected" value="">Select it</option>
<option value="AF">Afghanistan</option>
<option value="AL">Albania</option>

The above highlighted line from the finished join.php is what needs to be set as shown below but I’ll be phucked if I can
find what sets or calls it in all this elegant code!

<option selected="selected" value="US">United States</option>

If someone knows please post it  ..... 


I have Admin > settings > Builders > Fields Builder > Country > Advanced > Default Value: set to US but it DOES NOT
MATTER, the country field remains the same on the join page  .....  "select it" = sorted alpha  ..... 
This BTW should set it to display as the default in the finished join.php page instead of select it  .....  but it DOES NOT.



Quote · 9 Sep 2008

Ok, I just wanted to make sure that you guys have seen the "SAVE" button, all the way under country list. Once you finish moving USA to the top, or any other order for that matter, make sure you scroll all the way down on that page and click save.

Let me know your results...

Nurke

Quote · 9 Sep 2008

Yes...I hit the SAVE button using FF. Viewed in (cleared cache) IE, US is still not appearing on top.

-

It shows that it is on top in predefined...but not for viewer.

-

~~ L

Ok, I just wanted to make sure that you guys have seen the "SAVE" button, all the way under country list. Once you finish moving USA to the top, or any other order for that matter, make sure you scroll all the way down on that page and click save.

Let me know your results...

Nurke

Quote · 9 Sep 2008

I'll figure it out shortly for you.

Quote · 9 Sep 2008

nurke,

Which version are you on?

In v6.1.4 it makes NO difference that it is at the top of the predefined list (also top of the field (ID=0) in the database) because it alpha sorts it upon display  ..... 


Also, even though US is at top of list it is NOT the default  .....  (still shows select it)
.

Quote · 9 Sep 2008

Got it.  This will cause the country you wish to be auto-selected in all the main dolphin forms  :)

Took me 10 minutes - big smile.

Open:

templates/base/scripts/BxBaseFormView.php

Find this code (around line 510)

case 'select':
$sCode = '<select class="input_select" name="' . $aInput['Name'] . '">';
foreach( $aValues as $sKey => $sValue ) {
$sSelected = ( $aInput['Value'] == $sKey ) ? ' selected="selected"' : '';

$sLFKey = ($sValue != '_Select it' && $bUseRekey) ? '_FieldValues' . $sValue : $sValue;

Replace with:

case 'select':
$sCode = '<select class="input_select" name="' . $aInput['Name'] . '">';
foreach( $aValues as $sKey => $sValue ) {
if ($aInput['Name']=='Country[0]'){
$sSelected = '';
if ($aInput['Value'] == '' && $sKey == 'US'){$sSelected=' selected="selected"';}
else {if ($aInput['Value'] == $sKey && $aInput['Value'] != ''){$sSelected=' selected="selected"';}}
} else {
$sSelected = ( $aInput['Value'] == $sKey ) ? ' selected="selected"' : '';
}
$sLFKey = ($sValue != '_Select it' && $bUseRekey) ? '_FieldValues' . $sValue : $sValue;

--

POST EDIT:  I updated this with the fix below to make it easier for you - just use this.

---

If you don't want US as default, change the 'US'  to the two letter abbreviation (ISO2) code for your country.

:)

Enjoy everyone!

Chris

www.convictionscommunity.com

Quote · 9 Sep 2008

Thanks once again Chris!

That changes it to:

<option value="US" selected="selected">United States</option>

It works perfectly in Internet EXploder 7.0.6 and Opera 9.26, but in FireFox 3.0 it changes the source but the "select it" still shows in the field instead of "United States".
.
.

Quote · 9 Sep 2008
Quote · 9 Sep 2008

Ah, found out why - here is the updated code - replace with it - then it will work ALL browsers:

case 'select':
$sCode = '<select class="input_select" name="' . $aInput['Name'] . '">';
foreach( $aValues as $sKey => $sValue ) {
if ($aInput['Name']=='Country[0]'){
$sSelected = '';
if ($aInput['Value'] == '' && $sKey == 'US'){$sSelected=' selected="selected"';}
else {if ($aInput['Value'] == $sKey && $aInput['Value'] != ''){$sSelected=' selected="selected"';}}
} else {
$sSelected = ( $aInput['Value'] == $sKey ) ? ' selected="selected"' : '';
}
$sLFKey = ($sValue != '_Select it' && $bUseRekey) ? '_FieldValues' . $sValue : $sValue;

Fixed - let me know Rumpy.....

:)

Chris

Quote · 9 Sep 2008

Same thing  .....  no joy  .....  :(  .....  FireFox 3.0

(FYI, Yes I clear cache over n over when testing)

Quote · 9 Sep 2008

Whoo Hoo! It works  (but of course is does, he says Laughing)

-

US is now standing proudly at the top of country section in  Join page!

-

But, I thought this might also move the Country to top in Event and Classifieds Search....

-

Same file?

-

Really thanks Chris! But when ya get a minute....

Quote · 9 Sep 2008

US is now standing proudly at the top of country section in  Join page!

Wait  .....  is it supposed to move it to the 'top' of the list or just 'select' it within the list?

FireFox 3.0, Internet EXploder 7.0.6 and Opera 9.26 all three DO NOT move it to the top but instead 'select' it within the list which then displays it in the field window (except FireFox 3.0 doesn't as reported above)  ..... 
.

Quote · 10 Sep 2008

Hey Rumpy,

-

It only shows up on my JOIN page...in the country box.

-

When you go to Search Classifieds or Search Events....still the same Afghan.....and you have to scroll down to the US.

-

Cry

-

Maybe Chris will look again...I hope, I hope.

-

L

Quote · 10 Sep 2008

Chris, your a genius. many thanks!!

I have set Thailand as my default.

Stuart

Ah, found out why - here is the updated code - replace with it - then it will work ALL browsers:

case 'select':
$sCode = '<select class="input_select" name="' . $aInput['Name'] . '">';
foreach( $aValues as $sKey => $sValue ) {
if ($aInput['Name']=='Country[0]'){
$sSelected = '';
if ($aInput['Value'] == '' && $sKey == 'US'){$sSelected=' selected="selected"';}
else {if ($aInput['Value'] == $sKey && $aInput['Value'] != ''){$sSelected=' selected="selected"';}}
} else {
$sSelected = ( $aInput['Value'] == $sKey ) ? ' selected="selected"' : '';
}
$sLFKey = ($sValue != '_Select it' && $bUseRekey) ? '_FieldValues' . $sValue : $sValue;

Fixed - let me know Rumpy.....

:)

Chris

There are none so blind as those that will not see.
Quote · 10 Sep 2008

But Stuart,

-

Does it work...like say..when you use Search Events/Classifieds? Is Thailand the first country there?

-

~~ L

Quote · 10 Sep 2008

Ask and ye shall receive :) - lol, okay, for events search default, which I want to add, it defaults to the member's country who is logged in automatically, to place US as the selected country for someone not logged in, so it doesn't start with afgan.... it's this simple:

open inc/classes/BxDolEvents.php and find function: (after 1400+)

function PageSDatingShowForm() {

scroll down until you find:

// collect information about current member
if( $logged['member'] ) {

add two lines above it:

$aMemberData = array();
$aMemberData['Country'] = 'US';

Presto - non-logged in search default is United States  :)

Enjoy!

Chris

-

Be back with classifieds in a moment :)

Quote · 10 Sep 2008

Okay, setting default search in classifieds from 'Any' to 'US' is as simple as this:

open inc/classes/BxDolClassifieds.php find this function (around 1860)

function PrintFilterForm($iClassifiedID = -1, $iSubClassifiedID = -1) {
find this line:

$sCountry = process_db_input( $_REQUEST['FilterCountry'], 1 );

Replace with:

$sCountry = $_REQUEST['FilterCountry'] != '' ? process_db_input( $_REQUEST['FilterCountry'], 1 ) : 'US';

Thats all of it :)  I think, til' lorren finds the next one!  Laughing

Enjoy,

Chris

Quote · 10 Sep 2008


FOR THE ORIGINAL "JOIN PAGE"  ..... 
It works perfectly in Internet EXploder 7.0.6 and Opera 9.26, but in FireFox 3.0 it changes the source but the "select it" still shows in the field instead of "United States".

Quote · 10 Sep 2008

WOW Chris...you were fast! Performed the Event mod: Cleared cache, using IE to view, logged in...what am I missing....? Nada.

-

Quote · 10 Sep 2008

Hm.  Maybe an older version of events?  Not sure.  Does your version have the lines I spoke of above?

Rumpy, did you update to the code I used above, no one can replicate your problem, it is working cross browser, selecting (not moving it to the top) and showing United States - or thailand in stuarts case :)

Lorren, send me an email as before, I'll look real quick if you want me to.  On the site I am working on, its dolphin 6.1.4 - the above all three work great.

Chris

Quote · 10 Sep 2008

Thanks Topher.  Works great.

Quote · 10 Sep 2008

FireFox 3.0, Internet EXploder 7.0.6 and Opera 9.26 all work perfectly with the latest revision of the code  ..... 

BTWFWIW,
my code in the templates/base/scripts/BxBaseFormView.php file started on line 1019 instead of around line 516 ..... 
v6.1.4  .....

Quote · 10 Sep 2008

The Classifieds worked with no problem....

-

Let me take a look at the other one again, to see if I did something...

-

Most current version V6.1.4

-

Okay, setting default search in classifieds from 'Any' to 'US' is as simple as this:

open inc/classes/BxDolClassifieds.php find this function (around 1860)

function PrintFilterForm($iClassifiedID = -1, $iSubClassifiedID = -1) {
find this line:

$sCountry = process_db_input( $_REQUEST['FilterCountry'], 1 );

Replace with:

$sCountry = $_REQUEST['FilterCountry'] != '' ? process_db_input( $_REQUEST['FilterCountry'], 1 ) : 'US';

Thats all of it :)  I think, til' lorren finds the next one!  Laughing

Enjoy,

Chris

Quote · 10 Sep 2008

FireFox 3.0, Internet EXploder 7.0.6 and Opera 9.26 all work perfectly with the latest revision of the code  .....

BTWFWIW,
my code in the templates/base/scripts/BxBaseFormView.php file started on line 1019 instead of around line 516 .....  v6.1.4  .....

Not sure, I have the latest download (don't even have it installed) - and 510 or so is where it's at, maybe you added a mod or two?   It don't matter, lol - as long as it works... :)

So, everyone good?

Off to work on my own site for awhile...

Chris

www.convictionscommunity.com

Quote · 10 Sep 2008

Hello Chris, both classifieds and events are working great. I am using FF3. www.asia-connect-th.com

Many thanks,

Stuart

There are none so blind as those that will not see.
Quote · 10 Sep 2008

Ok Chris...I see that instead of adding one line above...you changed to two lines...

-

I am still having the issue for events. Perhaps I did not add code to correct spot.

-

function PageSDatingShowForm() {
global $aPreValues;
global $oTemplConfig;
global $enable_event_creating;
global $logged;

$sShowCalendarC = _t('_Show calendar');
$sAddNewEventC = _t('_Add new event');
$sShowAllEventsC = _t('_Show all events');
$sShowEventsByCountryC = _t('_Show events by country');
$sShowC = _t('_Show');
$aMemberData = array();
$aMemberData['Country'] = 'US';
// collect information about current member
if( $logged['member'] ) {
$aMember['ID'] = (int)$_COOKIE['memberID'];
$aMemberData = getProfileInfo( $aMember['ID'] );
}

Quote · 10 Sep 2008

Hey Stuart,

-

Can you look at my code to see if I have it in the correct spot for Events?

-

Thanks

-

~~ L

Quote · 10 Sep 2008

Thats correct.  Scroll down from there, do you find these lines?

$sCountryOptions = '';
$sSelCountry = isset($aShow['country']) ? $aShow['country'] : $aMemberData['Country'];
foreach ( $aPreValues['Country'] as $key => $value ) {
$sCountrySelected = ( $sSelCountry == $key ) ? 'selected="selected"' : '';
$sCountryOptions .= "<option value=\"{$key}\" ". $sCountrySelected ." >". _t($value['LKey']) ."</option>";
}

Let me know....

Chris

Quote · 10 Sep 2008

Sorry Chris didn't know you were still online...

-

Here's the code: and it matches...

-

$sCountryOptions = '';
$sSelCountry = isset($aShow['country']) ? $aShow['country'] : $aMemberData['Country'];
foreach ( $aPreValues['Country'] as $key => $value ) {
$sCountrySelected = ( $sSelCountry == $key ) ? 'selected="selected"' : '';
$sCountryOptions .= "<option value=\"{$key}\" ". $sCountrySelected ." >". _t($value['LKey']) ."</option>";
}

Quote · 10 Sep 2008

Just to be sure, edit your profile, and make sure you have your country set to US.

We'll start there, since it's working elsewhere :)

Quote · 10 Sep 2008

Here's a larger section of code from the file:

/**
* page show filer form function
* @return HTML presentation of data
*/
function PageSDatingShowForm() {
global $aPreValues;
global $oTemplConfig;
global $enable_event_creating;
global $logged;

$sShowCalendarC = _t('_Show calendar');
$sAddNewEventC = _t('_Add new event');
$sShowAllEventsC = _t('_Show all events');
$sShowEventsByCountryC = _t('_Show events by country');
$sShowC = _t('_Show');
$aMemberData = array();
$aMemberData['Country'] = 'US';
// collect information about current member
if( $logged['member'] ) {
$aMember['ID'] = (int)$_COOKIE['memberID'];
$aMemberData = getProfileInfo( $aMember['ID'] );
}

$aShow = array();
$sCountryDisabled = 'disabled="disabled"';

if ( $_REQUEST['show_events'] == 'country' ) {
$aShow['country'] = process_db_input($_REQUEST['show_events_country'], 1);
$sCountryDisabled = '';
}

$sBlockForCalendarAndEventDiv = '';
if( $oTemplConfig -> customize['events']['showTopButtons'] ) {
$sBlockForCalendarAndEventDiv .= <<<EOF
<div align="center" class="blockForCalendarAndEvent">
<a href="{$_SERVER['PHP_SELF']}?action=calendar">{$sShowCalendarC}</a>
EOF;
if( $enable_event_creating and $logged['member'] ) {
$sBlockForCalendarAndEventDiv .= "| <a href=\"{$_SERVER['PHP_SELF']}?action=new\">{$sAddNewEventC}</a>";
}
$sBlockForCalendarAndEventDiv .= '</div>';
}

$sShowEventsChk = ($_REQUEST['show_events'] == 'all') ? 'checked="checked"' : '';
$sCountryChk = ($_REQUEST['show_events'] == 'country') ? 'checked="checked"' : '';

$sCountryOptions = '';
$sSelCountry = isset($aShow['country']) ? $aShow['country'] : $aMemberData['Country'];
foreach ( $aPreValues['Country'] as $key => $value ) {
$sCountrySelected = ( $sSelCountry == $key ) ? 'selected="selected"' : '';
$sCountryOptions .= "<option value=\"{$key}\" ". $sCountrySelected ." >". _t($value['LKey']) ."</option>";
}

$sRetHtml = <<<EOF
<center>
<script language="JavaScript" type="text/javascript">
<!--
function updateShowControls()
{
document.getElementById('show_events_select_id').disabled = !(document.getElementById('show_events_country_id').checked);
}
-->
</script>
{$sBlockForCalendarAndEventDiv}
<form id="showEventsForm" action="{$_SERVER['PHP_SELF']}" method="get">
<table cellpadding="4" cellspacing="0" border="0" class="text" width="600">
<tr>
<td align="left" colspan="2" class="text">
<input type="radio" name="show_events" id="show_events_all_id" value="all" style="vertical-align: middle;" onClick="javascript: updateShowControls();" {$sShowEventsChk} />
&nbsp;<label for="show_events_all_id">{$sShowAllEventsC}</label>
</td>
</tr>
<tr>
<td align="left" width="300" class="text">
<input type="radio" name="show_events" id="show_events_country_id" value="country" style="vertical-align: middle;" onClick="javascript: updateShowControls();"  {$sCountryChk} />
&nbsp;<label for="show_events_country_id">{$sShowEventsByCountryC}</label>
</td>
<td align="left" class="text">
<select class="no" name="show_events_country" id="show_events_select_id" {$sCountryDisabled} >{$sCountryOptions}</select>
</td>
</tr>
</table>
<br />
<input type="submit" class="no" value="{$sShowC}" />
<input type="hidden" name="action" value="show" />
<input type="hidden" name="from" value="0" />
</form>
</center>
EOF;

Quote · 10 Sep 2008

Around line 1422 in BXDolEvents.php

 

/**
     * page show filer form function
     * @return HTML presentation of data
     */
    function PageSDatingShowForm() {
        global $aPreValues;
        global $oTemplConfig;
        global $enable_event_creating;
        global $logged;

        $sShowCalendarC = _t('_Show calendar');
        $sAddNewEventC = _t('_Add new event');
        $sShowAllEventsC = _t('_Show all events');
        $sShowEventsByCountryC = _t('_Show events by country');
        $sShowC = _t('_Show');

        // collect information about current member
        $aMemberData['Country'] = 'TH'; // added code for country selection
        if( $logged['member'] ) {

            $aMember['ID'] = (int)$_COOKIE['memberID'];
            $aMemberData = getProfileInfo( $aMember['ID'] );
        }

 

classifieds coming up

There are none so blind as those that will not see.
Quote · 10 Sep 2008

Yes, profile is saved as US.

Quote · 10 Sep 2008

I see you already have classifieds. All the best.

Stuart

There are none so blind as those that will not see.
Quote · 10 Sep 2008

Is events working now?

Stuart

Yes, profile is saved as US.

There are none so blind as those that will not see.
Quote · 10 Sep 2008

Ok...so I figured that I would change the code to show up exactly as Stuart's. Moving one line and VOILA...it was like magic! It works!!!!!!

-

Thanks to Chris for these great mods...and Thanks to Stuart for my bumbling code!

-

Laughing

-

~~ Lorren

Quote · 10 Sep 2008

Ok...so I figured that I would change the code to show up exactly as Stuart's. Moving one line and VOILA...it was like magic! It works!!!!!!

-

Thanks to Chris for these great mods...and Thanks to Stuart for my bumbling code!

-

Laughing

-

~~ Lorren

That's interesting :)  - anyway, glad it works and now, I truly am off to work on my own site - to all, good night/day and happy dolphin'ing...


-

Chris

Quote · 10 Sep 2008

And not a colored line to be seen!! :-))

Stuart

Ok...so I figured that I would change the code to show up exactly as Stuart's. Moving one line and VOILA...it was like magic! It works!!!!!!

-

Thanks to Chris for these great mods...and Thanks to Stuart for my bumbling code!

-

Laughing

-

~~ Lorren

There are none so blind as those that will not see.
Quote · 10 Sep 2008
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.