Jump to content

News published/draft


Aureole

Recommended Posts

I want to add something to my news script that I'm making where you can mark it as a draft or mark it as published.

 

So I make a dropdown box saying draft or publish and I add a row to the database for it but how am I meant to change my queries to only show drafts to certain people.

 

I will have an array...

 

$canviewdrafts = array(1, 5, 7);

 

But how am I meant to change my query so that only people whose member id is in that array can see drafts...

 

Currently my query to retrieve news and show it is...like...

 

<?php
$query = "SELECT title, short, full, author, cat, id, date_format(date, '%a %D %b %Y %H:%i') as prettydate FROM news WHERE cat ='v' ORDER BY id DESC LIMIT 5";
$result = @mysql_query($query) or die(mysql_error());
if (mysql_num_rows($result)>0) {
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "<a href=\"http://www.veraci7y.net/news/read.php?id={$row['id']}\" target=\"_blank\" title=\"Read full story...\" class=\"newstitle\">{$row['title']}</a><p class=\"newsinfo\">Posted by <a href=\"http://www.veraci7y.net/forums/index.php?showuser={$row['authorid']}\" class=\"user\" title=\"View Member\'s Profile\">{$row['author']}</a> <span class=\"newsdate\">{$row['prettydate']}</span></p><p class=\"newscontent\">{$row['short']}</p><br />";
// echo "<br /><a class=\"user\" href=\"javascript:openComments('$url')\">Comments</a></p><br />";
}
} else {
echo "$nonewstodisplay"; }
?>

 

I just don't know how to change it so that drafts are only shown to certain people...and published posts are shown to everyone.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.