Advertisement:

Author Topic: Item User registered or not [SOLVED]  (Read 895 times)

SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
Item User registered or not [SOLVED]
« on: January 18, 2015, 03:27:01 pm »
Hi,

I am looking for a helper function that tells me if the user of a item is actually a registered user or not.
I know the helper function "osc_user_regdate()" but I don't know if that would be the way to go.

So more specific, a user (either logged in or not) is looking at an item and that is the moment I want to have a check if the user that posted the item which is being viewed is actually a registered user so I can determine whether or not some action is allowed.


Thanks,
Eric
« Last Edit: January 18, 2015, 03:48:52 pm by SmaRTeY »

SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
Re: Item User registered or not
« Reply #1 on: January 18, 2015, 03:48:31 pm »
Okay, think I am having some brain freeze or something, I guess I should just use the helper function "osc_item_user_id()".... :o

L8ers,
Eric

BC-Products

  • Newbie
  • *
  • Posts: 12
Re: Item User registered or not
« Reply #2 on: January 18, 2015, 04:10:25 pm »

Hi Eric,

This might will help:

Code: [Select]
<?php

    
$user User::newInstance()->findByPrimaryKeyosc_item_user_id() );
    
    if (
$user['b_company'] == or 1){ 
        echo 
'Registered';                   
    } else { 
        echo 
'Not Registered';
    }

?>

And to display user types:

Code: [Select]
<?php

    
$user User::newInstance()->findByPrimaryKeyosc_item_user_id() );
    
    if (
$user['b_company'] == 0) { 
        echo 
'Invidual';                   
    } else if (
$user['b_company'] == 1) { 
        echo 
'Company';
    } else { 
        echo 
'Not Registered';
    }
?>

Peter
« Last Edit: January 18, 2015, 04:23:05 pm by BC-Products »

SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
Re: Item User registered or not [SOLVED]
« Reply #3 on: January 18, 2015, 04:53:20 pm »
Hi Peter,

thanks for helping but actually the check on osc_item_user_id() is enough to determine whether the user behind the item is a registered user or not. In my case there's only the need to have a simple check on a user being a registered user or not, whether my user is a 'user' or a 'company' does not make a difference.

I do like the fact you thought about differentiating though :)

Thanks,
Eric