*

Artem

  • **
  • 7 posts
Adding new profile types
« on: June 06, 2021, 03:23:01 PM »
Hello. How to correctly add new ones to the existing three types (Basic, Pro, VIP)?

I registered new types (added types numbered 4 and 5) in the files: functions.php:

// GET USER TYPE
function bpr_user_type($type) {
  if($type == 1) {
    echo __('Basic', 'business_profile');
  } else if ($type == 2) {
    echo __('Pro', 'business_profile');
  } else if ($type == 3) {
    echo __('VIP', 'business_profile');
  } else if ($type == 4) {
    echo __('Gold', 'business_profile');
  } else if ($type == 5) {
    echo __('Platinum', 'business_profile');
  }
}

 and admin/profiles.php:

<select id="type" name="type_<?php echo $p['pk_i_id']; ?>">

                    <option value="1" <?php if($p['i_type'] == 1) { ?>selected="selected"<?php } ?>><?php _e('Basic', 'business_profile'); ?></option>

                    <option value="2" <?php if($p['i_type'] == 2) { ?>selected="selected"<?php } ?>><?php _e('Pro', 'business_profile'); ?></option>

                    <option value="3" <?php if($p['i_type'] == 3) { ?>selected="selected"<?php } ?>><?php _e('VIP', 'business_profile'); ?></option>

                    <option value="4" <?php if($p['i_type'] == 4) { ?>selected="selected"<?php } ?>><?php _e('Gold', 'business_profile'); ?></option>

                    <option value="5" <?php if($p['i_type'] == 5) { ?>selected="selected"<?php } ?>><?php _e('Platinum', 'business_profile'); ?></option>

                  </select>


I also registered "attr" values ​​from 1 to 5 in the user's subscriptions in the Osclass Pay Payment Plugin.

All Business profile types are manually changed in the site admin panel (3 old and 2 new). But when a user buys a subscription, the first three types (which were already in the business plugin) change automatically depending on the selected subscription, and the two new types do not change (the type is automatically set to number 1).

Can you please tell me where and what changes need to be made in order for the new types to work correctly in conjunction with subscriptions from the Osclass Pay Payment Plugin?

Thank you
« Last Edit: June 06, 2021, 03:32:17 PM by Artem »

Marked as best answer by frosticek on June 07, 2021, 10:44:11 AM
*

Artem

  • **
  • 7 posts
Re: Adding new profile types
« Reply #1 on: June 06, 2021, 07:21:18 PM »
Thank you, I have already found a solution to the problem myself.

Maybe someone will come in handy:
Needed in the functions.php file add your own values in this code

 if(in_array($user_group, $groups)) {
        $u_group = ModelOSP::newInstance()->getGroup($user_group);

        if(($u_group['i_attr'] <> $seller['i_type']) && ($u_group['i_attr'] == 1 || $u_group['i_attr'] == 2 || $u_group['i_attr'] == 3)) {
          ModelBPR::newInstance()->updateProfileType($seller['pk_i_id'], $u_group['i_attr']);
        }


*

MB Themes

Re: Adding new profile types
« Reply #2 on: June 07, 2021, 10:44:30 AM »
@Artem
Thanks for nice guide ;)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots