Support » Plugins » Trying to extend x-Dashboard

  • Hi there, this looks like a nice little plugin, and I tried to extend it further myself with something that would show pages and link to them. I got a MySQL error, though. Here’s what I attempted, ripping code from edit-pages.php and pasting it into one the x-Dash plugin for Drafts. The first MySQL statement was causing problems. Any advice?

    <pre>
    <?php
    /* x-Dash-Plugin-Name:Pages */

    global $wpdb, $user_ID;
    if (isset($user_ID) && (” != intval($user_ID))) {
    $posts = $wpdb->get_results(“
    SELECT $wpdb->posts.*, $wpdb->users.user_level FROM $wpdb->posts
    INNER JOIN $wpdb->users ON ($wpdb->posts.post_author = $wpdb->users.ID)
    WHERE $wpdb->posts.post_status = ‘static’
    AND ($wpdb->users.user_level < $user_level OR $wpdb->posts.post_author = $user_ID)
    “);
    } else {
    $posts = $wpdb->get_results(“SELECT * FROM $wpdb->posts WHERE post_status = ‘static'”);
    }

    if ($posts) {

    xdash_show_title(‘Pages:’);
    if ($xdash_cur_section == ‘ticker’)
    echo “Pages: “;

    $i = 0;
    foreach ($posts as $post) {
    if (0 != $i)
    echo ‘, ‘;
    $post->post_title = stripslashes($draft->post_title);
    if ($post->post_title == ”)
    $post->post_title = sprintf(__(‘Post #%s’), $post->ID);
    echo “ID’ title='” . __(‘Edit this Page’) . “‘>$draft->post_title“;
    ++$i;
    }
    ?>
    .
    <?php
    } ?>
    </pre>

  • The topic ‘Trying to extend x-Dashboard’ is closed to new replies.