*

Post Free Online

  • ***
  • 80 posts
  • Welcome to Post Free Online classified web site
How to get attribute id of Business Profile plugin to configure Osclass Pay Plugin. In user group I want to define attribute ID to enable business profile activation. Tell me the way through which. I can find out the attribute ID of any plug-in




Can be used by plugin (ie. Business Profile plugin).
« Last Edit: August 15, 2025, 10:24:09 AM by Post Free Online »

*

MB Themes

Should be 1,2,3 - connection between groups and BP levels.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Post Free Online

  • ***
  • 80 posts
  • Welcome to Post Free Online classified web site
Should be 1,2,3 - connection between groups and BP levels.

When I put 1,2,3 in a tribute field and saved changes. It shows successfully saved but when I see below where I made the changes it was showing zero instead of 1,2,3.  Check the screenshot below in sequence what I followed.  And I am unable to understand the connection between groups and BP levels. I selected the Gold group for activation of business profile (BP). So for business profile do we need to put all three numbers (1,2,3) or for business there is any specific number we need to put.  But the changes are not saved.

*

MB Themes

As said in Business profile configuration page.

Auto validation
When enabled and Osclass Pay groups are required for business profile, once user pay for membership in group, business profile will be activated/validated automatically.
If you have setup attr field on group in Osclass Pay and is 1,2 or 3, profile type will be updated as well (1-Basic, 2-Pro, 3-VIP).
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

MB Themes

Anyway, I think it may be little smarter to just create small function that generates label based on membership in user group... so if you are member of Gold group, you get in label "Gold" instead of Basic/Pro/VIP...

Add to business profile functions.php
Code: [Select]
// GENERATE USER LABEL
// Supports rewrite by Osclass Pay
// $user_id - osclass user id
function bpr_user_label($seller) {
  if(!isset($seller['pk_i_id'])) {
    return false;
  }
 
  $html = '<div class="bpr-user-type bpr-type-' . $seller['i_type'] . '">';
  $html .= bpr_user_type($seller['i_type']);
  $html .= '</div>';
 
  $html = osc_apply_filter('bpr_user_label', $html, $seller['fk_i_user_id'], $seller);
 
  return $html;
}

in plugin files (ie block.php) replace:
Code: [Select]
              <div class="bpr-user-type bpr-type-<?php echo $seller['i_type']; ?>">
                <?php echo bpr_user_type($seller['i_type']); ?>
              </div>

with:
Code: [Select]
<?php echo bpr_user_label($seller); ?>
In osclass pay functions.php add these:
Code: [Select]
// GET USER GROUP ROW
function osp_get_user_group_row($user_id = -1) {
  if($user_id == -1) {
    $user_id = osc_logged_user_id();
  }

  if($user_id > 0) {
    $group = ModelOSP::newInstance()->getUserGroupRecord($user_id);

    if(isset($group['pk_i_id'])) {
      return $group;
    }
  }

  return false;
}

// UPDATE BUSINESS PROFILE USER LABEL (html)
osc_add_filter('bpr_user_label', function($html, $user_id) {
  if($user_id > 0) {
    $group = osp_get_user_group_row($user_id);

    if($group !== false) {
      $color_style = ($group['s_color'] != '' ? 'background:' . $group['s_color'] . ';' : '');
     
      $html = '<div class="bpr-user-type bpr-user-group-' . $group['pk_i_id'] . '" data-group-id="' . $group['pk_i_id'] . '" style="' . $color_style . '" title="' . osc_esc_html($group['s_description']) . '">';
      $html .= $group['s_name'];
      $html .= '</div>';
 
      return $html;
    }
  }
 
  return $html; 
});


You should now get user membership group as label in business profile (will be included in next update).
« Last Edit: August 15, 2025, 11:07:23 AM by MB Themes »
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Post Free Online

  • ***
  • 80 posts
  • Welcome to Post Free Online classified web site
As said in Business profile configuration page.

Auto validation
When enabled and Osclass Pay groups are required for business profile, once user pay for membership in group, business profile will be activated/validated automatically.
If you have setup attr field on group in Osclass Pay and is 1,2 or 3, profile type will be updated as well (1-Basic, 2-Pro, 3-VIP).

Ok,  So I did config. in below screen shot Gold membership is required for business profile activation.


I have set up a attr Field on group in OS class pay but it is not saving as I showed you in my early message screenshot. I have choose 3-VIP Group for business profile. 

*

Post Free Online

  • ***
  • 80 posts
  • Welcome to Post Free Online classified web site
Anyway, I think it may be little smarter to just create small function that generates label based on membership in user group... so if you are member of Gold group, you get in label "Gold" instead of Basic/Pro/VIP...

Add to business profile functions.php
Code: [Select]
// GENERATE USER LABEL
// Supports rewrite by Osclass Pay
// $user_id - osclass user id
function bpr_user_label($seller) {
  if(!isset($seller['pk_i_id'])) {
    return false;
  }
 
  $html = '<div class="bpr-user-type bpr-type-' . $seller['i_type'] . '">';
  $html .= bpr_user_type($seller['i_type']);
  $html .= '</div>';
 
  $html = osc_apply_filter('bpr_user_label', $html, $seller['fk_i_user_id'], $seller);
 
  return $html;
}

in plugin files (ie block.php) replace:
Code: [Select]
              <div class="bpr-user-type bpr-type-<?php echo $seller['i_type']; ?>">
                <?php echo bpr_user_type($seller['i_type']); ?>
              </div>

with:
Code: [Select]
<?php echo bpr_user_label($seller); ?>
In osclass pay functions.php add these:
Code: [Select]
// GET USER GROUP ROW
function osp_get_user_group_row($user_id = -1) {
  if($user_id == -1) {
    $user_id = osc_logged_user_id();
  }

  if($user_id > 0) {
    $group = ModelOSP::newInstance()->getUserGroupRecord($user_id);

    if(isset($group['pk_i_id'])) {
      return $group;
    }
  }

  return false;
}

// UPDATE BUSINESS PROFILE USER LABEL (html)
osc_add_filter('bpr_user_label', function($html, $user_id) {
  if($user_id > 0) {
    $group = osp_get_user_group_row($user_id);

    if($group !== false) {
      $color_style = ($group['s_color'] != '' ? 'background:' . $group['s_color'] . ';' : '');
     
      $html = '<div class="bpr-user-type bpr-user-group-' . $group['pk_i_id'] . '" data-group-id="' . $group['pk_i_id'] . '" style="' . $color_style . '" title="' . osc_esc_html($group['s_description']) . '">';
      $html .= $group['s_name'];
      $html .= '</div>';
 
      return $html;
    }
  }
 
  return $html; 
});


You should now get user membership group as label in business profile (will be included in next update).


I made changes in code as you suggested.  and named the Groups in OsClass Pay Plugin as in Business profile. Please check in screen shot if all correct.  But I am unable to update and make changes in group packs.  It is showing that group updated but it reverts to old figures.


*

MB Themes

Name of osclass pay group does not matter, whta you put there will be shown in business partner.
Just add user to group.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots