Osclass Support Forums
Osclass plugin support => Business Profile Plugin => Topic started by: leuname07 on November 16, 2019, 10:02:23 PM
-
Hello,
I want to show 2 links in user menu only if user logged is a company
i try with this :
$user = User::newInstance()->findByPrimaryKey( osc_user_id() );
if($user['b_company'] == 1) { ?>
<a href="https://www.girltonight.ch/item/new"><?php _e('Add a listing', 'beta'); ?></a>
<a href="https://www.girltonight.ch/user/items"><?php _e('My listings', 'beta'); ?></a>
<?php };
and it's work !
But when i'm in an item page, if the user is not a company, he show the links !
I think the problem was with the code in item.php and if the item is from a company, we show the links.
Can you help me for this little code !
Thanks
-
@leuname07
You use incorrect user id function.
<?php $user = User::newInstance()->findByPrimaryKey(osc_logged_user_id()); ?>
<?php if(osc_is_web_user_logged_in() && $user['b_company'] == 1) { ?>
<a href="<?php echo osc_item_post_url(); ?>"><?php _e('Add a listing', 'beta'); ?></a>
<a href="<?php echo osc_user_dashboard_url(); ?>"><?php _e('My listings', 'beta'); ?></a>
<?php } ?>