Exemplo n.º 1
0
    $my_array_post_id = get_the_ID();
    $sql = "SELECT * FROM `{$table_name}` WHERE `user_id` = '{$user_id}' ";
    $sql .= "AND `post_id` = '{$my_array_post_id}'";
    $progress = $wpdb->get_row($sql);
    $lessons_count = $progress->lessons_count;
    if ($progress->checked_lessons != 0) {
        $checked_lessons = explode(',', $progress->checked_lessons);
        $checked_lessons_count = count($checked_lessons);
    } else {
        $checked_lessons_count = 0;
    }
    //проверка если курс пройден не полностью, то показывать его на странице
    // "Мои массивы", в противном случае, курс будет показан на странице "Моя зачётка"
    if ($lessons_count != $checked_lessons_count) {
        echo "<li><a href='" . get_permalink() . get_first_unchecked_lesson(get_the_ID()) . "' title='" . get_the_title() . "'>" . get_the_title() . "</a> ";
        diductio_add_progress(get_the_ID(), $user_id);
        echo "</li>";
        $curses_count++;
    }
}
if ($curses_count == 0) {
    echo "<li>Нету активных массивов</li>";
}
echo "</ul>";
?>
					<?php 
moya_zachetka();
?>
				</div>
			</header><!-- .page-header -->
		</main><!-- .site-main -->
Exemplo n.º 2
0
     $sql = "SELECT * FROM `{$table_name}` WHERE `user_id` = '{$user_id}' ";
     $sql .= "AND `post_id` = '{$my_array_post_id}'";
     $progress = $wpdb->get_row($sql);
     $lessons_count = $progress->lessons_count;
     if ($progress->checked_lessons != 0) {
         $checked_lessons = explode(',', $progress->checked_lessons);
         $checked_lessons_count = count($checked_lessons);
     } else {
         $checked_lessons_count = 0;
     }
     //проверка если курс пройден не полностью, то показывать его на странице
     // "Мои массивы", в противном случае, курс будет показан на странице "Моя зачётка"
     if ($lessons_count != $checked_lessons_count) {
         echo "<li><a href='" . get_permalink() . get_first_unchecked_lesson(get_the_ID()) . "' title='" . get_the_title() . "'>" . get_the_title() . "</a> ";
         wpfp_remove_favorite_link(get_the_ID());
         diductio_add_progress(get_the_ID());
         echo "</li>";
         $curses_count++;
     }
 }
 if ($curses_count == 0) {
     echo "<li>Мои массивы пусты</li>";
 }
 echo "</ul>";
 echo '<div class="navigation">';
 if (function_exists('wp_pagenavi')) {
     wp_pagenavi();
 } else {
     ?>
         <div class="alignleft"><?php 
     next_posts_link(__('&larr; Previous Entries', 'buddypress'));
Exemplo n.º 3
0
function draw_user_progress($id)
{
    global $current_user, $wpdb;
    $table_name = $wpdb->get_blog_prefix() . 'user_add_info';
    $sql = "SELECT * FROM `{$table_name}` WHERE `user_id` = {$id}";
    $progress = $wpdb->get_results($sql);
    $user_id = $id;
    foreach ($progress as $key => $value) {
        $post_id = $value->post_id;
        $html = diductio_add_progress($post_id, $user_id);
    }
}