*

epoolroy

  • ****
  • 121 posts
How to show User type at Profile?
« on: April 14, 2018, 05:54:51 AM »
Hai, i had one question, how can i do show a user type on profile? For information, i already create 3 user type (User, Company, Enterprise)
What i want just show the user type on user profile.

Example : User Type : Company

I put this code but not work at user-profile.php

Code: [Select]
<div class="row">
              <label for="b_company"><?php _e('User type''stela'); ?></label>
              <?php if( osc_user_type() =="1" ) echo _e('Company','stela');
                if( 
osc_user_type() =="2" ) echo _e('Enterprise','stela'); 
                    else echo 
_e('User','stela'); ?>

            </div>

And this code at hUsers.php

Code: [Select]
   function osc_user_type() {
       return (string) osc_user_field("b_company");
    }
   

Can tell me what im wrong and please help me to fix this code.
Thank you
« Last Edit: April 14, 2018, 06:48:57 AM by epoolroy »

*

Dawid

  • ****
  • 149 posts
Re: How to show User type at Profile?
« Reply #1 on: April 14, 2018, 06:52:48 AM »
<div class="elem type">
              <?php $user = User::newInstance()->findByPrimaryKey( osc_user_id() ); ?>
              <?php if($user['b_company'] == 1) { ?>

                <i class="fa fa-briefcase"></i> <?php _e('Company', 'stela'); ?>
              <?php } else { ?>
                <i class="fa fa-user-o"></i> <?php _e('Privat person', 'stela'); ?>
              <?php } ?>
            </div>


You can change " privat person" ---> Enterprise .
« Last Edit: April 14, 2018, 06:56:35 AM by Dawid »

*

epoolroy

  • ****
  • 121 posts
Re: How to show User type at Profile?
« Reply #2 on: April 16, 2018, 04:30:35 AM »
<div class="elem type">
              <?php $user = User::newInstance()->findByPrimaryKey( osc_user_id() ); ?>
              <?php if($user['b_company'] == 1) { ?>

                <i class="fa fa-briefcase"></i> <?php _e('Company', 'stela'); ?>
              <?php } else { ?>
                <i class="fa fa-user-o"></i> <?php _e('Privat person', 'stela'); ?>
              <?php } ?>
            </div>


You can change " privat person" ---> Enterprise .

Nice code but this not what i mean.... I had 3 user type....

*

MB Themes

Re: How to show User type at Profile?
« Reply #3 on: April 16, 2018, 07:52:21 AM »
@epoolroy
b_company  --> it means that this field should accept only 2 values: 1, 0 (boolean)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

epoolroy

  • ****
  • 121 posts
Re: How to show User type at Profile?
« Reply #4 on: April 16, 2018, 08:06:07 AM »
@epoolroy
b_company  --> it means that this field should accept only 2 values: 1, 0 (boolean)

How can i do accept 3 values?

*

MB Themes

Re: How to show User type at Profile?
« Reply #5 on: April 16, 2018, 08:52:22 AM »
Update database structure
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

epoolroy

  • ****
  • 121 posts
Re: How to show User type at Profile?
« Reply #6 on: April 16, 2018, 10:06:04 AM »
Update database structure
How? can you assist me?

*

HappyTiger

  • **
  • 9 posts
Re: How to show User type at Profile?
« Reply #7 on: March 15, 2021, 09:37:00 AM »
UserActions.php
find this
Code: [Select]
$input['b_company']      = (Params::getParam('b_company') != '' && Params::getParam('b_company') != 0) ? 1 : 0;replace with this
Code: [Select]
$input['b_company']      = (Params::getParam('b_company') != '') ? Params::getParam('b_company') : null;

*

MB Themes

Re: How to show User type at Profile?
« Reply #8 on: March 15, 2021, 09:49:48 AM »
@HappyTiger
This is not going to help, until b_company field in t_user table has type tinyint(1), you should change it to int or so first, then you can assign new values into this field.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots