Use new code style
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@ -34,17 +34,18 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct(array(
|
||||
'singular' => __('Broadcast', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Broadcasts', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
'add_new' => array(
|
||||
'url' => wu_get_form_url('add_new_broadcast_message'),
|
||||
'classes' => 'wubox',
|
||||
),
|
||||
));
|
||||
|
||||
} // end __construct;
|
||||
parent::__construct(
|
||||
array(
|
||||
'singular' => __('Broadcast', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Broadcasts', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
'add_new' => array(
|
||||
'url' => wu_get_form_url('add_new_broadcast_message'),
|
||||
'classes' => 'wubox',
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the checkbox column to disable the checkboxes on the email types.
|
||||
@ -57,14 +58,11 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
public function column_cb($item) {
|
||||
|
||||
if ($item->get_type() === 'broadcast_email') {
|
||||
|
||||
return '<input type="checkbox" disabled>';
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return parent::column_cb($item);
|
||||
|
||||
} // end column_cb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the markup for the type column.
|
||||
@ -81,40 +79,27 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
$class = 'wu-bg-gray-200';
|
||||
|
||||
if ($type === 'broadcast_email') {
|
||||
|
||||
$label = __('Email', 'wp-ultimo');
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if ($type === 'broadcast_notice') {
|
||||
|
||||
$status = $item->get_notice_type();
|
||||
|
||||
$label = __('Notice', 'wp-ultimo');
|
||||
|
||||
if ($status === 'info') {
|
||||
|
||||
$class = 'wu-bg-blue-200';
|
||||
|
||||
} elseif ($status === 'success') {
|
||||
|
||||
$class = 'wu-bg-green-200';
|
||||
|
||||
} elseif ($status === 'warning') {
|
||||
|
||||
$class = 'wu-bg-orange-200';
|
||||
|
||||
} elseif ($status === 'error') {
|
||||
|
||||
$class = 'wu-bg-red-200';
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
}
|
||||
|
||||
return "<span class='wu-py-1 wu-px-2 $class wu-rounded-sm wu-text-gray-700 wu-text-xs wu-font-mono'>{$label}</span>";
|
||||
|
||||
} // end column_type;
|
||||
}
|
||||
/**
|
||||
* Displays the name of the broadcast.
|
||||
*
|
||||
@ -131,7 +116,7 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
$url_atts = array(
|
||||
'id' => $item->get_id(),
|
||||
'slug' => $item->get_slug(),
|
||||
'model' => 'broadcast'
|
||||
'model' => 'broadcast',
|
||||
);
|
||||
|
||||
$actions = array(
|
||||
@ -140,8 +125,7 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
);
|
||||
|
||||
return $title . $content . $this->row_actions($actions);
|
||||
|
||||
} // end column_the_content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the target customers of the broadcast.
|
||||
@ -182,10 +166,16 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
|
||||
$customer_link = wu_network_admin_url('wp-ultimo-edit-customer', $url_atts);
|
||||
|
||||
$avatar = get_avatar($customer->get_user_id(), 32, 'identicon', '', array(
|
||||
'force_display' => true,
|
||||
'class' => 'wu-rounded-full wu-border-solid wu-border-1 wu-border-white hover:wu-border-gray-400',
|
||||
));
|
||||
$avatar = get_avatar(
|
||||
$customer->get_user_id(),
|
||||
32,
|
||||
'identicon',
|
||||
'',
|
||||
array(
|
||||
'force_display' => true,
|
||||
'class' => 'wu-rounded-full wu-border-solid wu-border-1 wu-border-white hover:wu-border-gray-400',
|
||||
)
|
||||
);
|
||||
|
||||
$display_name = $customer->get_display_name();
|
||||
|
||||
@ -205,16 +195,21 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
break;
|
||||
default:
|
||||
foreach ($targets as $key => $target) {
|
||||
|
||||
$customer = $target;
|
||||
|
||||
$tooltip_name = $customer->get_display_name();
|
||||
|
||||
$email = $customer->get_email_address();
|
||||
|
||||
$avatar = get_avatar($email, 32, 'identicon', '', array(
|
||||
'class' => 'wu-rounded-full wu-border-solid wu-border-1 wu-border-white hover:wu-border-gray-400',
|
||||
));
|
||||
$avatar = get_avatar(
|
||||
$email,
|
||||
32,
|
||||
'identicon',
|
||||
'',
|
||||
array(
|
||||
'class' => 'wu-rounded-full wu-border-solid wu-border-1 wu-border-white hover:wu-border-gray-400',
|
||||
)
|
||||
);
|
||||
|
||||
$url_atts = array(
|
||||
'id' => $customer->get_id(),
|
||||
@ -223,11 +218,9 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
$customer_link = wu_network_admin_url('wp-ultimo-edit-customer', $url_atts);
|
||||
|
||||
$html .= "<div class='wu-flex wu--mr-4'><a role='tooltip' aria-label='{$tooltip_name}' href='{$customer_link}'>{$avatar}</a></div>";
|
||||
|
||||
} // end foreach;
|
||||
}
|
||||
|
||||
if ($targets_count < 7) {
|
||||
|
||||
$modal_atts = array(
|
||||
'action' => 'wu_modal_targets_display',
|
||||
'object_id' => $item->get_id(),
|
||||
@ -236,15 +229,20 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
'target_type' => 'customers',
|
||||
);
|
||||
|
||||
$html .= sprintf('<div class="wu-inline-block wu-mr-2">
|
||||
$html .= sprintf(
|
||||
'<div class="wu-inline-block wu-mr-2">
|
||||
<a href="%s" title="%s" class="wubox"><span class="wu-ml-6 wu-uppercase wu-text-xs wu-font-bold"> %s %s</span></a>
|
||||
</div>', wu_get_form_url('view_broadcast_targets', $modal_atts), __('Targets', 'wp-ultimo'), $targets_count, __('Targets', 'wp-ultimo'));
|
||||
</div>',
|
||||
wu_get_form_url('view_broadcast_targets', $modal_atts),
|
||||
__('Targets', 'wp-ultimo'),
|
||||
$targets_count,
|
||||
__('Targets', 'wp-ultimo')
|
||||
);
|
||||
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$modal_atts = array(
|
||||
'action' => 'wu_modal_targets_display',
|
||||
@ -254,19 +252,23 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
'target_type' => 'customers',
|
||||
);
|
||||
|
||||
$html .= sprintf('<div class="wu-inline-block wu-ml-4">
|
||||
$html .= sprintf(
|
||||
'<div class="wu-inline-block wu-ml-4">
|
||||
<a href="%s" title="%s" class="wubox"><span class="wu-pl-2 wu-uppercase wu-text-xs wu-font-bold"> %s %s</span></a>
|
||||
</div>', wu_get_form_url('view_broadcast_targets', $modal_atts), __('Targets', 'wp-ultimo'), $targets_count, __('Targets', 'wp-ultimo'));
|
||||
</div>',
|
||||
wu_get_form_url('view_broadcast_targets', $modal_atts),
|
||||
__('Targets', 'wp-ultimo'),
|
||||
$targets_count,
|
||||
__('Targets', 'wp-ultimo')
|
||||
);
|
||||
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
|
||||
break;
|
||||
|
||||
} // end switch;
|
||||
|
||||
} // end column_target_customers;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the target products of the broadcast.
|
||||
@ -303,16 +305,12 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
$image = $product->get_featured_image('thumbnail');
|
||||
|
||||
if ($image) {
|
||||
|
||||
$image = sprintf('<img class="wu-w-7 wu-h-7 wu-bg-gray-200 wu-rounded-full wu-text-gray-600 wu-flex wu-items-center wu-justify-center wu-border-solid wu-border-1 wu-border-white hover:wu-border-gray-400" src="%s">', esc_attr($image));
|
||||
|
||||
} else {
|
||||
|
||||
$image = '<div class="wu-w-7 wu-h-7 wu-bg-gray-200 wu-rounded-full wu-text-gray-600 wu-flex wu-items-center wu-justify-center wu-border-solid wu-border-1 wu-border-white">
|
||||
<span class="dashicons-wu-image"></span>
|
||||
</div>';
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$name = $product->get_name();
|
||||
|
||||
@ -323,10 +321,8 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
$customer_count = (int) 0;
|
||||
|
||||
if ($plan_customers) {
|
||||
|
||||
$customer_count = count($plan_customers);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$description = sprintf(__('%s customer(s) targeted.', 'wp-ultimo'), $customer_count);
|
||||
|
||||
@ -344,19 +340,15 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
</div>
|
||||
</a>";
|
||||
break;
|
||||
|
||||
} // end switch;
|
||||
}
|
||||
|
||||
if ($html) {
|
||||
|
||||
return $html;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$html = '<div class="wu-p-2 wu-mr-1 wu-flex wu-rounded wu-items-center wu-border wu-border-solid wu-border-gray-300 wu-bg-gray-100 wu-relative wu-overflow-hidden">';
|
||||
|
||||
foreach ($products as $product) {
|
||||
|
||||
$url_atts = array(
|
||||
'id' => $product->get_id(),
|
||||
);
|
||||
@ -368,23 +360,17 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
$image = $product->get_featured_image('thumbnail');
|
||||
|
||||
if ($image) {
|
||||
|
||||
$image = sprintf('<img class="wu-w-7 wu-h-7 wu-bg-gray-200 wu-rounded-full wu-text-gray-600 wu-flex wu-items-center wu-justify-center wu-border-solid wu-border-1 wu-border-white hover:wu-border-gray-400" src="%s">', esc_attr($image));
|
||||
|
||||
} else {
|
||||
|
||||
$image = '<div class="wu-w-7 wu-h-7 wu-bg-gray-200 wu-rounded-full wu-text-gray-600 wu-flex wu-items-center wu-justify-center wu-border-solid wu-border-1 wu-border-white hover:wu-border-gray-400">
|
||||
<span class="dashicons-wu-image wu-p-1 wu-rounded-full"></span>
|
||||
</div>';
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$html .= "<div class='wu-flex wu--mr-4'><a role='tooltip' aria-label='{$product_name}' href='{$product_link}'>{$image}</a></div>";
|
||||
|
||||
} // end foreach;
|
||||
}
|
||||
|
||||
if ($product_count > 1 && $product_count < 5) {
|
||||
|
||||
$modal_atts = array(
|
||||
'action' => 'wu_modal_targets_display',
|
||||
'object_id' => $item->get_id(),
|
||||
@ -393,14 +379,19 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
'target_type' => 'products',
|
||||
);
|
||||
|
||||
$html .= sprintf('<div class="wu-inline-block wu-ml-4">
|
||||
<a href="%s" title="%s" class="wubox"><span class="wu-pl-2 wu-uppercase wu-text-xs wu-font-bold"> %s %s</span></a></div>', wu_get_form_url('view_broadcast_targets', $modal_atts), __('Targets', 'wp-ultimo'), $product_count, __('Targets', 'wp-ultimo'));
|
||||
$html .= sprintf(
|
||||
'<div class="wu-inline-block wu-ml-4">
|
||||
<a href="%s" title="%s" class="wubox"><span class="wu-pl-2 wu-uppercase wu-text-xs wu-font-bold"> %s %s</span></a></div>',
|
||||
wu_get_form_url('view_broadcast_targets', $modal_atts),
|
||||
__('Targets', 'wp-ultimo'),
|
||||
$product_count,
|
||||
__('Targets', 'wp-ultimo')
|
||||
);
|
||||
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$modal_atts = array(
|
||||
'action' => 'wu_modal_targets_display',
|
||||
@ -415,8 +406,7 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
|
||||
} // end column_target_products;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of columns for this particular List Table.
|
||||
@ -437,8 +427,7 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
);
|
||||
|
||||
return $columns;
|
||||
|
||||
} // end get_columns;
|
||||
}
|
||||
/**
|
||||
* Returns the filters for this page.
|
||||
*
|
||||
@ -472,8 +461,7 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_filters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the necessary scripts and styles for this admin page.
|
||||
@ -484,8 +472,7 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
public function register_scripts() {
|
||||
|
||||
parent::register_scripts();
|
||||
|
||||
} // end register_scripts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the pre-selected filters on the filter bar.
|
||||
@ -515,7 +502,5 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
'count' => 0,
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_views;
|
||||
|
||||
} // end class Broadcast_List_Table;
|
||||
}
|
||||
}
|
||||
|
@ -34,17 +34,18 @@ class Checkout_Form_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct(array(
|
||||
'singular' => __('Checkout Form', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Checkout Forms', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
'add_new' => array(
|
||||
'url' => wu_get_form_url('add_new_checkout_form'),
|
||||
'classes' => 'wubox',
|
||||
),
|
||||
));
|
||||
|
||||
} // end __construct;
|
||||
parent::__construct(
|
||||
array(
|
||||
'singular' => __('Checkout Form', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Checkout Forms', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
'add_new' => array(
|
||||
'url' => wu_get_form_url('add_new_checkout_form'),
|
||||
'classes' => 'wubox',
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Displays the content of the product column.
|
||||
*
|
||||
@ -64,14 +65,23 @@ class Checkout_Form_List_Table extends Base_List_Table {
|
||||
|
||||
$actions = array(
|
||||
'edit' => sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-edit-checkout-form', $url_atts), __('Edit', 'wp-ultimo')),
|
||||
'duplicate' => sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-checkout-forms', array('action' => 'duplicate', 'id' => $item->get_id())), __('Duplicate', 'wp-ultimo')),
|
||||
'duplicate' => sprintf(
|
||||
'<a href="%s">%s</a>',
|
||||
wu_network_admin_url(
|
||||
'wp-ultimo-checkout-forms',
|
||||
array(
|
||||
'action' => 'duplicate',
|
||||
'id' => $item->get_id(),
|
||||
)
|
||||
),
|
||||
__('Duplicate', 'wp-ultimo')
|
||||
),
|
||||
'get_shortcode' => sprintf('<a title="%s" class="wubox" href="%s">%s</a>', __('Shortcode', 'wp-ultimo'), wu_get_form_url('shortcode_checkout', $url_atts), __('Shortcode', 'wp-ultimo')),
|
||||
'delete' => sprintf('<a title="%s" class="wubox" href="%s">%s</a>', __('Delete', 'wp-ultimo'), wu_get_form_url('delete_modal', $url_atts), __('Delete', 'wp-ultimo')),
|
||||
);
|
||||
|
||||
return $title . $this->row_actions($actions);
|
||||
|
||||
} // end column_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the slug of the form.
|
||||
@ -86,8 +96,7 @@ class Checkout_Form_List_Table extends Base_List_Table {
|
||||
$slug = $item->get_slug();
|
||||
|
||||
return "<span class='wu-bg-gray-200 wu-text-gray-700 wu-py-1 wu-px-2 wu-rounded-sm wu-text-xs wu-font-mono'>{$slug}</span>";
|
||||
|
||||
} // end column_slug;
|
||||
}
|
||||
/**
|
||||
* Displays the number pof steps and fields.
|
||||
*
|
||||
@ -98,8 +107,7 @@ class Checkout_Form_List_Table extends Base_List_Table {
|
||||
public function column_steps($item): string {
|
||||
|
||||
return sprintf(__('%1$d Step(s) and %2$d Field(s)', 'wp-ultimo'), $item->get_step_count(), $item->get_field_count());
|
||||
|
||||
} // end column_steps;
|
||||
}
|
||||
/**
|
||||
* Displays the form shortcode.
|
||||
*
|
||||
@ -109,14 +117,16 @@ class Checkout_Form_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function column_shortcode($item): string {
|
||||
|
||||
$button = sprintf('
|
||||
$button = sprintf(
|
||||
'
|
||||
<button type="button" data-clipboard-action="copy" data-clipboard-target="#hidden_textarea" class="btn-clipboard" title="%s">
|
||||
<span class="dashicons-wu-copy"></span>
|
||||
</button>', __('Copy to the Clipboard', 'wp-ultimo'));
|
||||
</button>',
|
||||
__('Copy to the Clipboard', 'wp-ultimo')
|
||||
);
|
||||
|
||||
return sprintf('<input class="wu-bg-gray-200 wu-border-none wu-text-gray-700 wu-py-1 wu-px-2 wu-rounded-sm wu-text-xs wu-font-mono" value="%s">', esc_attr($item->get_shortcode()), '');
|
||||
|
||||
} // end column_shortcode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the bulk processing adding duplication
|
||||
@ -129,18 +139,15 @@ class Checkout_Form_List_Table extends Base_List_Table {
|
||||
$bulk_action = $this->current_action();
|
||||
|
||||
if ($bulk_action === 'duplicate') {
|
||||
|
||||
$checkout_form_id = wu_request('id');
|
||||
|
||||
$checkout_form = wu_get_checkout_form($checkout_form_id);
|
||||
|
||||
if (!$checkout_form) {
|
||||
|
||||
if ( ! $checkout_form) {
|
||||
WP_Ultimo()->notices->add(__('Checkout form not found.', 'wp-ultimo'), 'error', 'network-admin');
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$new_checkout_form = $checkout_form->duplicate();
|
||||
|
||||
@ -155,25 +162,24 @@ class Checkout_Form_List_Table extends Base_List_Table {
|
||||
$result = $new_checkout_form->save();
|
||||
|
||||
if (is_wp_error($result)) {
|
||||
|
||||
WP_Ultimo()->notices->add($result->get_error_message(), 'error', 'network-admin');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
} // end if;
|
||||
|
||||
$redirect_url = wu_network_admin_url('wp-ultimo-edit-checkout-form', array(
|
||||
'id' => $new_checkout_form->get_id(),
|
||||
'updated' => 1,
|
||||
));
|
||||
$redirect_url = wu_network_admin_url(
|
||||
'wp-ultimo-edit-checkout-form',
|
||||
array(
|
||||
'id' => $new_checkout_form->get_id(),
|
||||
'updated' => 1,
|
||||
)
|
||||
);
|
||||
|
||||
wp_redirect($redirect_url);
|
||||
|
||||
exit;
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end process_single_action;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of columns for this particular List Table.
|
||||
@ -192,8 +198,7 @@ class Checkout_Form_List_Table extends Base_List_Table {
|
||||
);
|
||||
|
||||
return $columns;
|
||||
|
||||
} // end get_columns;
|
||||
}
|
||||
/**
|
||||
* Returns the filters for this page.
|
||||
*
|
||||
@ -205,7 +210,5 @@ class Checkout_Form_List_Table extends Base_List_Table {
|
||||
'filters' => array(),
|
||||
'date_filters' => array(),
|
||||
);
|
||||
|
||||
} // end get_filters;
|
||||
|
||||
} // end class Checkout_Form_List_Table;
|
||||
}
|
||||
}
|
||||
|
@ -40,19 +40,21 @@ class Customer_List_Table extends Base_List_Table {
|
||||
'list' => __('List View'),
|
||||
);
|
||||
|
||||
$args = wp_parse_args($args, array(
|
||||
'singular' => __('Customer', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Customers', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
'add_new' => array(
|
||||
'url' => wu_get_form_url('add_new_customer'),
|
||||
'classes' => 'wubox',
|
||||
),
|
||||
));
|
||||
$args = wp_parse_args(
|
||||
$args,
|
||||
array(
|
||||
'singular' => __('Customer', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Customers', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
'add_new' => array(
|
||||
'url' => wu_get_form_url('add_new_customer'),
|
||||
'classes' => 'wubox',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
parent::__construct($args);
|
||||
|
||||
} // end __construct;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the extra search field when the search element is present.
|
||||
@ -66,46 +68,40 @@ class Customer_List_Table extends Base_List_Table {
|
||||
|
||||
$search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : false;
|
||||
|
||||
if (!empty($search)) {
|
||||
if ( ! empty($search)) {
|
||||
|
||||
// Search relevant users
|
||||
$user_ids = get_users(array(
|
||||
'number' => -1,
|
||||
'search' => '*' . $search . '*',
|
||||
'fields' => 'ids',
|
||||
));
|
||||
$user_ids = get_users(
|
||||
array(
|
||||
'number' => -1,
|
||||
'search' => '*' . $search . '*',
|
||||
'fields' => 'ids',
|
||||
)
|
||||
);
|
||||
|
||||
// No results, go back
|
||||
if (empty($user_ids)) {
|
||||
|
||||
return $_filter_fields;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
// Finally, include these user IDs in the customers query.
|
||||
$_filter_fields['user_id__in'] = $user_ids;
|
||||
|
||||
unset($_filter_fields['search']);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$_filter_fields['type'] = 'customer';
|
||||
|
||||
if (wu_request('filter', 'all') === 'vip') {
|
||||
|
||||
$_filter_fields['vip'] = 1;
|
||||
|
||||
} elseif (wu_request('filter', 'all') === 'online') {
|
||||
|
||||
$_filter_fields['last_login_query'] = array(
|
||||
'after' => '-3 minutes',
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $_filter_fields;
|
||||
|
||||
} // end get_extra_query_fields;
|
||||
}
|
||||
/**
|
||||
* Displays the content of the name column.
|
||||
*
|
||||
@ -123,21 +119,26 @@ class Customer_List_Table extends Base_List_Table {
|
||||
);
|
||||
|
||||
// Check if user exists
|
||||
if (!$user) {
|
||||
|
||||
if ( ! $user) {
|
||||
$actions = array(
|
||||
'delete' => sprintf('<a title="%s" class="wubox" href="%s">%s</a>', __('Delete', 'wp-ultimo'), wu_get_form_url('delete_modal', $url_atts), __('Delete', 'wp-ultimo')),
|
||||
);
|
||||
|
||||
return sprintf('<strong>#%s</strong> - %s', $item->get_user_id(), __('User not found', 'wp-ultimo')) . $this->row_actions($actions);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$customer_id = sprintf('<a href="?page=wp-ultimo-edit-customer&id=%s"><strong>#%s</strong></a>', $item->get_id(), $item->get_id());
|
||||
|
||||
$customer_user = sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-edit-customer', array(
|
||||
'id' => $item->get_id(),
|
||||
)), $user->display_name);
|
||||
$customer_user = sprintf(
|
||||
'<a href="%s">%s</a>',
|
||||
wu_network_admin_url(
|
||||
'wp-ultimo-edit-customer',
|
||||
array(
|
||||
'id' => $item->get_id(),
|
||||
)
|
||||
),
|
||||
$user->display_name
|
||||
);
|
||||
|
||||
// Concatenate the two blocks
|
||||
$title = "<strong>$customer_user</strong>";
|
||||
@ -159,7 +160,7 @@ class Customer_List_Table extends Base_List_Table {
|
||||
'delete_modal',
|
||||
array(
|
||||
'model' => 'customer',
|
||||
'id' => $item->get_id()
|
||||
'id' => $item->get_id(),
|
||||
)
|
||||
),
|
||||
__('Delete', 'wp-ultimo')
|
||||
@ -169,8 +170,7 @@ class Customer_List_Table extends Base_List_Table {
|
||||
$actions = array_filter($actions);
|
||||
|
||||
return $title . $desc . $this->row_actions($actions);
|
||||
|
||||
} // end column_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the customer photo and special status.
|
||||
@ -185,20 +185,23 @@ class Customer_List_Table extends Base_List_Table {
|
||||
$html = '<div class="wu-status-container">';
|
||||
|
||||
if ($item->is_vip()) {
|
||||
|
||||
$html .= sprintf('<span class="wu-tag wu-customer-vip">%s</span>', __('VIP', 'wp-ultimo'));
|
||||
}
|
||||
|
||||
} // end if;
|
||||
|
||||
$html .= get_avatar($item->get_user_id(), 36, 'identicon', '', array(
|
||||
'force_display' => true,
|
||||
));
|
||||
$html .= get_avatar(
|
||||
$item->get_user_id(),
|
||||
36,
|
||||
'identicon',
|
||||
'',
|
||||
array(
|
||||
'force_display' => true,
|
||||
)
|
||||
);
|
||||
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
|
||||
} // end column_customer_status;
|
||||
}
|
||||
/**
|
||||
* Returns the number of memberships owned by this customer.
|
||||
*
|
||||
@ -220,8 +223,7 @@ class Customer_List_Table extends Base_List_Table {
|
||||
);
|
||||
|
||||
return $subscription_count . $this->row_actions($actions);
|
||||
|
||||
} // end column_memberships;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of columns for this particular List Table.
|
||||
@ -242,8 +244,7 @@ class Customer_List_Table extends Base_List_Table {
|
||||
);
|
||||
|
||||
return $columns;
|
||||
|
||||
} // end get_columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the item display for grid mode.
|
||||
@ -255,12 +256,14 @@ class Customer_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function single_row_grid($item) {
|
||||
|
||||
wu_get_template('base/customers/grid-item', array(
|
||||
'item' => $item,
|
||||
'table' => $this,
|
||||
));
|
||||
|
||||
} // end single_row_grid;
|
||||
wu_get_template(
|
||||
'base/customers/grid-item',
|
||||
array(
|
||||
'item' => $item,
|
||||
'table' => $this,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the filters for this page.
|
||||
@ -269,46 +272,46 @@ class Customer_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function get_filters(): array {
|
||||
|
||||
$filters = $this->get_schema_columns(array(
|
||||
'searchable' => true,
|
||||
'date_query' => true,
|
||||
), 'or');
|
||||
$filters = $this->get_schema_columns(
|
||||
array(
|
||||
'searchable' => true,
|
||||
'date_query' => true,
|
||||
),
|
||||
'or'
|
||||
);
|
||||
|
||||
$labels = $this->get_columns();
|
||||
|
||||
$filters = array_map(function($item) use ($labels) {
|
||||
$filters = array_map(
|
||||
function ($item) use ($labels) {
|
||||
|
||||
$label = wu_get_isset($labels, $item->name);
|
||||
$label = $label ? sprintf('%s (%s)', $item->label, $item->name) : $item->name;
|
||||
$label = wu_get_isset($labels, $item->name);
|
||||
$label = $label ? sprintf('%s (%s)', $item->label, $item->name) : $item->name;
|
||||
|
||||
$filter_type = 'text';
|
||||
$rule = 'is';
|
||||
$filter_type = 'text';
|
||||
$rule = 'is';
|
||||
|
||||
if ($item->date_query === true) {
|
||||
if ($item->date_query === true) {
|
||||
$filter_type = 'date';
|
||||
$rule = 'is_after';
|
||||
} elseif (in_array(strtolower((string) $item->name), array('smallint'), true)) {
|
||||
$filter_type = 'bool';
|
||||
$rule = 'is_true';
|
||||
}
|
||||
|
||||
$filter_type = 'date';
|
||||
$rule = 'is_after';
|
||||
|
||||
} elseif (in_array(strtolower((string) $item->name), array('smallint'), true)) {
|
||||
|
||||
$filter_type = 'bool';
|
||||
$rule = 'is_true';
|
||||
|
||||
} // end if;
|
||||
|
||||
return array(
|
||||
'field' => $item->name,
|
||||
'label' => $label,
|
||||
'type' => $filter_type,
|
||||
'rule' => $rule,
|
||||
'value' => wu_request($item->name, ''),
|
||||
);
|
||||
|
||||
}, $filters);
|
||||
return array(
|
||||
'field' => $item->name,
|
||||
'label' => $label,
|
||||
'type' => $filter_type,
|
||||
'rule' => $rule,
|
||||
'value' => wu_request($item->name, ''),
|
||||
);
|
||||
},
|
||||
$filters
|
||||
);
|
||||
|
||||
return array_values($filters);
|
||||
|
||||
} // end get_filters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the pre-selected filters on the filter bar.
|
||||
@ -321,9 +324,11 @@ class Customer_List_Table extends Base_List_Table {
|
||||
return array(
|
||||
'all' => array(
|
||||
'field' => 'filter',
|
||||
'url' => add_query_arg(array(
|
||||
'filter' => 'all'
|
||||
)),
|
||||
'url' => add_query_arg(
|
||||
array(
|
||||
'filter' => 'all',
|
||||
)
|
||||
),
|
||||
'label' => __('All Customers', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
@ -340,8 +345,7 @@ class Customer_List_Table extends Base_List_Table {
|
||||
'count' => 0,
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_views;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the last login.
|
||||
@ -354,13 +358,9 @@ class Customer_List_Table extends Base_List_Table {
|
||||
public function column_last_login($item) {
|
||||
|
||||
if ($item->is_online()) {
|
||||
|
||||
return '<span class="wu-inline-block wu-mr-1 wu-rounded-full wu-h-2 wu-w-2 wu-bg-green-500"></span>' . __('Online', 'wp-ultimo');
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $this->_column_datetime($item->get_last_login());
|
||||
|
||||
} // end column_last_login;
|
||||
|
||||
} // end class Customer_List_Table;
|
||||
}
|
||||
}
|
||||
|
@ -32,8 +32,7 @@ class Customers_Membership_List_Table extends Membership_List_Table {
|
||||
);
|
||||
|
||||
return $columns;
|
||||
|
||||
} // end get_columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the inside column responsive.
|
||||
@ -53,43 +52,47 @@ class Customers_Membership_List_Table extends Membership_List_Table {
|
||||
|
||||
$products_list = $p ? sprintf(_n('Contains %s', 'Contains %1$s and %2$s other product(s)', $product_count, 'wp-ultimo'), $p->get_name(), count($item->get_addon_ids())) : ''; // phpcs:ignore
|
||||
|
||||
echo wu_responsive_table_row(array(
|
||||
'id' => $item->get_id(),
|
||||
'title' => $item->get_hash(),
|
||||
'url' => wu_network_admin_url('wp-ultimo-edit-membership', array(
|
||||
'id' => $item->get_id(),
|
||||
)),
|
||||
'status' => $this->column_status($item),
|
||||
), array(
|
||||
'total' => array(
|
||||
'icon' => 'dashicons-wu-shopping-bag1 wu-align-middle wu-mr-1',
|
||||
'label' => __('Payment Total', 'wp-ultimo'),
|
||||
'value' => $item->get_price_description(),
|
||||
echo wu_responsive_table_row(
|
||||
array(
|
||||
'id' => $item->get_id(),
|
||||
'title' => $item->get_hash(),
|
||||
'url' => wu_network_admin_url(
|
||||
'wp-ultimo-edit-membership',
|
||||
array(
|
||||
'id' => $item->get_id(),
|
||||
)
|
||||
),
|
||||
'status' => $this->column_status($item),
|
||||
),
|
||||
'products' => array(
|
||||
'icon' => 'dashicons-wu-package wu-align-middle wu-mr-1',
|
||||
'label' => __('Products', 'wp-ultimo'),
|
||||
'value' => $products_list,
|
||||
array(
|
||||
'total' => array(
|
||||
'icon' => 'dashicons-wu-shopping-bag1 wu-align-middle wu-mr-1',
|
||||
'label' => __('Payment Total', 'wp-ultimo'),
|
||||
'value' => $item->get_price_description(),
|
||||
),
|
||||
'products' => array(
|
||||
'icon' => 'dashicons-wu-package wu-align-middle wu-mr-1',
|
||||
'label' => __('Products', 'wp-ultimo'),
|
||||
'value' => $products_list,
|
||||
),
|
||||
'gateway' => array(
|
||||
'icon' => 'dashicons-wu-credit-card2 wu-align-middle wu-mr-1',
|
||||
'label' => __('Gateway', 'wp-ultimo'),
|
||||
'value' => wu_slug_to_name($item->get_gateway()),
|
||||
),
|
||||
),
|
||||
'gateway' => array(
|
||||
'icon' => 'dashicons-wu-credit-card2 wu-align-middle wu-mr-1',
|
||||
'label' => __('Gateway', 'wp-ultimo'),
|
||||
'value' => wu_slug_to_name($item->get_gateway()),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'date_expiration' => array(
|
||||
'icon' => 'dashicons-wu-calendar1 wu-align-middle wu-mr-1',
|
||||
'label' => __('Expires', 'wp-ultimo'),
|
||||
'value' => sprintf($expired ? __('Expired %s', 'wp-ultimo') : __('Expiring %s', 'wp-ultimo'), wu_human_time_diff(strtotime((string) $item->get_date_expiration()))),
|
||||
),
|
||||
'date_created' => array(
|
||||
'icon' => 'dashicons-wu-calendar1 wu-align-middle wu-mr-1',
|
||||
'label' => __('Created at', 'wp-ultimo'),
|
||||
'value' => sprintf(__('Created %s', 'wp-ultimo'), wu_human_time_diff(strtotime((string) $item->get_date_created()))),
|
||||
),
|
||||
));
|
||||
|
||||
} // end column_responsive;
|
||||
|
||||
} // end class Customers_Membership_List_Table;
|
||||
array(
|
||||
'date_expiration' => array(
|
||||
'icon' => 'dashicons-wu-calendar1 wu-align-middle wu-mr-1',
|
||||
'label' => __('Expires', 'wp-ultimo'),
|
||||
'value' => sprintf($expired ? __('Expired %s', 'wp-ultimo') : __('Expiring %s', 'wp-ultimo'), wu_human_time_diff(strtotime((string) $item->get_date_expiration()))),
|
||||
),
|
||||
'date_created' => array(
|
||||
'icon' => 'dashicons-wu-calendar1 wu-align-middle wu-mr-1',
|
||||
'label' => __('Created at', 'wp-ultimo'),
|
||||
'value' => sprintf(__('Created %s', 'wp-ultimo'), wu_human_time_diff(strtotime((string) $item->get_date_created()))),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -32,8 +32,7 @@ class Customers_Payment_List_Table extends Payment_List_Table {
|
||||
);
|
||||
|
||||
return $columns;
|
||||
|
||||
} // end get_columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the inside column responsive.
|
||||
@ -45,33 +44,37 @@ class Customers_Payment_List_Table extends Payment_List_Table {
|
||||
*/
|
||||
public function column_responsive($item) {
|
||||
|
||||
echo wu_responsive_table_row(array(
|
||||
'id' => $item->get_id(),
|
||||
'title' => $item->get_hash(),
|
||||
'url' => wu_network_admin_url('wp-ultimo-edit-payment', array(
|
||||
'id' => $item->get_id(),
|
||||
)),
|
||||
'status' => $this->column_status($item),
|
||||
), array(
|
||||
'total' => array(
|
||||
'icon' => 'dashicons-wu-shopping-bag1 wu-align-middle wu-mr-1',
|
||||
'label' => __('Payment Total', 'wp-ultimo'),
|
||||
'value' => wu_format_currency($item->get_total()),
|
||||
echo wu_responsive_table_row(
|
||||
array(
|
||||
'id' => $item->get_id(),
|
||||
'title' => $item->get_hash(),
|
||||
'url' => wu_network_admin_url(
|
||||
'wp-ultimo-edit-payment',
|
||||
array(
|
||||
'id' => $item->get_id(),
|
||||
)
|
||||
),
|
||||
'status' => $this->column_status($item),
|
||||
),
|
||||
'gateway' => array(
|
||||
'icon' => 'dashicons-wu-credit-card2 wu-align-middle wu-mr-1',
|
||||
'label' => __('Gateway', 'wp-ultimo'),
|
||||
'value' => wu_slug_to_name($item->get_gateway()),
|
||||
array(
|
||||
'total' => array(
|
||||
'icon' => 'dashicons-wu-shopping-bag1 wu-align-middle wu-mr-1',
|
||||
'label' => __('Payment Total', 'wp-ultimo'),
|
||||
'value' => wu_format_currency($item->get_total()),
|
||||
),
|
||||
'gateway' => array(
|
||||
'icon' => 'dashicons-wu-credit-card2 wu-align-middle wu-mr-1',
|
||||
'label' => __('Gateway', 'wp-ultimo'),
|
||||
'value' => wu_slug_to_name($item->get_gateway()),
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'date_created' => array(
|
||||
'icon' => 'dashicons-wu-calendar1 wu-align-middle wu-mr-1',
|
||||
'label' => '',
|
||||
'value' => sprintf(__('Created %s', 'wp-ultimo'), wu_human_time_diff(strtotime((string) $item->get_date_created()))),
|
||||
),
|
||||
));
|
||||
|
||||
} // end column_responsive;
|
||||
|
||||
} // end class Customers_Payment_List_Table;
|
||||
array(
|
||||
'date_created' => array(
|
||||
'icon' => 'dashicons-wu-calendar1 wu-align-middle wu-mr-1',
|
||||
'label' => '',
|
||||
'value' => sprintf(__('Created %s', 'wp-ultimo'), wu_human_time_diff(strtotime((string) $item->get_date_created()))),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -29,8 +29,7 @@ class Customers_Site_List_Table extends Site_List_Table {
|
||||
parent::__construct();
|
||||
|
||||
$this->current_mode = 'list';
|
||||
|
||||
} // end __construct;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of columns for this particular List Table.
|
||||
@ -45,8 +44,7 @@ class Customers_Site_List_Table extends Site_List_Table {
|
||||
);
|
||||
|
||||
return $columns;
|
||||
|
||||
} // end get_columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the inside column responsive.
|
||||
@ -62,46 +60,54 @@ class Customers_Site_List_Table extends Site_List_Table {
|
||||
|
||||
$redirect = current_user_can('wu_edit_sites') ? 'wp-ultimo-edit-site' : 'wp-ultimo-sites';
|
||||
|
||||
echo wu_responsive_table_row(array(
|
||||
'id' => $item->get_id(),
|
||||
'title' => $item->get_title(),
|
||||
'url' => wu_network_admin_url($redirect, array(
|
||||
'id' => $item->get_id(),
|
||||
)),
|
||||
'image' => $this->column_featured_image_id($item),
|
||||
'status' => $this->column_type($item),
|
||||
), array(
|
||||
'link' => array(
|
||||
'icon' => 'dashicons-wu-link1 wu-align-middle wu-mr-1',
|
||||
'label' => __('Visit Site', 'wp-ultimo'),
|
||||
'url' => $item->get_active_site_url(),
|
||||
'value' => $item->get_active_site_url(),
|
||||
echo wu_responsive_table_row(
|
||||
array(
|
||||
'id' => $item->get_id(),
|
||||
'title' => $item->get_title(),
|
||||
'url' => wu_network_admin_url(
|
||||
$redirect,
|
||||
array(
|
||||
'id' => $item->get_id(),
|
||||
)
|
||||
),
|
||||
'image' => $this->column_featured_image_id($item),
|
||||
'status' => $this->column_type($item),
|
||||
),
|
||||
'dashboard' => array(
|
||||
'icon' => 'dashicons-wu-browser wu-align-middle wu-mr-1',
|
||||
'label' => __('Go to the Dashboard', 'wp-ultimo'),
|
||||
'value' => __('Dashboard', 'wp-ultimo'),
|
||||
'url' => get_admin_url($item->get_id()),
|
||||
array(
|
||||
'link' => array(
|
||||
'icon' => 'dashicons-wu-link1 wu-align-middle wu-mr-1',
|
||||
'label' => __('Visit Site', 'wp-ultimo'),
|
||||
'url' => $item->get_active_site_url(),
|
||||
'value' => $item->get_active_site_url(),
|
||||
),
|
||||
'dashboard' => array(
|
||||
'icon' => 'dashicons-wu-browser wu-align-middle wu-mr-1',
|
||||
'label' => __('Go to the Dashboard', 'wp-ultimo'),
|
||||
'value' => __('Dashboard', 'wp-ultimo'),
|
||||
'url' => get_admin_url($item->get_id()),
|
||||
),
|
||||
'membership' => array(
|
||||
'icon' => 'dashicons-wu-rotate-ccw wu-align-middle wu-mr-1',
|
||||
'label' => __('Go to the Membership', 'wp-ultimo'),
|
||||
'value' => $m ? $m->get_hash() : '',
|
||||
'url' => $m ? wu_network_admin_url(
|
||||
'wp-ultimo-edit-membership',
|
||||
array(
|
||||
'id' => $m->get_id(),
|
||||
)
|
||||
) : '',
|
||||
),
|
||||
),
|
||||
'membership' => array(
|
||||
'icon' => 'dashicons-wu-rotate-ccw wu-align-middle wu-mr-1',
|
||||
'label' => __('Go to the Membership', 'wp-ultimo'),
|
||||
'value' => $m ? $m->get_hash() : '',
|
||||
'url' => $m ? wu_network_admin_url('wp-ultimo-edit-membership', array(
|
||||
'id' => $m->get_id(),
|
||||
)) : '',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'date_created' => array(
|
||||
'icon' => 'dashicons-wu-calendar1 wu-align-middle wu-mr-1',
|
||||
'label' => '',
|
||||
/* translators: the placeholder is a date */
|
||||
'value' => $item->get_type() === 'pending' ? __('Not Available', 'wp-ultimo') : sprintf(__('Created %s', 'wp-ultimo'), wu_human_time_diff(strtotime((string) $item->get_date_registered()))),
|
||||
),
|
||||
));
|
||||
|
||||
} // end column_responsive;
|
||||
array(
|
||||
'date_created' => array(
|
||||
'icon' => 'dashicons-wu-calendar1 wu-align-middle wu-mr-1',
|
||||
'label' => '',
|
||||
/* translators: the placeholder is a date */
|
||||
'value' => $item->get_type() === 'pending' ? __('Not Available', 'wp-ultimo') : sprintf(__('Created %s', 'wp-ultimo'), wu_human_time_diff(strtotime((string) $item->get_date_registered()))),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the parent method to add pending sites.
|
||||
@ -118,10 +124,8 @@ class Customers_Site_List_Table extends Site_List_Table {
|
||||
$sites = parent::get_items($per_page, $page_number, $count);
|
||||
|
||||
if ($count) {
|
||||
|
||||
return $sites;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$pending_sites = array();
|
||||
|
||||
@ -129,14 +133,11 @@ class Customers_Site_List_Table extends Site_List_Table {
|
||||
|
||||
$id = wu_request('id');
|
||||
|
||||
if (!$id) {
|
||||
|
||||
if ( ! $id) {
|
||||
return $sites;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
switch ($page) {
|
||||
|
||||
case 'wp-ultimo-edit-membership':
|
||||
$membership = wu_get_membership($id);
|
||||
$pending_sites = $membership && $membership->get_pending_site() ? array($membership->get_pending_site()) : array();
|
||||
@ -145,18 +146,13 @@ class Customers_Site_List_Table extends Site_List_Table {
|
||||
$customer = wu_get_customer($id);
|
||||
$pending_sites = $customer ? $customer->get_pending_sites() : array();
|
||||
break;
|
||||
|
||||
} // end switch;
|
||||
}
|
||||
|
||||
foreach ($pending_sites as &$site) {
|
||||
|
||||
$site->set_type('pending');
|
||||
$site->set_blog_id('--');
|
||||
|
||||
} // end foreach;
|
||||
}
|
||||
|
||||
return array_merge($pending_sites, $sites);
|
||||
|
||||
} // end get_items;
|
||||
|
||||
} // end class Customers_Site_List_Table;
|
||||
}
|
||||
}
|
||||
|
@ -34,17 +34,18 @@ class Discount_Code_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct(array(
|
||||
'singular' => __('Discount Code', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Discount Codes', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
'add_new' => array(
|
||||
'url' => wu_network_admin_url('wp-ultimo-edit-discount-code'),
|
||||
'classes' => '',
|
||||
),
|
||||
));
|
||||
|
||||
} // end __construct;
|
||||
parent::__construct(
|
||||
array(
|
||||
'singular' => __('Discount Code', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Discount Codes', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
'add_new' => array(
|
||||
'url' => wu_network_admin_url('wp-ultimo-edit-discount-code'),
|
||||
'classes' => '',
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Displays the content of the name column.
|
||||
*
|
||||
@ -75,8 +76,7 @@ class Discount_Code_List_Table extends Base_List_Table {
|
||||
);
|
||||
|
||||
return $title . $this->row_actions($actions);
|
||||
|
||||
} // end column_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the content of the value column.
|
||||
@ -89,24 +89,19 @@ class Discount_Code_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function column_value($item) {
|
||||
|
||||
if (!$item->get_value()) {
|
||||
|
||||
if ( ! $item->get_value()) {
|
||||
return __('No Discount', 'wp-ultimo');
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$value = wu_format_currency($item->get_value());
|
||||
|
||||
if ($item->get_type() === 'percentage') {
|
||||
|
||||
$value = number_format($item->get_value(), 0) . '%';
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
// translators: placeholder is the amount of discount. e.g. 10% or $5.
|
||||
return sprintf(__('%s OFF', 'wp-ultimo'), $value);
|
||||
|
||||
} // end column_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the content of the setup fee value column.
|
||||
@ -119,24 +114,19 @@ class Discount_Code_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function column_setup_fee_value($item) {
|
||||
|
||||
if (!$item->get_setup_fee_value()) {
|
||||
|
||||
if ( ! $item->get_setup_fee_value()) {
|
||||
return __('No Discount', 'wp-ultimo');
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$value = wu_format_currency($item->get_setup_fee_value());
|
||||
|
||||
if ($item->get_setup_fee_type() === 'percentage') {
|
||||
|
||||
$value = number_format($item->get_setup_fee_value()) . '%';
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
// translators: placeholder is the amount of discount. e.g. 10% or $5.
|
||||
return sprintf(__('%s OFF', 'wp-ultimo'), $value);
|
||||
|
||||
} // end column_setup_fee_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the use limitations.
|
||||
@ -155,16 +145,12 @@ class Discount_Code_List_Table extends Base_List_Table {
|
||||
|
||||
// translators: the placeholder is the number of times this coupon can be used before becoming inactive.
|
||||
$html .= '<small class="wu-block">' . sprintf(__('Allowed uses: %d', 'wp-ultimo'), $item->get_max_uses()) . '</span>';
|
||||
|
||||
} else {
|
||||
|
||||
$html .= '<small class="wu-block">' . __('No Limits', 'wp-ultimo') . '</span>';
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $html;
|
||||
|
||||
} // end column_uses;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the code as a tag.
|
||||
@ -183,14 +169,11 @@ class Discount_Code_List_Table extends Base_List_Table {
|
||||
$valid = $item->is_valid();
|
||||
|
||||
if (is_wp_error($valid)) {
|
||||
|
||||
$html .= sprintf('<small class="wu-block wu-sans" %s>%s</small>', wu_tooltip_text($valid->get_error_message()), __('Inactive', 'wp-ultimo'));
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $html;
|
||||
|
||||
} // end column_coupon_code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of columns for this particular List Table.
|
||||
@ -211,8 +194,7 @@ class Discount_Code_List_Table extends Base_List_Table {
|
||||
);
|
||||
|
||||
return $columns;
|
||||
|
||||
} // end get_columns;
|
||||
}
|
||||
/**
|
||||
* Returns the filters for this page.
|
||||
*
|
||||
@ -224,7 +206,5 @@ class Discount_Code_List_Table extends Base_List_Table {
|
||||
'filters' => array(),
|
||||
'date_filters' => array(),
|
||||
);
|
||||
|
||||
} // end get_filters;
|
||||
|
||||
} // end class Discount_Code_List_Table;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\List_Tables;
|
||||
|
||||
use \WP_Ultimo\Models\Domain;
|
||||
use WP_Ultimo\Models\Domain;
|
||||
use WP_Ultimo\Database\Domains\Domain_Stage;
|
||||
|
||||
// Exit if accessed directly
|
||||
@ -37,17 +37,18 @@ class Domain_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct(array(
|
||||
'singular' => __('Domain', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Domains', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
'add_new' => array(
|
||||
'url' => wu_get_form_url('add_new_domain'),
|
||||
'classes' => 'wubox',
|
||||
),
|
||||
));
|
||||
|
||||
} // end __construct;
|
||||
parent::__construct(
|
||||
array(
|
||||
'singular' => __('Domain', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Domains', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
'add_new' => array(
|
||||
'url' => wu_get_form_url('add_new_domain'),
|
||||
'classes' => 'wubox',
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the extra search field when the search element is present.
|
||||
@ -60,14 +61,11 @@ class Domain_List_Table extends Base_List_Table {
|
||||
$_filter_fields = parent::get_extra_query_fields();
|
||||
|
||||
if (wu_request('blog_id')) {
|
||||
|
||||
$_filter_fields['blog_id'] = wu_request('blog_id');
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $_filter_fields;
|
||||
|
||||
} // end get_extra_query_fields;
|
||||
}
|
||||
/**
|
||||
* Displays the content of the domain column.
|
||||
*
|
||||
@ -92,8 +90,7 @@ class Domain_List_Table extends Base_List_Table {
|
||||
);
|
||||
|
||||
return $html . $this->row_actions($actions);
|
||||
|
||||
} // end column_domain;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the content of the active column.
|
||||
@ -106,8 +103,7 @@ class Domain_List_Table extends Base_List_Table {
|
||||
public function column_active($item) {
|
||||
|
||||
return $item->is_active() ? __('Yes', 'wp-ultimo') : __('No', 'wp-ultimo');
|
||||
|
||||
} // end column_active;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the content of the primary domain column.
|
||||
@ -120,8 +116,7 @@ class Domain_List_Table extends Base_List_Table {
|
||||
public function column_primary_domain($item) {
|
||||
|
||||
return $item->is_primary_domain() ? __('Yes', 'wp-ultimo') : __('No', 'wp-ultimo');
|
||||
|
||||
} // end column_primary_domain;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the content of the secure column.
|
||||
@ -134,8 +129,7 @@ class Domain_List_Table extends Base_List_Table {
|
||||
public function column_secure($item) {
|
||||
|
||||
return $item->is_secure() ? __('Yes', 'wp-ultimo') : __('No', 'wp-ultimo');
|
||||
|
||||
} // end column_secure;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the markup for the stage column.
|
||||
@ -152,8 +146,7 @@ class Domain_List_Table extends Base_List_Table {
|
||||
$class = $item->get_stage_class();
|
||||
|
||||
return "<span class='wu-py-1 wu-px-2 wu-rounded-sm wu-text-xs wu-leading-none wu-font-mono $class'>{$label}</span>";
|
||||
|
||||
} // end column_stage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of columns for this particular List Table.
|
||||
@ -175,8 +168,7 @@ class Domain_List_Table extends Base_List_Table {
|
||||
);
|
||||
|
||||
return $columns;
|
||||
|
||||
} // end get_columns;
|
||||
}
|
||||
/**
|
||||
* Returns the filters for this page.
|
||||
*
|
||||
@ -229,11 +221,7 @@ class Domain_List_Table extends Base_List_Table {
|
||||
),
|
||||
|
||||
),
|
||||
'date_filters' => array(
|
||||
|
||||
),
|
||||
'date_filters' => array(),
|
||||
);
|
||||
|
||||
} // end get_filters;
|
||||
|
||||
} // end class Domain_List_Table;
|
||||
}
|
||||
}
|
||||
|
@ -20,11 +20,11 @@ defined('ABSPATH') || exit;
|
||||
class Email_List_Table extends Base_List_Table {
|
||||
|
||||
/**
|
||||
* Holds the query class for the object being listed.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @var string
|
||||
*/
|
||||
* Holds the query class for the object being listed.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @var string
|
||||
*/
|
||||
protected $query_class = '\\WP_Ultimo\\Database\\Emails\\Email_Query';
|
||||
|
||||
/**
|
||||
@ -34,17 +34,18 @@ class Email_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct(array(
|
||||
'singular' => __('Email', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Emails', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
'add_new' => array(
|
||||
'url' => wu_network_admin_url('wp-ultimo-edit-email'),
|
||||
'classes' => '',
|
||||
),
|
||||
));
|
||||
|
||||
} // end __construct;
|
||||
parent::__construct(
|
||||
array(
|
||||
'singular' => __('Email', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Emails', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
'add_new' => array(
|
||||
'url' => wu_network_admin_url('wp-ultimo-edit-email'),
|
||||
'classes' => '',
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the parent method to add pending sites.
|
||||
@ -67,29 +68,24 @@ class Email_List_Table extends Base_List_Table {
|
||||
$search = wu_request('s');
|
||||
|
||||
if ($search) {
|
||||
|
||||
$query['search'] = $search;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$target = wu_request('target');
|
||||
|
||||
if ($target && $target !== 'all') {
|
||||
|
||||
$query['meta_query'] = array(
|
||||
'type' => array(
|
||||
'key' => 'wu_target',
|
||||
'value' => $target,
|
||||
),
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$query = apply_filters("wu_{$this->id}_get_items", $query, $this);
|
||||
|
||||
return wu_get_emails($query);
|
||||
|
||||
} // end get_items;
|
||||
}
|
||||
/**
|
||||
* Displays the title of the email.
|
||||
*
|
||||
@ -101,7 +97,7 @@ class Email_List_Table extends Base_List_Table {
|
||||
|
||||
$url_atts = array(
|
||||
'id' => $item->get_id(),
|
||||
'model' => 'email'
|
||||
'model' => 'email',
|
||||
);
|
||||
|
||||
$title = sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-edit-email', $url_atts), $item->get_title());
|
||||
@ -115,24 +111,21 @@ class Email_List_Table extends Base_List_Table {
|
||||
$actions = array(
|
||||
'edit' => sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-edit-email', $url_atts), __('Edit', 'wp-ultimo')),
|
||||
'duplicate' => sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-edit-email', $url_atts), __('Duplicate', 'wp-ultimo')),
|
||||
'send-test' => sprintf('<a title="%s" class="wubox" href="%s">%s</a>', __('Send Test Email', 'wp-ultimo'), wu_get_form_url('send_new_test', $url_atts), __('Send Test Email', 'wp-ultimo'))
|
||||
'send-test' => sprintf('<a title="%s" class="wubox" href="%s">%s</a>', __('Send Test Email', 'wp-ultimo'), wu_get_form_url('send_new_test', $url_atts), __('Send Test Email', 'wp-ultimo')),
|
||||
);
|
||||
|
||||
$slug = $item->get_slug();
|
||||
|
||||
$default_system_emails = wu_get_default_system_emails();
|
||||
|
||||
if (isset($default_system_emails[$slug])) {
|
||||
|
||||
if (isset($default_system_emails[ $slug ])) {
|
||||
$actions['reset'] = sprintf('<a title="%s" class="wubox" href="%s">%s</a>', __('Reset', 'wp-ultimo'), wu_get_form_url('reset_confirmation', $url_atts), __('Reset', 'wp-ultimo'));
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$actions['delete'] = sprintf('<a title="%s" class="wubox" href="%s">%s</a>', __('Delete', 'wp-ultimo'), wu_get_form_url('delete_modal', $url_atts), __('Delete', 'wp-ultimo'));
|
||||
|
||||
return $title . $content . $this->row_actions($actions);
|
||||
|
||||
} // end column_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the event of the email.
|
||||
@ -147,8 +140,7 @@ class Email_List_Table extends Base_List_Table {
|
||||
$event = $item->get_event();
|
||||
|
||||
return "<span class='wu-bg-gray-200 wu-text-gray-700 wu-py-1 wu-px-2 wu-rounded-sm wu-text-xs wu-font-mono'>{$event}</span>";
|
||||
|
||||
} // end column_event;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the slug of the email.
|
||||
@ -163,8 +155,7 @@ class Email_List_Table extends Base_List_Table {
|
||||
$slug = $item->get_slug();
|
||||
|
||||
return "<span class='wu-bg-gray-200 wu-text-gray-700 wu-py-1 wu-px-2 wu-rounded-sm wu-text-xs wu-font-mono'>{$slug}</span>";
|
||||
|
||||
} // end column_slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays if the email is schedule for later send or not.
|
||||
@ -177,28 +168,19 @@ class Email_List_Table extends Base_List_Table {
|
||||
public function column_schedule($item) {
|
||||
|
||||
if ($item->has_schedule()) {
|
||||
|
||||
if ($item->get_schedule_type() === 'hours') {
|
||||
|
||||
$time = explode(':', (string) $item->get_send_hours());
|
||||
|
||||
$text = sprintf(__('%1$s hour(s) and %2$s minute(s) after the event.', 'wp-ultimo'), $time[0], $time[1]);
|
||||
|
||||
} elseif ($item->get_schedule_type() === 'days') {
|
||||
|
||||
$text = sprintf(__('%s day(s) after the event.', 'wp-ultimo'), $item->get_send_days());
|
||||
|
||||
} // end if;
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
$text = __('Sent immediately after the event.', 'wp-ultimo');
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $text;
|
||||
|
||||
} // end column_schedule;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of columns for this particular List Table.
|
||||
@ -218,10 +200,9 @@ class Email_List_Table extends Base_List_Table {
|
||||
);
|
||||
|
||||
return $columns;
|
||||
}
|
||||
|
||||
} // end get_columns;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Handles the bulk processing adding duplication.
|
||||
*
|
||||
* @since 2.0.0
|
||||
@ -232,18 +213,15 @@ class Email_List_Table extends Base_List_Table {
|
||||
$bulk_action = $this->current_action();
|
||||
|
||||
if ($bulk_action === 'duplicate') {
|
||||
|
||||
$email_id = wu_request('id');
|
||||
|
||||
$email = wu_get_email($email_id);
|
||||
|
||||
if (!$email) {
|
||||
|
||||
if ( ! $email) {
|
||||
WP_Ultimo()->notices->add(__('Email not found.', 'wp-ultimo'), 'error', 'network-admin');
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$new_email = $email->duplicate();
|
||||
|
||||
@ -260,30 +238,22 @@ class Email_List_Table extends Base_List_Table {
|
||||
$new_email->set_event($email->get_event());
|
||||
|
||||
if ($email->has_schedule()) {
|
||||
|
||||
$new_email->set_schedule($email->has_schedule());
|
||||
|
||||
if ($email->get_schedule_type() === 'hours') {
|
||||
|
||||
$new_email->set_send_hours($email->get_send_hours());
|
||||
|
||||
} elseif ($email->get_schedule_type() === 'days') {
|
||||
|
||||
$new_email->set_send_days($email->get_send_days());
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
}
|
||||
|
||||
if ($email->get_custom_sender()) {
|
||||
|
||||
$new_email->set_custom_sender($email->get_custom_sender());
|
||||
|
||||
$new_email->set_custom_sender_name($email->get_custom_sender_name());
|
||||
|
||||
$new_email->set_custom_sender_email($email->get_custom_sender_email());
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$new_email->set_send_copy_to_admin($email->get_send_copy_to_admin());
|
||||
|
||||
@ -292,25 +262,24 @@ class Email_List_Table extends Base_List_Table {
|
||||
$result = $new_email->save();
|
||||
|
||||
if (is_wp_error($result)) {
|
||||
|
||||
WP_Ultimo()->notices->add($result->get_error_message(), 'error', 'network-admin');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
} // end if;
|
||||
|
||||
$redirect_url = wu_network_admin_url('wp-ultimo-edit-email', array(
|
||||
'id' => $new_email->get_id(),
|
||||
'updated' => 1,
|
||||
));
|
||||
$redirect_url = wu_network_admin_url(
|
||||
'wp-ultimo-edit-email',
|
||||
array(
|
||||
'id' => $new_email->get_id(),
|
||||
'updated' => 1,
|
||||
)
|
||||
);
|
||||
|
||||
wp_redirect($redirect_url);
|
||||
|
||||
exit;
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end process_single_action;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns the filters for this page.
|
||||
*
|
||||
@ -335,8 +304,7 @@ class Email_List_Table extends Base_List_Table {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_filters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the pre-selected filters on the filter bar.
|
||||
@ -366,7 +334,5 @@ class Email_List_Table extends Base_List_Table {
|
||||
'count' => 0,
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_views;
|
||||
|
||||
} // end class Email_List_Table;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\List_Tables;
|
||||
|
||||
use \WP_Ultimo\Models\Event;
|
||||
use WP_Ultimo\Models\Event;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@ -36,13 +36,14 @@ class Event_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct(array(
|
||||
'singular' => __('Event', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Events', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true // does this table support ajax?
|
||||
));
|
||||
|
||||
} // end __construct;
|
||||
parent::__construct(
|
||||
array(
|
||||
'singular' => __('Event', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Events', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the markup for the object_type column.
|
||||
@ -57,8 +58,7 @@ class Event_List_Table extends Base_List_Table {
|
||||
$object_type = $item->get_object_type();
|
||||
|
||||
return "<span class='wu-py-1 wu-px-2 wu-bg-gray-200 wu-rounded-sm wu-leading-none wu-text-gray-700 wu-text-xs wu-font-mono'>{$object_type}</span>";
|
||||
|
||||
} // end column_object_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the markup for the initiator column.
|
||||
@ -79,7 +79,6 @@ class Event_List_Table extends Base_List_Table {
|
||||
$object_label_tooltip = substr($object_severity_label, 0, 1);
|
||||
|
||||
if ($object_initiator === 'system') {
|
||||
|
||||
$avatar = '<span class="dashicons-wu-tools wu-text-gray-700 wu-text-xl"></span>';
|
||||
|
||||
$system_text = ucfirst($object_initiator);
|
||||
@ -98,13 +97,17 @@ class Event_List_Table extends Base_List_Table {
|
||||
</div>
|
||||
</div>";
|
||||
// phpcs:enable
|
||||
|
||||
} elseif ($object_initiator === 'manual') {
|
||||
|
||||
$avatar = get_avatar($item->get_author_id(), 32, 'identicon', '', array(
|
||||
'force_display' => true,
|
||||
'class' => 'wu-rounded-full',
|
||||
));
|
||||
$avatar = get_avatar(
|
||||
$item->get_author_id(),
|
||||
32,
|
||||
'identicon',
|
||||
'',
|
||||
array(
|
||||
'force_display' => true,
|
||||
'class' => 'wu-rounded-full',
|
||||
)
|
||||
);
|
||||
|
||||
$display_name = $item->get_author_display_name();
|
||||
|
||||
@ -133,9 +136,7 @@ class Event_List_Table extends Base_List_Table {
|
||||
<small>{$email}</small>
|
||||
</div>
|
||||
</a>";
|
||||
|
||||
} else {
|
||||
|
||||
$not_found = __('No initiator found', 'wp-ultimo');
|
||||
|
||||
$html = "<div class='wu-table-card wu-text-gray-700 wu-py-1 wu-px-2 wu-flex wu-flex-grow wu-rounded wu-items-center wu-border wu-border-solid wu-border-gray-300 wu-relative wu-overflow-hidden'>
|
||||
@ -144,12 +145,10 @@ class Event_List_Table extends Base_List_Table {
|
||||
<span class='wu-block wu-py-3 wu-text-gray-600 wu-text-2xs wu-font-bold wu-uppercase'>{$not_found}</span>
|
||||
</div>
|
||||
</div>";
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $html;
|
||||
|
||||
} // end column_initiator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the markup for the initiator column.
|
||||
@ -164,8 +163,7 @@ class Event_List_Table extends Base_List_Table {
|
||||
$object_slug = $item->get_slug();
|
||||
|
||||
return "<span class='wu-py-1 wu-px-2 wu-bg-gray-200 wu-rounded-sm wu-text-gray-700 wu-text-xs wu-font-mono'>{$object_slug}</span>";
|
||||
|
||||
} // end column_slug;
|
||||
}
|
||||
/**
|
||||
* Returns the markup for the message column.
|
||||
*
|
||||
@ -179,7 +177,7 @@ class Event_List_Table extends Base_List_Table {
|
||||
|
||||
$url_atts = array(
|
||||
'id' => $item->get_id(),
|
||||
'model' => 'event'
|
||||
'model' => 'event',
|
||||
);
|
||||
|
||||
$actions = array(
|
||||
@ -196,8 +194,7 @@ class Event_List_Table extends Base_List_Table {
|
||||
);
|
||||
|
||||
return $message . $this->row_actions($actions);
|
||||
|
||||
} // end column_message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of columns for this particular List Table.
|
||||
@ -218,8 +215,7 @@ class Event_List_Table extends Base_List_Table {
|
||||
);
|
||||
|
||||
return apply_filters('wu_events_list_table_get_columns', $columns, $this);
|
||||
|
||||
} // end get_columns;
|
||||
}
|
||||
/**
|
||||
* Returns the filters for this page.
|
||||
*
|
||||
@ -247,7 +243,5 @@ class Event_List_Table extends Base_List_Table {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_filters;
|
||||
|
||||
} // end class Event_List_Table;
|
||||
}
|
||||
}
|
||||
|
@ -32,8 +32,7 @@ class Inside_Events_List_Table extends Event_List_Table {
|
||||
);
|
||||
|
||||
return $columns;
|
||||
|
||||
} // end get_columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the inside column responsive.
|
||||
@ -61,39 +60,44 @@ class Inside_Events_List_Table extends Event_List_Table {
|
||||
$object_initiator = $item->get_initiator();
|
||||
|
||||
if ($object_initiator === 'system') {
|
||||
|
||||
$value = sprintf('<span class="dashicons-wu-wp-ultimo wu-align-middle wu-mr-1 wu-text-lg"></span><span class="wu-text-gray-600">%s</span>', __('Automatically processed by WP Multisite WaaS', 'wp-ultimo'));
|
||||
|
||||
} elseif ($object_initiator === 'manual') {
|
||||
|
||||
$avatar = get_avatar($item->get_author_id(), 16, 'identicon', '', array(
|
||||
'force_display' => true,
|
||||
'class' => 'wu-rounded-full wu-mr-1 wu-align-text-bottom',
|
||||
));
|
||||
$avatar = get_avatar(
|
||||
$item->get_author_id(),
|
||||
16,
|
||||
'identicon',
|
||||
'',
|
||||
array(
|
||||
'force_display' => true,
|
||||
'class' => 'wu-rounded-full wu-mr-1 wu-align-text-bottom',
|
||||
)
|
||||
);
|
||||
|
||||
$display_name = $item->get_author_display_name();
|
||||
|
||||
$value = sprintf('<span class="wu-text-gray-600">%s%s</span>', $avatar, $display_name);
|
||||
}
|
||||
|
||||
} // end if;
|
||||
|
||||
echo wu_responsive_table_row(array(
|
||||
'id' => '',
|
||||
'title' => sprintf('<span class="wu-font-normal">%s</span>', wp_trim_words($item->get_message(), 15)),
|
||||
'url' => wu_network_admin_url('wp-ultimo-view-event', array(
|
||||
'id' => $item->get_id(),
|
||||
)),
|
||||
'status' => $value,
|
||||
),
|
||||
$first_row,
|
||||
array(
|
||||
'date_created' => array(
|
||||
'icon' => 'dashicons-wu-calendar1 wu-align-middle wu-mr-1',
|
||||
'label' => '',
|
||||
'value' => sprintf(__('Processed %s', 'wp-ultimo'), wu_human_time_diff($item->get_date_created(), '-1 day')),
|
||||
echo wu_responsive_table_row(
|
||||
array(
|
||||
'id' => '',
|
||||
'title' => sprintf('<span class="wu-font-normal">%s</span>', wp_trim_words($item->get_message(), 15)),
|
||||
'url' => wu_network_admin_url(
|
||||
'wp-ultimo-view-event',
|
||||
array(
|
||||
'id' => $item->get_id(),
|
||||
)
|
||||
),
|
||||
'status' => $value,
|
||||
),
|
||||
));
|
||||
|
||||
} // end column_responsive;
|
||||
|
||||
} // end class Inside_Events_List_Table;
|
||||
$first_row,
|
||||
array(
|
||||
'date_created' => array(
|
||||
'icon' => 'dashicons-wu-calendar1 wu-align-middle wu-mr-1',
|
||||
'label' => '',
|
||||
'value' => sprintf(__('Processed %s', 'wp-ultimo'), wu_human_time_diff($item->get_date_created(), '-1 day')),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -34,13 +34,14 @@ class Line_Item_List_Table extends Payment_List_Table {
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct(array(
|
||||
'singular' => __('Line Item', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Line Items', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true // does this table support ajax?
|
||||
));
|
||||
|
||||
} // end __construct;
|
||||
parent::__construct(
|
||||
array(
|
||||
'singular' => __('Line Item', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Line Items', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the payment object.
|
||||
@ -53,8 +54,7 @@ class Line_Item_List_Table extends Payment_List_Table {
|
||||
$payment_id = wu_request('id');
|
||||
|
||||
return wu_get_payment($payment_id);
|
||||
|
||||
} // end get_payment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the parent get_items to add a total line.
|
||||
@ -73,14 +73,11 @@ class Line_Item_List_Table extends Payment_List_Table {
|
||||
$items = $payment->get_line_items();
|
||||
|
||||
if ($count) {
|
||||
|
||||
return count($items);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $items;
|
||||
|
||||
} // end get_items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the name of the product and description being hired.
|
||||
@ -92,11 +89,9 @@ class Line_Item_List_Table extends Payment_List_Table {
|
||||
*/
|
||||
public function column_service($item) {
|
||||
|
||||
if (!$item) {
|
||||
|
||||
if ( ! $item) {
|
||||
return '--';
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$url_atts = array(
|
||||
'id' => $this->get_payment()->get_id(),
|
||||
@ -113,8 +108,7 @@ class Line_Item_List_Table extends Payment_List_Table {
|
||||
$html .= sprintf('<span class="wu-block wu-text-gray-600 wu-text-xs">%s</span>', $item->get_description());
|
||||
|
||||
return $html . $this->row_actions($actions);
|
||||
|
||||
} // end column_service;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the tax rate for the item.
|
||||
@ -131,8 +125,7 @@ class Line_Item_List_Table extends Payment_List_Table {
|
||||
$quantity = sprintf(__('Quantity: %s', 'wp-ultimo'), $item->get_quantity()); // phpcs:ignore
|
||||
|
||||
return $html . sprintf('<small class="wu-block">%s</small>', $quantity);
|
||||
|
||||
} // end column_unit_price;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the tax rate for the item.
|
||||
@ -149,16 +142,13 @@ class Line_Item_List_Table extends Payment_List_Table {
|
||||
$tax_rate = '';
|
||||
|
||||
if ($item->get_tax_type() === 'percentage' && $item->get_tax_rate()) {
|
||||
|
||||
$tax_rate = $item->get_tax_rate() . '%';
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$tax_label = $item->get_tax_rate() ? ($item->get_tax_label() ? $item->get_tax_label() : __('Tax Applied', 'wp-ultimo')) : __('No Taxes Applied', 'wp-ultimo');
|
||||
|
||||
return $html . sprintf('<small class="wu-block">%s (%s)</small>', $tax_rate, $tax_label);
|
||||
|
||||
} // end column_tax_total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the tax rate for the item.
|
||||
@ -175,16 +165,13 @@ class Line_Item_List_Table extends Payment_List_Table {
|
||||
$tax_rate = '';
|
||||
|
||||
if ($item->get_discount_type() === 'percentage' && $item->get_discount_rate()) {
|
||||
|
||||
$tax_rate = $item->get_discount_rate() . '%';
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$tax_label = $item->get_discount_rate() ? ($item->get_discount_label() ? $item->get_discount_label() : __('Discount', 'wp-ultimo')) : __('No discount', 'wp-ultimo');
|
||||
|
||||
return $html . sprintf('<small class="wu-block">%s (%s)</small>', $tax_rate, $tax_label);
|
||||
|
||||
} // end column_discounts_total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the total column.
|
||||
@ -197,8 +184,7 @@ class Line_Item_List_Table extends Payment_List_Table {
|
||||
public function column_total($item) {
|
||||
|
||||
return wu_format_currency($item->get_total());
|
||||
|
||||
} // end column_total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the subtotal column.
|
||||
@ -211,8 +197,7 @@ class Line_Item_List_Table extends Payment_List_Table {
|
||||
public function column_subtotal($item) {
|
||||
|
||||
return wu_format_currency($item->get_subtotal());
|
||||
|
||||
} // end column_subtotal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of columns for this particular List Table.
|
||||
@ -232,8 +217,7 @@ class Line_Item_List_Table extends Payment_List_Table {
|
||||
);
|
||||
|
||||
return $columns;
|
||||
|
||||
} // end get_columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Leaves no sortable items on the columns.
|
||||
@ -244,7 +228,5 @@ class Line_Item_List_Table extends Payment_List_Table {
|
||||
public function get_sortable_columns() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end get_sortable_columns;
|
||||
|
||||
} // end class Line_Item_List_Table;
|
||||
}
|
||||
}
|
||||
|
@ -32,8 +32,7 @@ class Membership_Line_Item_List_Table extends Product_List_Table {
|
||||
);
|
||||
|
||||
return $columns;
|
||||
|
||||
} // end get_columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the parent get_items to add a total line.
|
||||
@ -52,14 +51,11 @@ class Membership_Line_Item_List_Table extends Product_List_Table {
|
||||
$products = $membership->get_all_products();
|
||||
|
||||
if ($count) {
|
||||
|
||||
return count($products);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $products;
|
||||
|
||||
} // end get_items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the inside column responsive.
|
||||
@ -77,25 +73,26 @@ class Membership_Line_Item_List_Table extends Product_List_Table {
|
||||
|
||||
$item = $item['product'];
|
||||
|
||||
if (!$item) {
|
||||
|
||||
echo wu_responsive_table_row(array(
|
||||
'url' => false,
|
||||
'id' => 'not-found',
|
||||
'title' => __('Product not found', 'wp-ultimo'),
|
||||
'status' => '',
|
||||
'image' => $this->column_featured_image_id(new \WP_Ultimo\Models\Product()),
|
||||
), array(
|
||||
'quantity' => array(
|
||||
'icon' => 'dashicons-wu-package wu-align-middle wu-mr-1',
|
||||
'label' => __('Quantity', 'wp-ultimo'),
|
||||
'value' => sprintf(__('x%d', 'wp-ultimo'), $quantity),
|
||||
if ( ! $item) {
|
||||
echo wu_responsive_table_row(
|
||||
array(
|
||||
'url' => false,
|
||||
'id' => 'not-found',
|
||||
'title' => __('Product not found', 'wp-ultimo'),
|
||||
'status' => '',
|
||||
'image' => $this->column_featured_image_id(new \WP_Ultimo\Models\Product()),
|
||||
),
|
||||
));
|
||||
array(
|
||||
'quantity' => array(
|
||||
'icon' => 'dashicons-wu-package wu-align-middle wu-mr-1',
|
||||
'label' => __('Quantity', 'wp-ultimo'),
|
||||
'value' => sprintf(__('x%d', 'wp-ultimo'), $quantity),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$first_row = array(
|
||||
'quantity' => array(
|
||||
@ -119,46 +116,50 @@ class Membership_Line_Item_List_Table extends Product_List_Table {
|
||||
);
|
||||
|
||||
if ($item->get_type() === 'plan') {
|
||||
|
||||
$first_row['change'] = array(
|
||||
'wrapper_classes' => 'wubox',
|
||||
'icon' => 'dashicons-wu-edit1 wu-align-middle wu-mr-1',
|
||||
'label' => '',
|
||||
'value' => __('Upgrade or Downgrade', 'wp-ultimo'),
|
||||
'url' => wu_get_form_url('change_membership_plan', array(
|
||||
'id' => $membership_id,
|
||||
'product_id' => $item->get_id(),
|
||||
)),
|
||||
'url' => wu_get_form_url(
|
||||
'change_membership_plan',
|
||||
array(
|
||||
'id' => $membership_id,
|
||||
'product_id' => $item->get_id(),
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
} else {
|
||||
|
||||
$first_row['remove'] = array(
|
||||
'wrapper_classes' => 'wu-text-red-500 wubox',
|
||||
'icon' => 'dashicons-wu-trash-2 wu-align-middle wu-mr-1',
|
||||
'label' => '',
|
||||
'value' => __('Remove', 'wp-ultimo'),
|
||||
'url' => wu_get_form_url('remove_membership_product', array(
|
||||
'id' => $membership_id,
|
||||
'product_id' => $item->get_id(),
|
||||
)),
|
||||
'url' => wu_get_form_url(
|
||||
'remove_membership_product',
|
||||
array(
|
||||
'id' => $membership_id,
|
||||
'product_id' => $item->get_id(),
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
} // end if;
|
||||
|
||||
echo wu_responsive_table_row(array(
|
||||
'id' => $item->get_id(),
|
||||
'title' => $item->get_name(),
|
||||
'url' => wu_network_admin_url('wp-ultimo-edit-product', array(
|
||||
'id' => $item->get_id(),
|
||||
)),
|
||||
'image' => $this->column_featured_image_id($item),
|
||||
'status' => $this->column_type($item),
|
||||
),
|
||||
$first_row,
|
||||
$second_row
|
||||
echo wu_responsive_table_row(
|
||||
array(
|
||||
'id' => $item->get_id(),
|
||||
'title' => $item->get_name(),
|
||||
'url' => wu_network_admin_url(
|
||||
'wp-ultimo-edit-product',
|
||||
array(
|
||||
'id' => $item->get_id(),
|
||||
)
|
||||
),
|
||||
'image' => $this->column_featured_image_id($item),
|
||||
'status' => $this->column_type($item),
|
||||
),
|
||||
$first_row,
|
||||
$second_row
|
||||
);
|
||||
|
||||
} // end column_responsive;
|
||||
|
||||
} // end class Membership_Line_Item_List_Table;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace WP_Ultimo\List_Tables;
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use \WP_Ultimo\Helpers\Hash;
|
||||
use WP_Ultimo\Helpers\Hash;
|
||||
|
||||
/**
|
||||
* Membership List Table class.
|
||||
@ -22,11 +22,11 @@ use \WP_Ultimo\Helpers\Hash;
|
||||
class Membership_List_Table_Widget extends Base_List_Table {
|
||||
|
||||
/**
|
||||
* Holds the query class for the object being listed.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @var string
|
||||
*/
|
||||
* Holds the query class for the object being listed.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @var string
|
||||
*/
|
||||
protected $query_class = '\\WP_Ultimo\\Database\\Memberships\\Membership_Query';
|
||||
|
||||
/**
|
||||
@ -36,13 +36,14 @@ class Membership_List_Table_Widget extends Base_List_Table {
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct(array(
|
||||
'singular' => __('Membership', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Memberships', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true // does this table support ajax?
|
||||
));
|
||||
|
||||
} // end __construct;
|
||||
parent::__construct(
|
||||
array(
|
||||
'singular' => __('Membership', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Memberships', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses the query class to return the items to be displayed.
|
||||
@ -71,18 +72,14 @@ class Membership_List_Table_Widget extends Base_List_Table {
|
||||
* Accounts for hashes
|
||||
*/
|
||||
if (isset($query_args['search']) && strlen((string) $query_args['search']) === Hash::LENGTH) {
|
||||
|
||||
$item_id = Hash::decode($query_args['search']);
|
||||
|
||||
if ($item_id) {
|
||||
|
||||
unset($query_args['search']);
|
||||
|
||||
$query_args['id'] = $item_id;
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
}
|
||||
|
||||
$query_args = array_merge($query_args, $this->get_extra_query_fields());
|
||||
|
||||
@ -91,18 +88,13 @@ class Membership_List_Table_Widget extends Base_List_Table {
|
||||
$function_name = 'wu_get_' . $query_class->get_plural_name();
|
||||
|
||||
if (function_exists($function_name)) {
|
||||
|
||||
$query = $function_name($query_args);
|
||||
|
||||
} else {
|
||||
|
||||
$query = $query_class->query($query_args);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $query;
|
||||
|
||||
} // end get_items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the extra search field when the search element is present.
|
||||
@ -119,8 +111,7 @@ class Membership_List_Table_Widget extends Base_List_Table {
|
||||
$_filter_fields['customer_id'] = wu_request('customer_id');
|
||||
|
||||
return $_filter_fields;
|
||||
|
||||
} // end get_extra_query_fields;
|
||||
}
|
||||
/**
|
||||
* Displays the membership reference code.
|
||||
*
|
||||
@ -144,8 +135,7 @@ class Membership_List_Table_Widget extends Base_List_Table {
|
||||
$html = "<span class='wu-font-mono'><strong>{$code}</strong></span>";
|
||||
|
||||
return $html . $this->row_actions($actions);
|
||||
|
||||
} // end column_hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the status of the membership.
|
||||
@ -162,8 +152,7 @@ class Membership_List_Table_Widget extends Base_List_Table {
|
||||
$class = $item->get_status_class();
|
||||
|
||||
return "<span class='wu-bg-gray-200 wu-text-gray-700 wu-py-1 wu-px-2 wu-rounded-sm wu-text-xs wu-font-mono $class'>{$label}</span>";
|
||||
|
||||
} // end column_status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the price of the membership.
|
||||
@ -176,15 +165,12 @@ class Membership_List_Table_Widget extends Base_List_Table {
|
||||
public function column_amount($item) {
|
||||
|
||||
if (empty($item->get_amount())) {
|
||||
|
||||
return __('Free', 'wp-ultimo');
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$amount = wu_format_currency($item->get_amount(), $item->get_currency());
|
||||
|
||||
if ($item->is_recurring()) {
|
||||
|
||||
$duration = $item->get_duration();
|
||||
|
||||
$message = sprintf(
|
||||
@ -194,8 +180,7 @@ class Membership_List_Table_Widget extends Base_List_Table {
|
||||
$item->get_duration_unit()
|
||||
);
|
||||
|
||||
if (!$item->is_forever_recurring()) {
|
||||
|
||||
if ( ! $item->is_forever_recurring()) {
|
||||
$billing_cycles_message = sprintf(
|
||||
// translators: %s is the number of billing cycles.
|
||||
_n('for %s cycle', 'for %s cycles', $item->get_billing_cycles(), 'wp-ultimo'),
|
||||
@ -203,18 +188,13 @@ class Membership_List_Table_Widget extends Base_List_Table {
|
||||
);
|
||||
|
||||
$message .= ' ' . $billing_cycles_message;
|
||||
|
||||
} // end if;
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
$message = __('one time payment', 'wp-ultimo');
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return sprintf('%s<br><small>%s</small>', $amount, $message);
|
||||
|
||||
} // end column_amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the customer of the membership.
|
||||
@ -228,8 +208,7 @@ class Membership_List_Table_Widget extends Base_List_Table {
|
||||
|
||||
$customer = $item->get_customer();
|
||||
|
||||
if (!$customer) {
|
||||
|
||||
if ( ! $customer) {
|
||||
$not_found = __('No customer found', 'wp-ultimo');
|
||||
|
||||
return "<div class='wu-py-1 wu-px-2 wu-flex-grow wu-block wu-rounded wu-items-center wu-border wu-border-solid wu-border-gray-300 wu-bg-gray-100 wu-relative wu-overflow-hidden'>
|
||||
@ -238,17 +217,22 @@ class Membership_List_Table_Widget extends Base_List_Table {
|
||||
<span class='wu-block wu-py-3 wu-text-gray-600 wu-text-2xs wu-font-bold wu-uppercase'>{$not_found}</span>
|
||||
</div>
|
||||
</div>";
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$url_atts = array(
|
||||
'id' => $customer->get_id(),
|
||||
);
|
||||
|
||||
$avatar = get_avatar($customer->get_user_id(), 32, 'identicon', '', array(
|
||||
'force_display' => true,
|
||||
'class' => 'wu-rounded-full wu-mr-2',
|
||||
));
|
||||
$avatar = get_avatar(
|
||||
$customer->get_user_id(),
|
||||
32,
|
||||
'identicon',
|
||||
'',
|
||||
array(
|
||||
'force_display' => true,
|
||||
'class' => 'wu-rounded-full wu-mr-2',
|
||||
)
|
||||
);
|
||||
|
||||
$display_name = $customer->get_display_name();
|
||||
|
||||
@ -266,8 +250,7 @@ class Membership_List_Table_Widget extends Base_List_Table {
|
||||
</a>";
|
||||
|
||||
return $html;
|
||||
|
||||
} // end column_customer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of columns for this particular List Table.
|
||||
@ -285,14 +268,12 @@ class Membership_List_Table_Widget extends Base_List_Table {
|
||||
);
|
||||
|
||||
return $columns;
|
||||
|
||||
} // end get_columns;
|
||||
}
|
||||
/**
|
||||
* Overrides the parent method to include the custom ajax functionality for WP Multisite WaaS.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function _js_vars() {} // end _js_vars;
|
||||
|
||||
} // end class Membership_List_Table_Widget;
|
||||
public function _js_vars() {}
|
||||
}
|
||||
|
@ -34,17 +34,18 @@ class Membership_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct(array(
|
||||
'singular' => __('Membership', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Memberships', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
'add_new' => array(
|
||||
'url' => wu_get_form_url('add_new_membership'),
|
||||
'classes' => 'wubox',
|
||||
),
|
||||
));
|
||||
|
||||
} // end __construct;
|
||||
parent::__construct(
|
||||
array(
|
||||
'singular' => __('Membership', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Memberships', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
'add_new' => array(
|
||||
'url' => wu_get_form_url('add_new_membership'),
|
||||
'classes' => 'wubox',
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the extra search field when the search element is present.
|
||||
@ -61,8 +62,7 @@ class Membership_List_Table extends Base_List_Table {
|
||||
$_filter_fields['customer_id'] = wu_request('customer_id');
|
||||
|
||||
return $_filter_fields;
|
||||
|
||||
} // end get_extra_query_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the membership reference code.
|
||||
@ -97,8 +97,7 @@ class Membership_List_Table extends Base_List_Table {
|
||||
$html = "<span class='wu-font-mono'><strong>{$code}</strong></span>";
|
||||
|
||||
return $html . $this->row_actions($actions);
|
||||
|
||||
} // end column_hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the status of the membership.
|
||||
@ -117,8 +116,7 @@ class Membership_List_Table extends Base_List_Table {
|
||||
$html = "<span class='wu-bg-gray-200 wu-leading-none wu-text-gray-700 wu-py-1 wu-px-2 wu-rounded-sm wu-text-xs wu-font-mono $class'>{$label}</span>";
|
||||
|
||||
return $html;
|
||||
|
||||
} // end column_status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the price of the membership.
|
||||
@ -131,13 +129,10 @@ class Membership_List_Table extends Base_List_Table {
|
||||
public function column_amount($item) {
|
||||
|
||||
if (empty($item->get_amount()) && empty($item->get_initial_amount())) {
|
||||
|
||||
return __('Free', 'wp-ultimo');
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if ($item->is_recurring()) {
|
||||
|
||||
$amount = wu_format_currency($item->get_amount(), $item->get_currency());
|
||||
|
||||
$duration = $item->get_duration();
|
||||
@ -149,8 +144,7 @@ class Membership_List_Table extends Base_List_Table {
|
||||
$item->get_duration_unit()
|
||||
);
|
||||
|
||||
if (!$item->is_forever_recurring()) {
|
||||
|
||||
if ( ! $item->is_forever_recurring()) {
|
||||
$billing_cycles_message = sprintf(
|
||||
// translators: %s is the number of billing cycles.
|
||||
_n('for %s cycle', 'for %s cycles', $item->get_billing_cycles(), 'wp-ultimo'),
|
||||
@ -158,20 +152,15 @@ class Membership_List_Table extends Base_List_Table {
|
||||
);
|
||||
|
||||
$message .= ' ' . $billing_cycles_message;
|
||||
|
||||
} // end if;
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
$amount = wu_format_currency($item->get_initial_amount(), $item->get_currency());
|
||||
|
||||
$message = __('one time payment', 'wp-ultimo');
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return sprintf('%s<br><small>%s</small>', $amount, $message);
|
||||
|
||||
} // end column_amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of columns for this particular List Table.
|
||||
@ -195,8 +184,7 @@ class Membership_List_Table extends Base_List_Table {
|
||||
);
|
||||
|
||||
return $columns;
|
||||
|
||||
} // end get_columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the default displaying of datetime columns.
|
||||
@ -211,16 +199,12 @@ class Membership_List_Table extends Base_List_Table {
|
||||
$date = $item->get_date_expiration();
|
||||
|
||||
if (empty($date) || $date === '0000-00-00 00:00:00') {
|
||||
|
||||
return sprintf('<span>%s</span><br><small>%s</small>', __('Lifetime', 'wp-ultimo'), __('It never expires', 'wp-ultimo'));
|
||||
}
|
||||
|
||||
} // end if;
|
||||
|
||||
if (!wu_validate_date($date)) {
|
||||
|
||||
if ( ! wu_validate_date($date)) {
|
||||
return __('--', 'wp-ultimo');
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$time = strtotime(get_date_from_gmt($date));
|
||||
|
||||
@ -231,8 +215,7 @@ class Membership_List_Table extends Base_List_Table {
|
||||
$text = $formatted_value . sprintf('<br><small>%s</small>', sprintf($placeholder, human_time_diff($time)));
|
||||
|
||||
return sprintf('<span %s>%s</span>', wu_tooltip_text(date_i18n('Y-m-d H:i:s', $time)), $text);
|
||||
|
||||
} // end column_date_expiration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the filters for this page.
|
||||
@ -250,7 +233,7 @@ class Membership_List_Table extends Base_List_Table {
|
||||
* Status
|
||||
*/
|
||||
'status' => array(
|
||||
'label' => __( 'Status', 'wp-ultimo' ),
|
||||
'label' => __('Status', 'wp-ultimo'),
|
||||
'options' => $membership_status::to_array(),
|
||||
),
|
||||
|
||||
@ -282,8 +265,7 @@ class Membership_List_Table extends Base_List_Table {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_filters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the pre-selected filters on the filter bar.
|
||||
@ -337,7 +319,5 @@ class Membership_List_Table extends Base_List_Table {
|
||||
'count' => 0,
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_views;
|
||||
|
||||
} // end class Membership_List_Table;
|
||||
}
|
||||
}
|
||||
|
@ -32,8 +32,7 @@ class Memberships_Site_List_Table extends Customers_Site_List_Table {
|
||||
);
|
||||
|
||||
return $columns;
|
||||
|
||||
} // end get_columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the inside column responsive.
|
||||
@ -47,36 +46,40 @@ class Memberships_Site_List_Table extends Customers_Site_List_Table {
|
||||
|
||||
$redirect = current_user_can('wu_edit_sites') ? 'wp-ultimo-edit-site' : 'wp-ultimo-sites';
|
||||
|
||||
echo wu_responsive_table_row(array(
|
||||
'id' => $item->get_id(),
|
||||
'title' => $item->get_title(),
|
||||
'url' => wu_network_admin_url($redirect, array(
|
||||
'id' => $item->get_id(),
|
||||
)),
|
||||
'image' => $this->column_featured_image_id($item),
|
||||
'status' => $this->column_type($item),
|
||||
), array(
|
||||
'link' => array(
|
||||
'icon' => 'dashicons-wu-link1 wu-align-middle wu-mr-1',
|
||||
'label' => __('Visit Site', 'wp-ultimo'),
|
||||
'value' => __('Homepage', 'wp-ultimo'),
|
||||
'url' => $item->get_active_site_url(),
|
||||
echo wu_responsive_table_row(
|
||||
array(
|
||||
'id' => $item->get_id(),
|
||||
'title' => $item->get_title(),
|
||||
'url' => wu_network_admin_url(
|
||||
$redirect,
|
||||
array(
|
||||
'id' => $item->get_id(),
|
||||
)
|
||||
),
|
||||
'image' => $this->column_featured_image_id($item),
|
||||
'status' => $this->column_type($item),
|
||||
),
|
||||
'dashboard' => array(
|
||||
'icon' => 'dashicons-wu-browser wu-align-middle wu-mr-1',
|
||||
'label' => __('Go to the Dashboard', 'wp-ultimo'),
|
||||
'value' => __('Dashboard', 'wp-ultimo'),
|
||||
'url' => get_admin_url($item->get_id()),
|
||||
array(
|
||||
'link' => array(
|
||||
'icon' => 'dashicons-wu-link1 wu-align-middle wu-mr-1',
|
||||
'label' => __('Visit Site', 'wp-ultimo'),
|
||||
'value' => __('Homepage', 'wp-ultimo'),
|
||||
'url' => $item->get_active_site_url(),
|
||||
),
|
||||
'dashboard' => array(
|
||||
'icon' => 'dashicons-wu-browser wu-align-middle wu-mr-1',
|
||||
'label' => __('Go to the Dashboard', 'wp-ultimo'),
|
||||
'value' => __('Dashboard', 'wp-ultimo'),
|
||||
'url' => get_admin_url($item->get_id()),
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'date_created' => array(
|
||||
'icon' => 'dashicons-wu-calendar1 wu-align-middle wu-mr-1',
|
||||
'label' => '',
|
||||
'value' => $item->get_type() === 'pending' ? __('Not Available', 'wp-ultimo') : sprintf(__('Created %s', 'wp-ultimo'), wu_human_time_diff(strtotime((string) $item->get_date_registered()))),
|
||||
),
|
||||
));
|
||||
|
||||
} // end column_responsive;
|
||||
|
||||
} // end class Memberships_Site_List_Table;
|
||||
array(
|
||||
'date_created' => array(
|
||||
'icon' => 'dashicons-wu-calendar1 wu-align-middle wu-mr-1',
|
||||
'label' => '',
|
||||
'value' => $item->get_type() === 'pending' ? __('Not Available', 'wp-ultimo') : sprintf(__('Created %s', 'wp-ultimo'), wu_human_time_diff(strtotime((string) $item->get_date_registered()))),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -32,8 +32,7 @@ class Payment_Line_Item_List_Table extends Line_Item_List_Table {
|
||||
);
|
||||
|
||||
return $columns;
|
||||
|
||||
} // end get_columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the inside column responsive.
|
||||
@ -83,16 +82,13 @@ class Payment_Line_Item_List_Table extends Line_Item_List_Table {
|
||||
'url' => wu_get_form_url('delete_line_item', $url_atts),
|
||||
);
|
||||
|
||||
/*
|
||||
* Adds discounts
|
||||
*/
|
||||
/*
|
||||
* Adds discounts
|
||||
*/
|
||||
if ($item->get_discount_total()) {
|
||||
|
||||
if ($item->get_discount_type() === 'percentage' && $item->get_discount_rate()) {
|
||||
|
||||
$tax_rate = $item->get_discount_rate() . '%';
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$tax_label = $item->get_discount_rate() ? ($item->get_discount_label() ? $item->get_discount_label() : __('Discount', 'wp-ultimo')) : __('No discount', 'wp-ultimo');
|
||||
|
||||
@ -103,8 +99,7 @@ class Payment_Line_Item_List_Table extends Line_Item_List_Table {
|
||||
'label' => $tooltip,
|
||||
'value' => sprintf(__('Discounts: %s', 'wp-ultimo'), wu_format_currency($item->get_discount_total())),
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$first_row['subtotal'] = array(
|
||||
'icon' => 'dashicons-wu-info1 wu-align-middle wu-mr-1',
|
||||
@ -112,16 +107,13 @@ class Payment_Line_Item_List_Table extends Line_Item_List_Table {
|
||||
'value' => sprintf(__('Subtotal: %s', 'wp-ultimo'), wu_format_currency($item->get_subtotal())),
|
||||
);
|
||||
|
||||
/*
|
||||
* Adds Taxes
|
||||
*/
|
||||
/*
|
||||
* Adds Taxes
|
||||
*/
|
||||
if ($item->get_tax_total()) {
|
||||
|
||||
if ($item->get_tax_type() === 'percentage' && $item->get_tax_rate()) {
|
||||
|
||||
$tax_rate = $item->get_tax_rate() . '%';
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$tax_label = $item->get_tax_rate() ? ($item->get_tax_label() ? $item->get_tax_label() : __('Tax Applied', 'wp-ultimo')) : __('No Taxes Applied', 'wp-ultimo');
|
||||
|
||||
@ -132,8 +124,7 @@ class Payment_Line_Item_List_Table extends Line_Item_List_Table {
|
||||
'label' => $tooltip,
|
||||
'value' => sprintf(__('Taxes: %s', 'wp-ultimo'), wu_format_currency($item->get_tax_total())),
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$first_row['description'] = array(
|
||||
'icon' => 'dashicons-wu-file-text wu-align-middle wu-mr-1',
|
||||
@ -141,17 +132,16 @@ class Payment_Line_Item_List_Table extends Line_Item_List_Table {
|
||||
'value' => $item->get_description(),
|
||||
);
|
||||
|
||||
echo wu_responsive_table_row(array(
|
||||
'id' => '',
|
||||
'title' => $item->get_title(),
|
||||
'url' => '',
|
||||
'image' => '',
|
||||
'status' => sprintf('<span class="wu-text-sm wu-font-medium wu-text-gray-700">%s</span>', wu_format_currency($item->get_total())),
|
||||
),
|
||||
$first_row,
|
||||
$second_row
|
||||
echo wu_responsive_table_row(
|
||||
array(
|
||||
'id' => '',
|
||||
'title' => $item->get_title(),
|
||||
'url' => '',
|
||||
'image' => '',
|
||||
'status' => sprintf('<span class="wu-text-sm wu-font-medium wu-text-gray-700">%s</span>', wu_format_currency($item->get_total())),
|
||||
),
|
||||
$first_row,
|
||||
$second_row
|
||||
);
|
||||
|
||||
} // end column_responsive;
|
||||
|
||||
} // end class Payment_Line_Item_List_Table;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace WP_Ultimo\List_Tables;
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use \WP_Ultimo\Helpers\Hash;
|
||||
use WP_Ultimo\Helpers\Hash;
|
||||
|
||||
/**
|
||||
* Payment List Table class.
|
||||
@ -22,11 +22,11 @@ use \WP_Ultimo\Helpers\Hash;
|
||||
class Payment_List_Table_Widget extends Base_List_Table {
|
||||
|
||||
/**
|
||||
* Holds the query class for the object being listed.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @var string
|
||||
*/
|
||||
* Holds the query class for the object being listed.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @var string
|
||||
*/
|
||||
protected $query_class = '\\WP_Ultimo\\Database\\Payments\\Payment_Query';
|
||||
|
||||
/**
|
||||
@ -36,13 +36,14 @@ class Payment_List_Table_Widget extends Base_List_Table {
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct(array(
|
||||
'singular' => __('Payment', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Payments', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true // does this table support ajax?
|
||||
));
|
||||
|
||||
} // end __construct;
|
||||
parent::__construct(
|
||||
array(
|
||||
'singular' => __('Payment', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Payments', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses the query class to return the items to be displayed.
|
||||
@ -71,18 +72,14 @@ class Payment_List_Table_Widget extends Base_List_Table {
|
||||
* Accounts for hashes
|
||||
*/
|
||||
if (isset($query_args['search']) && strlen((string) $query_args['search']) === Hash::LENGTH) {
|
||||
|
||||
$item_id = Hash::decode($query_args['search']);
|
||||
|
||||
if ($item_id) {
|
||||
|
||||
unset($query_args['search']);
|
||||
|
||||
$query_args['id'] = $item_id;
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
}
|
||||
|
||||
$query_args = array_merge($query_args, $this->get_extra_query_fields());
|
||||
|
||||
@ -91,18 +88,13 @@ class Payment_List_Table_Widget extends Base_List_Table {
|
||||
$function_name = 'wu_get_' . $query_class->get_plural_name();
|
||||
|
||||
if (function_exists($function_name)) {
|
||||
|
||||
$query = $function_name($query_args);
|
||||
|
||||
} else {
|
||||
|
||||
$query = $query_class->query($query_args);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $query;
|
||||
|
||||
} // end get_items;
|
||||
}
|
||||
/**
|
||||
* Displays the payment reference code.
|
||||
*
|
||||
@ -126,8 +118,7 @@ class Payment_List_Table_Widget extends Base_List_Table {
|
||||
$html = "<span class='wu-font-mono'><strong>{$code}</strong></span>";
|
||||
|
||||
return $html . $this->row_actions($actions);
|
||||
|
||||
} // end column_hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the membership photo and special status.
|
||||
@ -144,8 +135,7 @@ class Payment_List_Table_Widget extends Base_List_Table {
|
||||
$class = $item->get_status_class();
|
||||
|
||||
return "<span class='wu-bg-gray-200 wu-text-gray-700 wu-py-1 wu-px-2 wu-rounded-sm wu-text-xs wu-font-mono $class'>{$label}</span>";
|
||||
|
||||
} // end column_status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -160,8 +150,7 @@ class Payment_List_Table_Widget extends Base_List_Table {
|
||||
|
||||
$customer = $item->get_customer();
|
||||
|
||||
if (!$customer) {
|
||||
|
||||
if ( ! $customer) {
|
||||
$not_found = __('No customer found', 'wp-ultimo');
|
||||
|
||||
return "<div class='wu-py-1 wu-px-2 wu-flex wu-flex-grow wu-rounded wu-items-center wu-border wu-border-solid wu-border-gray-300 wu-bg-gray-100 wu-relative wu-overflow-hidden'>
|
||||
@ -170,17 +159,22 @@ class Payment_List_Table_Widget extends Base_List_Table {
|
||||
<span class='wu-block wu-py-3 wu-text-gray-600 wu-text-2xs wu-font-bold wu-uppercase'>{$not_found}</span>
|
||||
</div>
|
||||
</div>";
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$url_atts = array(
|
||||
'id' => $customer->get_id(),
|
||||
);
|
||||
|
||||
$avatar = get_avatar($customer->get_user_id(), 32, 'identicon', '', array(
|
||||
'force_display' => true,
|
||||
'class' => 'wu-rounded-full wu-mr-2',
|
||||
));
|
||||
$avatar = get_avatar(
|
||||
$customer->get_user_id(),
|
||||
32,
|
||||
'identicon',
|
||||
'',
|
||||
array(
|
||||
'force_display' => true,
|
||||
'class' => 'wu-rounded-full wu-mr-2',
|
||||
)
|
||||
);
|
||||
|
||||
$display_name = $customer->get_display_name();
|
||||
|
||||
@ -198,8 +192,7 @@ class Payment_List_Table_Widget extends Base_List_Table {
|
||||
</a>";
|
||||
|
||||
return $html;
|
||||
|
||||
} // end column_customer;
|
||||
}
|
||||
/**
|
||||
* Displays the column for the total amount of the payment.
|
||||
*
|
||||
@ -212,8 +205,7 @@ class Payment_List_Table_Widget extends Base_List_Table {
|
||||
$gateway = wu_slug_to_name($item->get_gateway());
|
||||
|
||||
return wu_format_currency($item->get_total()) . "<small class='wu-block'>{$gateway}</small>";
|
||||
|
||||
} // end column_total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of columns for this particular List Table.
|
||||
@ -231,8 +223,7 @@ class Payment_List_Table_Widget extends Base_List_Table {
|
||||
);
|
||||
|
||||
return $columns;
|
||||
|
||||
} // end get_columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the filters for this page.
|
||||
@ -240,7 +231,7 @@ class Payment_List_Table_Widget extends Base_List_Table {
|
||||
* @since 2.0.0
|
||||
* @return void.
|
||||
*/
|
||||
public function get_filters() {} // end get_filters;
|
||||
public function get_filters() {}
|
||||
|
||||
/**
|
||||
* Overrides the parent method to include the custom ajax functionality for WP Multisite WaaS.
|
||||
@ -248,6 +239,5 @@ class Payment_List_Table_Widget extends Base_List_Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function _js_vars() {} // end _js_vars;
|
||||
|
||||
} // end class Payment_List_Table_Widget;
|
||||
public function _js_vars() {}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\List_Tables;
|
||||
|
||||
use \WP_Ultimo\Database\Payments\Payment_Status;
|
||||
use WP_Ultimo\Database\Payments\Payment_Status;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@ -36,17 +36,18 @@ class Payment_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct(array(
|
||||
'singular' => __('Payment', 'wp-ultimo'),
|
||||
'plural' => __('Payments', 'wp-ultimo'),
|
||||
'ajax' => true,
|
||||
'add_new' => array(
|
||||
'url' => wu_get_form_url('add_new_payment'),
|
||||
'classes' => 'wubox',
|
||||
),
|
||||
));
|
||||
|
||||
} // end __construct;
|
||||
parent::__construct(
|
||||
array(
|
||||
'singular' => __('Payment', 'wp-ultimo'),
|
||||
'plural' => __('Payments', 'wp-ultimo'),
|
||||
'ajax' => true,
|
||||
'add_new' => array(
|
||||
'url' => wu_get_form_url('add_new_payment'),
|
||||
'classes' => 'wubox',
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the extra search field when the search element is present.
|
||||
@ -67,8 +68,7 @@ class Payment_List_Table extends Base_List_Table {
|
||||
$_filter_fields['parent_id__in'] = array('0', 0, '', null);
|
||||
|
||||
return $_filter_fields;
|
||||
|
||||
} // end get_extra_query_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the payment reference code.
|
||||
@ -95,7 +95,7 @@ class Payment_List_Table extends Base_List_Table {
|
||||
'delete_modal',
|
||||
array(
|
||||
'model' => 'payment',
|
||||
'id' => $item->get_id()
|
||||
'id' => $item->get_id(),
|
||||
)
|
||||
),
|
||||
__('Delete', 'wp-ultimo')
|
||||
@ -105,8 +105,7 @@ class Payment_List_Table extends Base_List_Table {
|
||||
$html = "<span class='wu-font-mono'><strong>{$code}</strong></span>";
|
||||
|
||||
return $html . $this->row_actions($actions);
|
||||
|
||||
} // end column_hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the membership photo and special status.
|
||||
@ -123,8 +122,7 @@ class Payment_List_Table extends Base_List_Table {
|
||||
$class = $item->get_status_class();
|
||||
|
||||
return "<span class='wu-bg-gray-200 wu-text-gray-700 wu-py-1 wu-px-2 wu-inline-block wu-leading-none wu-rounded-sm wu-text-xs wu-font-mono $class'>{$label}</span>";
|
||||
|
||||
} // end column_status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of subscriptions owned by this membership.
|
||||
@ -138,11 +136,9 @@ class Payment_List_Table extends Base_List_Table {
|
||||
|
||||
$product = $item->get_product();
|
||||
|
||||
if (!$product) {
|
||||
|
||||
if ( ! $product) {
|
||||
return __('No product found', 'wp-ultimo');
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$url_atts = array(
|
||||
'product_id' => $product->get_id(),
|
||||
@ -155,8 +151,7 @@ class Payment_List_Table extends Base_List_Table {
|
||||
$html = $product->get_name();
|
||||
|
||||
return $html . $this->row_actions($actions);
|
||||
|
||||
} // end column_product;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the column for the total amount of the payment.
|
||||
@ -171,8 +166,7 @@ class Payment_List_Table extends Base_List_Table {
|
||||
$gateway = wu_slug_to_name($item->get_gateway());
|
||||
|
||||
return wu_format_currency($item->get_total()) . "<small class='wu-block'>{$gateway}</small>";
|
||||
|
||||
} // end column_total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of columns for this particular List Table.
|
||||
@ -194,8 +188,7 @@ class Payment_List_Table extends Base_List_Table {
|
||||
);
|
||||
|
||||
return $columns;
|
||||
|
||||
} // end get_columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the filters for this page.
|
||||
@ -211,13 +204,13 @@ class Payment_List_Table extends Base_List_Table {
|
||||
* Status
|
||||
*/
|
||||
'status' => array(
|
||||
'label' => __( 'Status', 'wp-ultimo' ),
|
||||
'label' => __('Status', 'wp-ultimo'),
|
||||
'options' => array(
|
||||
'pending' => __( 'Pending', 'wp-ultimo' ),
|
||||
'completed' => __( 'Completed', 'wp-ultimo' ),
|
||||
'refund' => __( 'Refund', 'wp-ultimo' ),
|
||||
'partial' => __( 'Partial', 'wp-ultimo' ),
|
||||
'failed' => __( 'Failed', 'wp-ultimo' ),
|
||||
'pending' => __('Pending', 'wp-ultimo'),
|
||||
'completed' => __('Completed', 'wp-ultimo'),
|
||||
'refund' => __('Refund', 'wp-ultimo'),
|
||||
'partial' => __('Partial', 'wp-ultimo'),
|
||||
'failed' => __('Failed', 'wp-ultimo'),
|
||||
),
|
||||
),
|
||||
|
||||
@ -225,12 +218,12 @@ class Payment_List_Table extends Base_List_Table {
|
||||
* Gateway
|
||||
*/
|
||||
'gateway' => array(
|
||||
'label' => __( 'Gateway', 'wp-ultimo' ),
|
||||
'label' => __('Gateway', 'wp-ultimo'),
|
||||
'options' => array(
|
||||
'free' => __( 'Free', 'wp-ultimo' ),
|
||||
'manual' => __( 'Manual', 'wp-ultimo' ),
|
||||
'paypal' => __( 'Paypal', 'wp-ultimo' ),
|
||||
'stripe' => __( 'Stripe', 'wp-ultimo' ),
|
||||
'free' => __('Free', 'wp-ultimo'),
|
||||
'manual' => __('Manual', 'wp-ultimo'),
|
||||
'paypal' => __('Paypal', 'wp-ultimo'),
|
||||
'stripe' => __('Stripe', 'wp-ultimo'),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -240,13 +233,12 @@ class Payment_List_Table extends Base_List_Table {
|
||||
* Created At
|
||||
*/
|
||||
'date_created' => array(
|
||||
'label' => __( 'Created At', 'wp-ultimo' ),
|
||||
'label' => __('Created At', 'wp-ultimo'),
|
||||
'options' => $this->get_default_date_filter_options(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_filters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the pre-selected filters on the filter bar.
|
||||
@ -294,7 +286,5 @@ class Payment_List_Table extends Base_List_Table {
|
||||
'count' => 0,
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_views;
|
||||
|
||||
} // end class Payment_List_Table;
|
||||
}
|
||||
}
|
||||
|
@ -34,17 +34,18 @@ class Product_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct(array(
|
||||
'singular' => __('Product', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Products', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
'add_new' => array(
|
||||
'url' => wu_network_admin_url('wp-ultimo-edit-product'),
|
||||
'classes' => '',
|
||||
),
|
||||
));
|
||||
|
||||
} // end __construct;
|
||||
parent::__construct(
|
||||
array(
|
||||
'singular' => __('Product', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Products', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
'add_new' => array(
|
||||
'url' => wu_network_admin_url('wp-ultimo-edit-product'),
|
||||
'classes' => '',
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the content of the product column.
|
||||
@ -58,7 +59,7 @@ class Product_List_Table extends Base_List_Table {
|
||||
|
||||
$url_atts = array(
|
||||
'id' => $item->get_id(),
|
||||
'model' => 'product'
|
||||
'model' => 'product',
|
||||
);
|
||||
|
||||
$title = sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-edit-product', $url_atts), $item->get_name());
|
||||
@ -68,13 +69,22 @@ class Product_List_Table extends Base_List_Table {
|
||||
|
||||
$actions = array(
|
||||
'edit' => sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-edit-product', $url_atts), __('Edit', 'wp-ultimo')),
|
||||
'duplicate' => sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-products', array('action' => 'duplicate', 'id' => $item->get_id())), __('Duplicate', 'wp-ultimo')),
|
||||
'duplicate' => sprintf(
|
||||
'<a href="%s">%s</a>',
|
||||
wu_network_admin_url(
|
||||
'wp-ultimo-products',
|
||||
array(
|
||||
'action' => 'duplicate',
|
||||
'id' => $item->get_id(),
|
||||
)
|
||||
),
|
||||
__('Duplicate', 'wp-ultimo')
|
||||
),
|
||||
'delete' => sprintf('<a title="%s" class="wubox" href="%s">%s</a>', __('Delete', 'wp-ultimo'), wu_get_form_url('delete_modal', $url_atts), __('Delete', 'wp-ultimo')),
|
||||
);
|
||||
|
||||
return $title . $this->row_actions($actions);
|
||||
|
||||
} // end column_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the type of the product.
|
||||
@ -91,8 +101,7 @@ class Product_List_Table extends Base_List_Table {
|
||||
$class = $item->get_type_class();
|
||||
|
||||
return "<span class='wu-bg-gray-200 wu-text-gray-700 wu-leading-none wu-py-1 wu-px-2 wu-rounded-sm wu-text-xs wu-font-mono $class'>{$label}</span>";
|
||||
|
||||
} // end column_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the slug of the product.
|
||||
@ -107,8 +116,7 @@ class Product_List_Table extends Base_List_Table {
|
||||
$slug = $item->get_slug();
|
||||
|
||||
return "<span class='wu-bg-gray-200 wu-text-gray-700 wu-leading-none wu-py-1 wu-px-2 wu-rounded-sm wu-text-xs wu-font-mono'>{$slug}</span>";
|
||||
|
||||
} // end column_slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the price of the product.
|
||||
@ -121,21 +129,16 @@ class Product_List_Table extends Base_List_Table {
|
||||
public function column_amount($item) {
|
||||
|
||||
if ($item->get_pricing_type() === 'contact_us') {
|
||||
|
||||
return __('None', 'wp-ultimo') . sprintf('<br><small>%s</small>', __('Requires contact', 'wp-ultimo'));
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if (empty($item->get_amount())) {
|
||||
|
||||
return __('Free', 'wp-ultimo');
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$amount = wu_format_currency($item->get_amount(), $item->get_currency());
|
||||
|
||||
if ($item->is_recurring()) {
|
||||
|
||||
$duration = $item->get_duration();
|
||||
|
||||
$message = sprintf(
|
||||
@ -145,8 +148,7 @@ class Product_List_Table extends Base_List_Table {
|
||||
$item->get_duration_unit()
|
||||
);
|
||||
|
||||
if (!$item->is_forever_recurring()) {
|
||||
|
||||
if ( ! $item->is_forever_recurring()) {
|
||||
$billing_cycles_message = sprintf(
|
||||
// translators: %s is the number of billing cycles.
|
||||
_n('for %s cycle', 'for %s cycles', $item->get_billing_cycles(), 'wp-ultimo'),
|
||||
@ -154,18 +156,13 @@ class Product_List_Table extends Base_List_Table {
|
||||
);
|
||||
|
||||
$message .= ' ' . $billing_cycles_message;
|
||||
|
||||
} // end if;
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
$message = __('one time payment', 'wp-ultimo');
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return sprintf('%s<br><small>%s</small>', $amount, $message);
|
||||
|
||||
} // end column_amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the setup fee of the product.
|
||||
@ -178,20 +175,15 @@ class Product_List_Table extends Base_List_Table {
|
||||
public function column_setup_fee($item) {
|
||||
|
||||
if ($item->get_pricing_type() === 'contact_us') {
|
||||
|
||||
return __('None', 'wp-ultimo') . sprintf('<br><small>%s</small>', __('Requires contact', 'wp-ultimo'));
|
||||
}
|
||||
|
||||
} // end if;
|
||||
|
||||
if (!$item->has_setup_fee()) {
|
||||
|
||||
if ( ! $item->has_setup_fee()) {
|
||||
return __('No Setup Fee', 'wp-ultimo');
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return wu_format_currency($item->get_setup_fee(), $item->get_currency());
|
||||
|
||||
} // end column_setup_fee;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the bulk processing adding duplication.
|
||||
@ -204,18 +196,15 @@ class Product_List_Table extends Base_List_Table {
|
||||
$bulk_action = $this->current_action();
|
||||
|
||||
if ($bulk_action === 'duplicate') {
|
||||
|
||||
$product = wu_request('id');
|
||||
|
||||
$product = wu_get_product($product);
|
||||
|
||||
if (!$product) {
|
||||
|
||||
if ( ! $product) {
|
||||
WP_Ultimo()->notices->add(__('Product not found.', 'wp-ultimo'), 'error', 'network-admin');
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$new_product = $product->duplicate();
|
||||
|
||||
@ -230,25 +219,24 @@ class Product_List_Table extends Base_List_Table {
|
||||
$result = $new_product->save();
|
||||
|
||||
if (is_wp_error($result)) {
|
||||
|
||||
WP_Ultimo()->notices->add($result->get_error_message(), 'error', 'network-admin');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
} // end if;
|
||||
|
||||
$redirect_url = wu_network_admin_url('wp-ultimo-edit-product', array(
|
||||
'id' => $new_product->get_id(),
|
||||
'updated' => 1,
|
||||
));
|
||||
$redirect_url = wu_network_admin_url(
|
||||
'wp-ultimo-edit-product',
|
||||
array(
|
||||
'id' => $new_product->get_id(),
|
||||
'updated' => 1,
|
||||
)
|
||||
);
|
||||
|
||||
wp_redirect($redirect_url);
|
||||
|
||||
exit;
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end process_single_action;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of columns for this particular List Table.
|
||||
@ -270,8 +258,7 @@ class Product_List_Table extends Base_List_Table {
|
||||
);
|
||||
|
||||
return $columns;
|
||||
|
||||
} // end get_columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the item display for grid mode.
|
||||
@ -283,12 +270,14 @@ class Product_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function single_row_grid($item) {
|
||||
|
||||
wu_get_template('base/products/grid-item', array(
|
||||
'item' => $item,
|
||||
'table' => $this,
|
||||
));
|
||||
|
||||
} // end single_row_grid;
|
||||
wu_get_template(
|
||||
'base/products/grid-item',
|
||||
array(
|
||||
'item' => $item,
|
||||
'table' => $this,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the filters for this page.
|
||||
@ -300,8 +289,7 @@ class Product_List_Table extends Base_List_Table {
|
||||
return array(
|
||||
'filters' => array(),
|
||||
);
|
||||
|
||||
} // end get_filters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the pre-selected filters on the filter bar.
|
||||
@ -337,7 +325,5 @@ class Product_List_Table extends Base_List_Table {
|
||||
'count' => 0,
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_views;
|
||||
|
||||
} // end class Product_List_Table;
|
||||
}
|
||||
}
|
||||
|
@ -20,17 +20,16 @@ defined('ABSPATH') || exit;
|
||||
class Site_Customer_List_Table extends Customer_List_Table {
|
||||
|
||||
/**
|
||||
* Initializes the table.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
* Initializes the table.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->current_mode = 'list';
|
||||
|
||||
} // end __construct;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of columns for this particular List Table.
|
||||
@ -45,8 +44,7 @@ class Site_Customer_List_Table extends Customer_List_Table {
|
||||
);
|
||||
|
||||
return $columns;
|
||||
|
||||
} // end get_columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the inside column responsive.
|
||||
@ -61,42 +59,50 @@ class Site_Customer_List_Table extends Customer_List_Table {
|
||||
$last_login = sprintf(__('Last login %s', 'wp-ultimo'), wu_human_time_diff(strtotime((string) $item->get_last_login())));
|
||||
|
||||
if ($item->is_online()) {
|
||||
|
||||
$last_login = '<span class="wu-inline-block wu-mr-1 wu-rounded-full wu-h-2 wu-w-2 wu-bg-green-500"></span>' . __('Online', 'wp-ultimo');
|
||||
}
|
||||
|
||||
} // end if;
|
||||
|
||||
echo wu_responsive_table_row(array(
|
||||
'id' => $item->get_id(),
|
||||
'title' => $item->get_display_name(),
|
||||
'url' => wu_network_admin_url('wp-ultimo-edit-customer', array(
|
||||
'id' => $item->get_id(),
|
||||
)),
|
||||
'image' => get_avatar($item->get_user_id(), 36, 'identicon', '', array(
|
||||
'force_display' => true,
|
||||
'class' => 'wu-rounded-full',
|
||||
)),
|
||||
'status' => $this->column_status($item),
|
||||
), array(
|
||||
'total' => array(
|
||||
'icon' => 'dashicons-wu-at-sign wu-align-middle wu-mr-1',
|
||||
'label' => __('Email Address', 'wp-ultimo'),
|
||||
'value' => $item->get_email_address(),
|
||||
echo wu_responsive_table_row(
|
||||
array(
|
||||
'id' => $item->get_id(),
|
||||
'title' => $item->get_display_name(),
|
||||
'url' => wu_network_admin_url(
|
||||
'wp-ultimo-edit-customer',
|
||||
array(
|
||||
'id' => $item->get_id(),
|
||||
)
|
||||
),
|
||||
'image' => get_avatar(
|
||||
$item->get_user_id(),
|
||||
36,
|
||||
'identicon',
|
||||
'',
|
||||
array(
|
||||
'force_display' => true,
|
||||
'class' => 'wu-rounded-full',
|
||||
)
|
||||
),
|
||||
'status' => $this->column_status($item),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'date_expiration' => array(
|
||||
'icon' => $item->is_online() === false ? 'dashicons-wu-calendar1 wu-align-middle wu-mr-1' : '',
|
||||
'label' => __('Last Login', 'wp-ultimo'),
|
||||
'value' => $last_login,
|
||||
array(
|
||||
'total' => array(
|
||||
'icon' => 'dashicons-wu-at-sign wu-align-middle wu-mr-1',
|
||||
'label' => __('Email Address', 'wp-ultimo'),
|
||||
'value' => $item->get_email_address(),
|
||||
),
|
||||
),
|
||||
'date_created' => array(
|
||||
'icon' => 'dashicons-wu-calendar1 wu-align-middle wu-mr-1',
|
||||
'label' => '',
|
||||
'value' => sprintf(__('Registered %s', 'wp-ultimo'), wu_human_time_diff(strtotime((string) $item->get_date_registered()))),
|
||||
),
|
||||
));
|
||||
|
||||
} // end column_responsive;
|
||||
|
||||
} // end class Site_Customer_List_Table;
|
||||
array(
|
||||
'date_expiration' => array(
|
||||
'icon' => $item->is_online() === false ? 'dashicons-wu-calendar1 wu-align-middle wu-mr-1' : '',
|
||||
'label' => __('Last Login', 'wp-ultimo'),
|
||||
'value' => $last_login,
|
||||
),
|
||||
'date_created' => array(
|
||||
'icon' => 'dashicons-wu-calendar1 wu-align-middle wu-mr-1',
|
||||
'label' => '',
|
||||
'value' => sprintf(__('Registered %s', 'wp-ultimo'), wu_human_time_diff(strtotime((string) $item->get_date_registered()))),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -20,11 +20,11 @@ defined('ABSPATH') || exit;
|
||||
class Site_List_Table extends Base_List_Table {
|
||||
|
||||
/**
|
||||
* Holds the query class for the object being listed.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @var string
|
||||
*/
|
||||
* Holds the query class for the object being listed.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @var string
|
||||
*/
|
||||
protected $query_class = '\\WP_Ultimo\\Database\\Sites\\Site_Query';
|
||||
|
||||
/**
|
||||
@ -39,17 +39,18 @@ class Site_List_Table extends Base_List_Table {
|
||||
'list' => __('List View'),
|
||||
);
|
||||
|
||||
parent::__construct(array(
|
||||
'singular' => __('Site', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Sites', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
'add_new' => array(
|
||||
'url' => wu_get_form_url('add_new_site'),
|
||||
'classes' => 'wubox',
|
||||
),
|
||||
));
|
||||
|
||||
} // end __construct;
|
||||
parent::__construct(
|
||||
array(
|
||||
'singular' => __('Site', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Sites', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
'add_new' => array(
|
||||
'url' => wu_get_form_url('add_new_site'),
|
||||
'classes' => 'wubox',
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the parent method to add pending sites.
|
||||
@ -66,12 +67,10 @@ class Site_List_Table extends Base_List_Table {
|
||||
$type = wu_request('type');
|
||||
|
||||
if ($type === 'pending') {
|
||||
|
||||
$pending_sites = \WP_Ultimo\Models\Site::get_all_by_type('pending');
|
||||
|
||||
return $count ? count($pending_sites) : $pending_sites;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$query = array(
|
||||
'number' => $per_page,
|
||||
@ -81,21 +80,18 @@ class Site_List_Table extends Base_List_Table {
|
||||
);
|
||||
|
||||
if ($type && $type !== 'all') {
|
||||
|
||||
$query['meta_query'] = array(
|
||||
'type' => array(
|
||||
'key' => 'wu_type',
|
||||
'value' => $type,
|
||||
),
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$query = apply_filters("wu_{$this->id}_get_items", $query, $this);
|
||||
|
||||
return wu_get_sites($query);
|
||||
|
||||
} // end get_items;
|
||||
}
|
||||
/**
|
||||
* Render the bulk edit checkbox.
|
||||
*
|
||||
@ -104,14 +100,11 @@ class Site_List_Table extends Base_List_Table {
|
||||
public function column_cb($item): string {
|
||||
|
||||
if ($item->get_type() === 'pending') {
|
||||
|
||||
return sprintf('<input type="checkbox" name="bulk-delete[]" value="%s" />', $item->get_membership_id());
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return sprintf('<input type="checkbox" name="bulk-delete[]" value="%s" />', $item->get_id());
|
||||
|
||||
} // end column_cb;
|
||||
}
|
||||
/**
|
||||
* Displays the content of the name column.
|
||||
*
|
||||
@ -123,7 +116,7 @@ class Site_List_Table extends Base_List_Table {
|
||||
|
||||
$url_atts = array(
|
||||
'id' => $item->get_id(),
|
||||
'model' => 'site'
|
||||
'model' => 'site',
|
||||
);
|
||||
|
||||
$title = $item->get_title();
|
||||
@ -156,13 +149,13 @@ class Site_List_Table extends Base_List_Table {
|
||||
);
|
||||
|
||||
if ($item->get_type() === 'pending') {
|
||||
|
||||
$actions = array(
|
||||
'duplicate' => sprintf(
|
||||
'<a title="%s" class="wubox" href="%s">%s</a>',
|
||||
__('Publish Site', 'wp-ultimo'),
|
||||
wu_get_form_url(
|
||||
'publish_pending_site', array('membership_id' => $item->get_membership_id())
|
||||
'publish_pending_site',
|
||||
array('membership_id' => $item->get_membership_id())
|
||||
),
|
||||
__('Publish', 'wp-ultimo')
|
||||
),
|
||||
@ -174,21 +167,24 @@ class Site_List_Table extends Base_List_Table {
|
||||
array(
|
||||
'id' => $item->get_membership_id(),
|
||||
'model' => 'membership_meta_pending_site',
|
||||
'redirect_to' => urlencode((string) wu_network_admin_url('wp-ultimo-sites', array(
|
||||
'type' => 'pending',
|
||||
'page' => wu_request('page', 1),
|
||||
))),
|
||||
'redirect_to' => urlencode(
|
||||
(string) wu_network_admin_url(
|
||||
'wp-ultimo-sites',
|
||||
array(
|
||||
'type' => 'pending',
|
||||
'page' => wu_request('page', 1),
|
||||
)
|
||||
)
|
||||
),
|
||||
)
|
||||
),
|
||||
__('Delete', 'wp-ultimo')
|
||||
),
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $title . sprintf('<span class="wu-block">%s</span>', make_clickable($item->get_active_site_url())) . $this->row_actions($actions);
|
||||
|
||||
} // end column_path;
|
||||
}
|
||||
/**
|
||||
* Returns the date of the customer registration.
|
||||
*
|
||||
@ -201,8 +197,7 @@ class Site_List_Table extends Base_List_Table {
|
||||
$time = strtotime((string) $item->get_last_login(false));
|
||||
|
||||
return $item->get_date_registered() . sprintf('<br><small>%s</small>', human_time_diff($time));
|
||||
|
||||
} // end column_date_registered;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the blog_id.
|
||||
@ -215,8 +210,7 @@ class Site_List_Table extends Base_List_Table {
|
||||
public function column_blog_id($item) {
|
||||
|
||||
return $item->get_type() === \WP_Ultimo\Database\Sites\Site_Type::PENDING ? '--' : $item->get_blog_id();
|
||||
|
||||
} // end column_blog_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the type of the site.
|
||||
@ -233,8 +227,7 @@ class Site_List_Table extends Base_List_Table {
|
||||
$class = $item->get_type_class();
|
||||
|
||||
return "<span class='wu-bg-gray-200 wu-py-1 wu-px-2 wu-leading-none wu-rounded-sm wu-text-xs wu-font-mono $class'>{$label}</span>";
|
||||
|
||||
} // end column_type;
|
||||
}
|
||||
/**
|
||||
* Column for the domains associated with this site.
|
||||
*
|
||||
@ -244,10 +237,12 @@ class Site_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function column_domains($item): string {
|
||||
|
||||
$domain = wu_get_domains(array(
|
||||
'blog_id' => $item->get_id(),
|
||||
'count' => true,
|
||||
));
|
||||
$domain = wu_get_domains(
|
||||
array(
|
||||
'blog_id' => $item->get_id(),
|
||||
'count' => true,
|
||||
)
|
||||
);
|
||||
|
||||
$url_atts = array(
|
||||
'blog_id' => $item->get_id(),
|
||||
@ -258,8 +253,7 @@ class Site_List_Table extends Base_List_Table {
|
||||
);
|
||||
|
||||
return $domain . $this->row_actions($actions);
|
||||
|
||||
} // end column_domains;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of columns for this particular List Table.
|
||||
@ -281,8 +275,7 @@ class Site_List_Table extends Base_List_Table {
|
||||
);
|
||||
|
||||
return $columns;
|
||||
|
||||
} // end get_columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the customer card for grid mode.
|
||||
@ -294,12 +287,14 @@ class Site_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function single_row_grid($item) {
|
||||
|
||||
wu_get_template('base/sites/grid-item', array(
|
||||
'item' => $item,
|
||||
'list_table' => $this,
|
||||
));
|
||||
|
||||
} // end single_row_grid;
|
||||
wu_get_template(
|
||||
'base/sites/grid-item',
|
||||
array(
|
||||
'item' => $item,
|
||||
'list_table' => $this,
|
||||
)
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Returns the filters for this page.
|
||||
*
|
||||
@ -328,8 +323,7 @@ class Site_List_Table extends Base_List_Table {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_filters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the pre-selected filters on the filter bar.
|
||||
@ -365,8 +359,7 @@ class Site_List_Table extends Base_List_Table {
|
||||
'count' => 0,
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_views;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an associative array containing the bulk action
|
||||
@ -379,11 +372,10 @@ class Site_List_Table extends Base_List_Table {
|
||||
'screenshot' => __('Take Screenshot', 'wp-ultimo'),
|
||||
);
|
||||
|
||||
$actions[wu_request('type', 'all') === 'pending' ? 'delete-pending' : 'delete'] = __('Delete', 'wp-ultimo');
|
||||
$actions[ wu_request('type', 'all') === 'pending' ? 'delete-pending' : 'delete' ] = __('Delete', 'wp-ultimo');
|
||||
|
||||
return $actions;
|
||||
|
||||
} // end get_bulk_actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the bulk processing.
|
||||
@ -396,18 +388,15 @@ class Site_List_Table extends Base_List_Table {
|
||||
$action = $this->current_action();
|
||||
|
||||
if ($action === 'duplicate') {
|
||||
|
||||
$site_id = wu_request('id');
|
||||
|
||||
$site = wu_get_site($site_id);
|
||||
|
||||
if (!$site) {
|
||||
|
||||
if ( ! $site) {
|
||||
WP_Ultimo()->notices->add(__('Site not found.', 'wp-ultimo'), 'error', 'network-admin');
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$new_site = $site->duplicate();
|
||||
|
||||
@ -428,24 +417,22 @@ class Site_List_Table extends Base_List_Table {
|
||||
$result = $new_site->save();
|
||||
|
||||
if (is_wp_error($result)) {
|
||||
|
||||
WP_Ultimo()->notices->add($result->get_error_message(), 'error', 'network-admin');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
} // end if;
|
||||
|
||||
$redirect_url = wu_network_admin_url('wp-ultimo-edit-site', array(
|
||||
'id' => $new_site->get_id(),
|
||||
'updated' => 1,
|
||||
));
|
||||
$redirect_url = wu_network_admin_url(
|
||||
'wp-ultimo-edit-site',
|
||||
array(
|
||||
'id' => $new_site->get_id(),
|
||||
'updated' => 1,
|
||||
)
|
||||
);
|
||||
|
||||
wp_redirect($redirect_url);
|
||||
|
||||
exit;
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end process_single_action;
|
||||
|
||||
} // end class Site_List_Table;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,8 +32,7 @@ class Sites_Domain_List_Table extends Domain_List_Table {
|
||||
);
|
||||
|
||||
return $columns;
|
||||
|
||||
} // end get_columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the inside column responsive.
|
||||
@ -45,34 +44,38 @@ class Sites_Domain_List_Table extends Domain_List_Table {
|
||||
*/
|
||||
public function column_responsive($item) {
|
||||
|
||||
echo wu_responsive_table_row(array(
|
||||
'id' => $item->get_id(),
|
||||
'title' => strtolower((string) $item->get_domain()),
|
||||
'url' => wu_network_admin_url('wp-ultimo-edit-domain', array(
|
||||
'id' => $item->get_id(),
|
||||
)),
|
||||
'status' => $this->column_stage($item),
|
||||
), array(
|
||||
'primary' => array(
|
||||
'icon' => $item->is_primary_domain() ? 'dashicons-wu-filter_1 wu-align-text-bottom wu-mr-1' : 'dashicons-wu-plus-square wu-align-text-bottom wu-mr-1',
|
||||
'label' => '',
|
||||
'value' => $item->is_primary_domain() ? __('Primary', 'wp-ultimo') : __('Alias', 'wp-ultimo'),
|
||||
echo wu_responsive_table_row(
|
||||
array(
|
||||
'id' => $item->get_id(),
|
||||
'title' => strtolower((string) $item->get_domain()),
|
||||
'url' => wu_network_admin_url(
|
||||
'wp-ultimo-edit-domain',
|
||||
array(
|
||||
'id' => $item->get_id(),
|
||||
)
|
||||
),
|
||||
'status' => $this->column_stage($item),
|
||||
),
|
||||
'secure' => array(
|
||||
'wrapper_classes' => $item->is_secure() ? 'wu-text-green-500' : '',
|
||||
'icon' => $item->is_secure() ? 'dashicons-wu-lock1 wu-align-text-bottom wu-mr-1' : 'dashicons-wu-lock1 wu-align-text-bottom wu-mr-1',
|
||||
'label' => '',
|
||||
'value' => $item->is_secure() ? __('Secure (HTTPS)', 'wp-ultimo') : __('Not Secure (HTTP)', 'wp-ultimo'),
|
||||
array(
|
||||
'primary' => array(
|
||||
'icon' => $item->is_primary_domain() ? 'dashicons-wu-filter_1 wu-align-text-bottom wu-mr-1' : 'dashicons-wu-plus-square wu-align-text-bottom wu-mr-1',
|
||||
'label' => '',
|
||||
'value' => $item->is_primary_domain() ? __('Primary', 'wp-ultimo') : __('Alias', 'wp-ultimo'),
|
||||
),
|
||||
'secure' => array(
|
||||
'wrapper_classes' => $item->is_secure() ? 'wu-text-green-500' : '',
|
||||
'icon' => $item->is_secure() ? 'dashicons-wu-lock1 wu-align-text-bottom wu-mr-1' : 'dashicons-wu-lock1 wu-align-text-bottom wu-mr-1',
|
||||
'label' => '',
|
||||
'value' => $item->is_secure() ? __('Secure (HTTPS)', 'wp-ultimo') : __('Not Secure (HTTP)', 'wp-ultimo'),
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'date_created' => array(
|
||||
'icon' => 'dashicons-wu-calendar1 wu-align-middle wu-mr-1',
|
||||
'label' => '',
|
||||
'value' => sprintf(__('Created %s', 'wp-ultimo'), wu_human_time_diff(strtotime((string) $item->get_date_created()))),
|
||||
),
|
||||
));
|
||||
|
||||
} // end column_responsive;
|
||||
|
||||
} // end class Sites_Domain_List_Table;
|
||||
array(
|
||||
'date_created' => array(
|
||||
'icon' => 'dashicons-wu-calendar1 wu-align-middle wu-mr-1',
|
||||
'label' => '',
|
||||
'value' => sprintf(__('Created %s', 'wp-ultimo'), wu_human_time_diff(strtotime((string) $item->get_date_created()))),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -34,16 +34,18 @@ class Webhook_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct(array(
|
||||
'singular' => __('Webhook', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Webhooks', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
'add_new' => array(
|
||||
'url' => wu_get_form_url('add_new_webhook_modal'),
|
||||
'classes' => 'wubox',
|
||||
),
|
||||
));
|
||||
} // end __construct;
|
||||
parent::__construct(
|
||||
array(
|
||||
'singular' => __('Webhook', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Webhooks', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
'add_new' => array(
|
||||
'url' => wu_get_form_url('add_new_webhook_modal'),
|
||||
'classes' => 'wubox',
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Displays the content of the name column.
|
||||
*
|
||||
@ -58,8 +60,14 @@ class Webhook_List_Table extends Base_List_Table {
|
||||
'model' => 'webhook',
|
||||
);
|
||||
|
||||
$title = sprintf('<a href="%s"><strong>%s</strong></a>
|
||||
<span data-loading="wu_action_button_loading_%s" id="wu_action_button_loading" class="wu-blinking-animation wu-text-gray-600 wu-my-1 wu-text-2xs wu-uppercase wu-font-semibold hidden" >%s</span>', wu_network_admin_url('wp-ultimo-edit-webhook', $url_atts), $item->get_name(), $item->get_id(), __('Sending Test..', 'wp-ultimo'));
|
||||
$title = sprintf(
|
||||
'<a href="%s"><strong>%s</strong></a>
|
||||
<span data-loading="wu_action_button_loading_%s" id="wu_action_button_loading" class="wu-blinking-animation wu-text-gray-600 wu-my-1 wu-text-2xs wu-uppercase wu-font-semibold hidden" >%s</span>',
|
||||
wu_network_admin_url('wp-ultimo-edit-webhook', $url_atts),
|
||||
$item->get_name(),
|
||||
$item->get_id(),
|
||||
__('Sending Test..', 'wp-ultimo')
|
||||
);
|
||||
|
||||
$actions = array(
|
||||
'edit' => sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-edit-webhook', $url_atts), __('Edit', 'wp-ultimo')),
|
||||
@ -76,8 +84,7 @@ class Webhook_List_Table extends Base_List_Table {
|
||||
);
|
||||
|
||||
return $title . $this->row_actions($actions);
|
||||
|
||||
} // end column_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the content of the webhook url column.
|
||||
@ -92,8 +99,7 @@ class Webhook_List_Table extends Base_List_Table {
|
||||
$trimmed_url = mb_strimwidth((string) $item->get_webhook_url(), 0, 50, '...');
|
||||
|
||||
return "<span class='wu-py-1 wu-px-2 wu-bg-gray-200 wu-rounded-sm wu-text-gray-700 wu-text-xs wu-font-mono'>{$trimmed_url}</span>";
|
||||
|
||||
} // end column_webhook_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the content of the event column.
|
||||
@ -108,8 +114,7 @@ class Webhook_List_Table extends Base_List_Table {
|
||||
$event = $item->get_event();
|
||||
|
||||
return "<span class='wu-py-1 wu-px-2 wu-bg-gray-200 wu-rounded-sm wu-text-gray-700 wu-text-xs wu-font-mono'>{$event}</span>";
|
||||
|
||||
} // end column_event;
|
||||
}
|
||||
/**
|
||||
* Displays the content of the count column.
|
||||
*
|
||||
@ -126,8 +131,7 @@ class Webhook_List_Table extends Base_List_Table {
|
||||
);
|
||||
|
||||
return $count . $this->row_actions($actions);
|
||||
|
||||
} // end column_count;
|
||||
}
|
||||
/**
|
||||
* Displays the content of the integration column.
|
||||
*
|
||||
@ -138,8 +142,7 @@ class Webhook_List_Table extends Base_List_Table {
|
||||
public function column_integration($item): string {
|
||||
|
||||
return ucwords(str_replace(array('_', '-'), ' ', (string) $item->get_integration()));
|
||||
|
||||
} // end column_integration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the content of the active column.
|
||||
@ -152,8 +155,7 @@ class Webhook_List_Table extends Base_List_Table {
|
||||
public function column_active($item) {
|
||||
|
||||
return $item->is_active() ? __('Yes', 'wp-ultimo') : __('No', 'wp-ultimo');
|
||||
|
||||
} // end column_active;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of columns for this particular List Table.
|
||||
@ -175,8 +177,7 @@ class Webhook_List_Table extends Base_List_Table {
|
||||
);
|
||||
|
||||
return $columns;
|
||||
|
||||
} // end get_columns;
|
||||
}
|
||||
/**
|
||||
* Returns the filters for this page.
|
||||
*
|
||||
@ -188,7 +189,5 @@ class Webhook_List_Table extends Base_List_Table {
|
||||
'filters' => array(),
|
||||
'date_filters' => array(),
|
||||
);
|
||||
|
||||
} // end get_filters;
|
||||
|
||||
} // end class Webhook_List_Table;
|
||||
}
|
||||
}
|
||||
|
@ -37,8 +37,7 @@ class Invoice_List_Table extends Parent_Payment_List_Table {
|
||||
);
|
||||
|
||||
return $columns;
|
||||
|
||||
} // end get_columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the bulk actions.
|
||||
@ -51,8 +50,5 @@ class Invoice_List_Table extends Parent_Payment_List_Table {
|
||||
public function bulk_actions($which = '') {
|
||||
|
||||
return array();
|
||||
|
||||
} // end bulk_actions;
|
||||
|
||||
} // end class Invoice_List_Table;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -35,8 +35,7 @@ class Product_List_Table extends Parent_Product_List_Table {
|
||||
);
|
||||
|
||||
$this->current_mode = 'grid';
|
||||
|
||||
} // end __construct;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of columns for this particular List Table.
|
||||
@ -47,8 +46,7 @@ class Product_List_Table extends Parent_Product_List_Table {
|
||||
public function get_columns() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end get_columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the filters.
|
||||
@ -61,8 +59,7 @@ class Product_List_Table extends Parent_Product_List_Table {
|
||||
'filters' => array(),
|
||||
'date_filters' => array(),
|
||||
);
|
||||
|
||||
} // end get_filters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets bulk actions.
|
||||
@ -75,8 +72,7 @@ class Product_List_Table extends Parent_Product_List_Table {
|
||||
public function bulk_actions($which = '') {
|
||||
|
||||
return array();
|
||||
|
||||
} // end bulk_actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the customer card for grid mode.
|
||||
@ -88,11 +84,12 @@ class Product_List_Table extends Parent_Product_List_Table {
|
||||
*/
|
||||
public function single_row_grid($item) {
|
||||
|
||||
wu_get_template('base/products/grid-item', array(
|
||||
'item' => $item,
|
||||
'list_table' => $this,
|
||||
));
|
||||
|
||||
} // end single_row_grid;
|
||||
|
||||
} // end class Product_List_Table;
|
||||
wu_get_template(
|
||||
'base/products/grid-item',
|
||||
array(
|
||||
'item' => $item,
|
||||
'list_table' => $this,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -35,8 +35,7 @@ class Site_List_Table extends Parent_Site_List_Table {
|
||||
);
|
||||
|
||||
$this->current_mode = 'grid';
|
||||
|
||||
} // end __construct;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of columns for this particular List Table.
|
||||
@ -47,8 +46,7 @@ class Site_List_Table extends Parent_Site_List_Table {
|
||||
public function get_columns() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end get_columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears filters.
|
||||
@ -61,8 +59,7 @@ class Site_List_Table extends Parent_Site_List_Table {
|
||||
'filters' => array(),
|
||||
'date_filters' => array(),
|
||||
);
|
||||
|
||||
} // end get_filters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears views.
|
||||
@ -80,8 +77,7 @@ class Site_List_Table extends Parent_Site_List_Table {
|
||||
'count' => 0,
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_views;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the extra fields based on the request.
|
||||
@ -93,13 +89,11 @@ class Site_List_Table extends Parent_Site_List_Table {
|
||||
|
||||
$customer = wu_get_current_customer();
|
||||
|
||||
if (!$customer) {
|
||||
|
||||
if ( ! $customer) {
|
||||
return array(
|
||||
'blog_id__in' => array('null_id'), // pass absurd value to make sure the query returns nothing.
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$fields = parent::get_extra_fields();
|
||||
|
||||
@ -113,7 +107,5 @@ class Site_List_Table extends Parent_Site_List_Table {
|
||||
);
|
||||
|
||||
return $fields;
|
||||
|
||||
} // end get_extra_fields;
|
||||
|
||||
} // end class Site_List_Table;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user