Osclass Support Forums
Osclass plugin support => Business Profile Plugin => Topic started by: pitbull on September 18, 2019, 05:43:10 PM
-
Hi Frosticek. I need to check in the main page of my site if a user has a business profile or not. Could you please help me.
I want to do something like that:
if user has business profile {
//DO SOMETHING HERE
} else {
//DO SOMETHING ELSE
}
In osclass for example you can use if($user["b_company"]==1)
to check if the member is user or company.
-
If what i asked before is difficult is there a way to automatically change the osclass user type from user to company every time the admin validate a business profile ?
For example as it is now when a user applying for business profile and the admin enable/validate this profile to business profile the user type is still "user" for example at the item page under the user info is still displaying "User" instead of company and i have to change that manually in admin page for every user !!!
UPDATE: i tried the helper:
if (bpr_is_business()) {
but doesnt work :(
-
@pitbull
Try with user id.
if(bpr_is_business(_some_user_id_here_)) { .... }
-
@pitbull
Try with user id.
if(bpr_is_business(_some_user_id_here_)) { .... }
That make sense, but doesnt work if you dont know the user id or if you print a list of many users.
So to extend your answer and also help other people here, you can easily get each user id using osclass helper osc_user_id()
and pass it inside your helper like that:
if(bpr_is_business(osc_user_id())) { //DO SOMETHING HERE }
Absolutely awesome! You can mark this as solved and the best answer as well ;)