Untitled

 avatar
unknown
plain_text
a year ago
2.0 kB
3
Indexable

function show_userid_b2b_rules($user) {
    $user_id = $user->ID;
    $rules = b2bking()->get_all_rules('all', $user_id);
    
    ?>
    <h3>List of dynamic rules that apply to this user:</h3>
    <table border="1">
      <thead>
          <tr>
              <th>ID</th>
              <th>Name</th>
              <th>Who</th>
              <th>Value</th>
              <th>Rule Type</th>
              <th>Qty / Val</th>
              <th>Priority</th>
              <th>Edit</th>
          </tr>
      </thead>
      <tbody>
          <?php
          foreach ($rules as $rule) {
            
              $post = get_post($rule);
              $title = $post->post_title;

              $rule_id = $rule; // Zakładam, że $rule zawiera ID reguły
              //$name = get_post_meta($rule, 'post_title', true);
              $name = $title;
              $howmuch = get_post_meta($rule, 'b2bking_rule_howmuch', true);
              $who = get_post_meta($rule, 'b2bking_rule_who', true);
              $what = get_post_meta($rule, 'b2bking_rule_what', true);
              $quantity_value = get_post_meta($rule, 'b2bking_rule_quantity_value', true);
              $prority = get_post_meta($rule, 'b2bking_standard_rule_priority', true);
              ?>
              <tr>
                  <td><?php echo $rule_id; ?></td>
                  <td><?php echo $name; ?></td>
                  <td><?php echo $who; ?></td>
                  <td><?php echo $howmuch; ?></td>
                  <td><?php echo $what; ?></td>
                  <td><?php echo $quantity_value; ?></td>
                  <td><?php echo $prority; ?></td>
                  
                  <td><a href="post.php?post=<?php echo $rule_id; ?>&action=edit">Edit</a></td>
              </tr>
          <?php } ?>
        </tbody>
      </table>

    <?php
}

add_action('show_user_profile', 'show_userid_b2b_rules', 99);
add_action('edit_user_profile', 'show_userid_b2b_rules', 99);
Editor is loading...
Leave a Comment