YAFLogo

alik
  • alik
  • 50.2% (Neutral)
  • YAF Forumling Topic Starter
12 years ago
Hi,

I had been trying to find a way to set default country and timezone during registration through forum settings but couldn't find a solution. So I decided to go the jquery way as I didn't want to recompile the source.

Following is my solution, I thought it may help someone. Drop the following code at the bottom of register.ascx

<script type="text/javascript">
    function setDefaults() {
        if ($('span[id*=Country_titletext]').length) {
            $('span[id*=Country_titletext] > .ddTitleText').text("India");
            $('span[id*=Country_titletext]').prepend("<img align='absmiddle' src='/resources/images/flags/IN.png'>");
            $('select[id*=TimeZones]').val('330');
        }
    }
    window.onload = setDefaults;
</script>

330 is the code for indian timezeone. You can find the timezones in english.xml or whatever langauage file you are using. Replace 330 with your timezone code and India with your country name from languages xml. And you are done.

Hope this helps.

Sponsor