CyberSlug Labs Software Projects

CyberSlug Labs » Software » Loudblog "Author Select" patch for 0.6.1

Allow Loudblog admins to change the author on posts.

To install this feature,
edit loudblog/inc/backend_record2.php as follows:
  • Near the top of the file, replace the section that looks like:

    //write things from post-data into database
    $dosql = "UPDATE ".$GLOBALS['prefix']."lb_postings SET

    title = '" . $temptitle . "',
    message_input = '" . $tempmess . "',
    message_html = '" . $temphtml . "',
    posted = '" . $posted . "',
    comment_on = '" . $comments . "',
    audio_length = '" . $lengthint . "',
    audio_size = '" . $sizeint . "',
    comment_size = '" . $_POST['comment_size'] . "',
    category1_id = '" . $_POST['cat1'] . "',
    category2_id = '" . $_POST['cat2'] . "',
    category3_id = '" . $_POST['cat3'] . "',
    category4_id = '" . $_POST['cat4'] . "',
    audio_type = '" . $_POST['audio_type'] . "',
    status = '" . $_POST['status'] . "'

    WHERE id = '" . $edit_id . "'";

    with:

    Download lbrec2a_after.txt

    ///begin author mod
        $csl_users = array();
        foreach($authordump as $csl_row => $csl_col) {
            $csl_users[$csl_col['id']] = $csl_col;
        }

        if( ($csl_users[$_SESSION['authorid']]['admin']=='1') && isset($_POST['csl_author']) ) {
            $csl_sql = ",\n author_id = '" .
            $_POST['csl_author'] . "'\n";
        } else {
            $csl_sql = "\n";
        }

    //write things from post-data into database
    $dosql = "UPDATE ".$GLOBALS['prefix']."lb_postings SET

    title = '" . $temptitle . "',
    message_input = '" . $tempmess . "',
    message_html = '" . $temphtml . "',
    posted = '" . $posted . "',
    comment_on = '" . $comments . "',
    audio_length = '" . $lengthint . "',
    audio_size = '" . $sizeint . "',
    comment_size = '" . $_POST['comment_size'] . "',
    category1_id = '" . $_POST['cat1'] . "',
    category2_id = '" . $_POST['cat2'] . "',
    category3_id = '" . $_POST['cat3'] . "',
    category4_id = '" . $_POST['cat4'] . "',
    audio_type = '" . $_POST['audio_type'] . "',
    status = '" . $_POST['status'] . "'" .
    $csl_sql . "
    WHERE id = '" . $edit_id . "'";

    ///end author mod

  • Near the bottom of the file, replace the section that looks like:

    <hr />

    </div>

    <div id="postsave">



    <!-- Posted -->

    with:

    Download lbrec2b_after.txt

    <hr />

    <?php
    ///begin author mod

    echo "<div><h3>Author</h3>";

    if($csl_users[$_SESSION['authorid']]['admin']=='1') {

        echo "<select name='csl_author'>";
        foreach($csl_users as $csl_row => $csl_col) {
            echo "<option value=" .$csl_row;
            if($csl_row==$fields['author_id']) {
                echo " selected";
            }
            echo ">". $csl_col['nickname'] ." &nbsp;</option>";
        }
        echo "</select>";

    } else {
        echo "<b>" .getnickname($fields['author_id']) ."</b>";
    }

    echo "</div>\n";

    ///end author mod
    ?>

    </div>

    <div id="postsave">



    <!-- Posted -->

Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License.

 
©2007 CyberSlug Labs