Forum

Notifications
Clear all

3 type of users

12 Posts
4 Users
1 Likes
1,007 Views
(@leuname07)
Posts: 36
Eminent Member
Topic starter
 

Good evening everyone,

For my site, I need to have 3 different types of users:

- Customer
- Escort
- Club

and Osclass only allows 2 types with personal or professional.

How can I do ?

Thank you in advance.

 
Posted : 17/03/2020 12:24 am
Defected
(@dftd)
Posts: 614
Honorable Member Admin
 

Without modifying core, you can use User Custom Fields plugin.

Available for custom Osclass development. www.defected.dev

 
Posted : 21/03/2020 10:21 am
(@leuname07)
Posts: 36
Eminent Member
Topic starter
 

great thanks a lot.

Now, depending on the type of user, how can I hide certain links when the user is logged in.

 
Posted : 24/03/2020 3:53 am
Defected
(@dftd)
Posts: 614
Honorable Member Admin
 

Example:


<?php
$field = usercf_user_field('FIELD ID', osc_logged_user_id());
if($field == 'user type 1') {
    // do this
} else if($field == 'user type 2') {
    // do this
}

Available for custom Osclass development. www.defected.dev

 
Posted : 24/03/2020 11:30 am
emanwebdev reacted
(@leuname07)
Posts: 36
Eminent Member
Topic starter
 

Hello,

But don't work. This my code :


$field = usercf_user_field('1', osc_logged_user_id());
if($field == 'Client') {?>
                          <a href=""<?php" echo osc_user_alerts_url(); ?>"><?php _e('Alerts', 'gamma'); ?></a>
              <a href=""<?php" echo osc_route_url('favorite-lists'); ?>"><?php _e('Favorite items', 'gamma'); ?></a>
            }

I don't have error. I just not see the links in the menu.

Thank you for your help !

 
Posted : 24/03/2020 10:15 pm
Defected
(@dftd)
Posts: 614
Honorable Member Admin
 

[member=77]leuname07[/member] I tested this code and it worked fine. Check if you have a space after "Client" in the options list.

Available for custom Osclass development. www.defected.dev

 
Posted : 28/03/2020 12:55 am
(@resta)
Posts: 47
Eminent Member
 

@dftd 

I have a slightly different issue - I want to add some custom fields and on the signup form & account profile form I only want to show some fields to user and other fields to company.

For example, I add field1, field2, field, field4, etc., and I want to show field2 & field4 only to company - on the signup form and account profile (update) form and hide the rest of the fields from company and show only field1 and field3 to user and hide the rest.

I think the hook that displays fields on signup form needs to be disabled first and then on the signup form each individual field needs to be called with a loop, but I think it is more complicated than that. It would be nice if this is possible to do so we can create different signup options for user/company and/or collect different data.  Do you have a solution for this?  Thanks!

 
Posted : 28/08/2021 1:22 am
Defected
(@dftd)
Posts: 614
Honorable Member Admin
 

@resta

A simple solution would be to use some JS/jQuery to show the fields according to the value of company field.

Just an example code:

 

$(function() {

    $('input[name="b_company"]').on('change', function() {

        if($(this).val() == 1) { // If user selected "Yes"

            $('.some-css-class').hide();

        } else {

            $('.some-css-class').show();

        }

    });

});

Available for custom Osclass development. www.defected.dev

 
Posted : 30/08/2021 12:33 pm
(@resta)
Posts: 47
Eminent Member
 

@dftd 

Thanks for your reply - looks like it is above my pay grade and also when the user is signing up (on the signup form), info is not there in the database yet to know whether the user is a company or not - so during first-time signup the form cannot tell whether the user is a company or not.  Am I right? Thanks!

 
Posted : 31/08/2021 7:10 am
(@admin)
Posts: 43
Eminent Member Admin
 

@resta create 2 diffrent signup for user / company

Install the plugin called user custom field,

Create two signup page for user and company

List the field only for company.

Check the employer_green theme for signup demo.

 
Posted : 04/09/2021 1:40 pm
(@resta)
Posts: 47
Eminent Member
 

@admin 

Done

Done

Done

List the field only for company (how?  this is the issue I brought up). When the signup page loads it will display all fields (from the user custom fields plugin) on both forms. I want to show only some fields to the user (on the user signup form) and some other fields to the company (on the company signup form) and I want to know how to do that and with what Defected mentioned, I already commented the issue ie. on the first signup b_company (0 or 1) data is not available and until the user signs up for an account. Thanks!

 
Posted : 05/09/2021 12:42 am
(@admin)
Posts: 43
Eminent Member Admin
 

@resta

Is the website online? Can I see? U using any hook for signup page?

 
Posted : 07/09/2021 6:28 pm
Share: