Advertisement:

Author Topic: User profile description gets blank when placing language switcher in the header  (Read 120 times)

BenKia

  • Newbie
  • *
  • Posts: 9
Copy the language switch code from footer and paste it in the header, cause the user profile description gets blank after save when editing, but it have saved to the database as it was shown in the public profile page, just can't see it the profile page.

If the language switch code is removed, the description comes back as normal.

NOTE: There are not problems with the language switcher itself, it works fine for its job when placing the code in the header.


/* Below is the code copied from the footer.php
----------------------------------------------------- */
        <?php if ( osc_count_web_enabled_locales() > 1) { ?>
            <?php osc_goto_first_locale(); ?>     
            <?php $i = 0;  ?>
            <?php while ( osc_has_web_enabled_locales() ) { ?>
            <span><a id="<?php echo osc_locale_code(); ?>" href="<?php echo osc_change_language_url ( osc_locale_code() ); ?>"><?php echo osc_locale_name(); ?></a></span><?php if( $i == 0 ) { echo ""; } ?>
                <?php $i++; ?>
            <?php } ?>
        <?php } ?>
/* End language switcher code
---------------------------------- */

Please help if anyone have the experience with it, give your idea here.

WEBmods

  • Hero Member
  • *****
  • Posts: 936
  • github.com/webmods-croatia/love-osclass/ | patrick
Hello!

Modify your language switch code to this.

Code: [Select]
        <?php if ( osc_count_web_enabled_locales() > 1) { ?>
            <?php osc_goto_first_locale(); ?>     
            <?php $i 0;  ?>
            <?php while ( osc_has_web_enabled_locales() ) { ?>
            <span><a id="<?php echo osc_locale_code(); ?>" href="<?php echo osc_change_language_url osc_locale_code() ); ?>"><?php echo osc_locale_name(); ?></a></span><?php if( $i == ) { echo ""; } ?>
                <?php $i++; ?>
            <?php ?>
        <?php ?>
        <?php osc_goto_first_locale(); ?>

As you can see, I added osc_goto_first_locale() function to the end. It resets locale view, which is being used to display user description in the proper language.

Regards.

BenKia

  • Newbie
  • *
  • Posts: 9
Hello WEBmods,

Thanks so much for your time.

I have just replace the code but unfortunately the user profile description still doesn't show up.


WEBmods

  • Hero Member
  • *****
  • Posts: 936
  • github.com/webmods-croatia/love-osclass/ | patrick
What about going to oc-content/themes/theme_name/user-profile.php and changing

Code: [Select]
<?php UserForm::info_textarea('s_info'osc_locale_code(), @$osc_user['locale'][osc_locale_code()]['s_info']); ?>

to

Code: [Select]
<?php UserForm::info_textarea('s_info'osc_current_user_locale(), @$osc_user['locale'][osc_current_user_locale()]['s_info']); ?>

I tested this solution and, if I understand your problem, it worked.

Regards.

BenKia

  • Newbie
  • *
  • Posts: 9
Hello WEBmods,

Your second solution for the modified code in user-profile.php has worked very well.

I'm very appreciated for your help in this case.

Best regards