Support Forums - Classified Ads Script Osclass
Osclass theme support => Stela Osclass Theme => Topic started by: epoolroy 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
<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
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
-
<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 .
-
<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....
-
@epoolroy
b_company --> it means that this field should accept only 2 values: 1, 0 (boolean)
-
@epoolroy
b_company --> it means that this field should accept only 2 values: 1, 0 (boolean)
How can i do accept 3 values?
-
Update database structure
-
Update database structure
How? can you assist me?
-
UserActions.php
find this
$input['b_company'] = (Params::getParam('b_company') != '' && Params::getParam('b_company') != 0) ? 1 : 0;
replace with this
$input['b_company'] = (Params::getParam('b_company') != '') ? Params::getParam('b_company') : null;
-
@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.