本文整理汇总了PHP中Unit::change_status方法的典型用法代码示例。如果您正苦于以下问题:PHP Unit::change_status方法的具体用法?PHP Unit::change_status怎么用?PHP Unit::change_status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Unit
的用法示例。
在下文中一共展示了Unit::change_status方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: die
//an error occured
}
/* }else{
die( __( 'You don\'t have right permissions for the requested action', 'cp' ) );
} */
}
}
if (isset($_GET['preview_redirect_url']) && $_GET['preview_redirect_url'] !== '') {
wp_redirect(trailingslashit(get_permalink($unit_id)) . 'page/' . (isset($unit_page_num) ? $unit_page_num : 1));
exit;
}
if (isset($_GET['action']) && $_GET['action'] == 'edit' && isset($_GET['new_status']) && isset($_GET['unit_id']) && is_numeric($_GET['unit_id'])) {
$unit = new Unit($_GET['unit_id']);
$unit_object = $unit->get_unit();
if (CoursePress_Capabilities::can_change_course_unit_status($course_id, $unit_id)) {
$unit->change_status($_GET['new_status']);
}
}
// cp_write_log(' preview redir: ' . $_POST['preview_redirect'] );
$preview_redirect = isset($_REQUEST['preview_redirect']) ? $_REQUEST['preview_redirect'] : 'no';
?>
<div class='wrap mp-wrap nocoursesub unit-details cp-wrap' id='cp-unit-details-holder'>
<div id="undefined-sticky-wrapper" class="sticky-wrapper">
<div class="sticky-slider visible-small visible-extra-small"><i class="fa fa-chevron-circle-right"></i></div>
<ul id="sortable-units" class="mp-tabs" style="">
<?php
// $units = $course->get_units();
// $course_id = isset( $course ) && isset( $course->details ) && ! empty( $course->details->ID ) ? $course->details->ID : 0;
$units = Unit::get_units_from_course($course_id, 'any', false);
$units = !empty($units) ? $units : array();
示例2: Unit
function update_unit()
{
global $user_id;
if (isset($_POST['action']) && $_POST['action'] == 'update_unit') {
if (wp_verify_nonce($_REQUEST['_wpnonce'], 'unit_details_overview_' . $user_id)) {
$unit = new Unit($_POST['unit_id']);
if (current_user_can('manage_options') || current_user_can('coursepress_create_course_unit_cap') || current_user_can('coursepress_update_course_unit_cap') || current_user_can('coursepress_update_my_course_unit_cap') || current_user_can('coursepress_update_all_courses_unit_cap')) {
$new_post_id = $unit->update_unit(isset($_POST['unit_id']) ? $_POST['unit_id'] : 0);
}
if (isset($_POST['unit_state'])) {
if (current_user_can('manage_options') || current_user_can('coursepress_change_course_unit_status_cap') || current_user_can('coursepress_change_my_course_unit_status_cap') || current_user_can('coursepress_change_all_courses_unit_status_cap')) {
$unit = new Unit($new_post_id);
$unit->change_status($_POST['unit_state']);
}
}
}
echo 'RESPONSE!';
}
}