Delete Articles By Author

Managing your articles within Article Dashboard

Delete Articles By Author

Postby GardenSimply » Sun Oct 19, 2008 4:20 am

Heres a script that will let you delete articles by author .. this will delete all the article from the chosen author! These scripts are setup to be in the AD admin folder, so if you want to put them in a different directory you will have to change the path in both pages to the setup.php. There will be a drop down list of all your author's by penname that you can choose from to delete their articles...

Create a php page called penname-articles.php ... copy/paste this code into that page:

Code: Select all
<?php
include("../setup.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Remove Articles By Penname</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body { font: normal 100% verdana, arial, sans-serrif; text-align:center;background:#ccc;}
#bodydiv { margin:5px auto; padding:30px;background:#fff; width:80%;; border: solid 1px #333}
h1 { font: bold 120% verdana, arial, sans-serrif;}
-->
</style>
</head>
<body>

<script language="JavaScript">
function disp_text()
   {
   var w = document.old_author.users.selectedIndex;
   var selected_text = document.old_author.users.options[w].text;
   document.old_author.authorname.value = selected_text;
   }
</script>
</head>
<body>
<?php   
$link = mysql_connect($dbhost, $dbuser, $dbpasswd) or die ("Could not connect to MySQL");
mysql_select_db ($dbname) or die ("Could not select database $dbname");
$names1=mysql_query("SELECT pen_id, pen_name FROM {$table_prefix}penname ORDER BY pen_name") or die(mysql_error);
$aname="";

while ($row = mysql_fetch_array($names1)) {
  $os = $row['pen_name']." ".$row['pen_id'];
  $option_block .= "<OPTION value=$os>$os</OPTION>";
}
?>
<div id="bodydiv">
<h1 style="text-align:center">Remove Articles by author </h1>

<p style="text-align:center;font-weight:bold">Please select the Author's name from the drop down menu. 
<br />All articles by this author will be deleted.</p>
<form name="old_author" action="delete-articles.php" method="post">
<SELECT name="users" value="" onChange="javascript:disp_text()">

<?
echo "$option_block";
?>

<input type="hidden" value='' name="authorname">
<hr>

<p><INPUT type="submit" value="Delete" onclick="go_theredelete();"></p>
</form>
</div>
<?php
mysql_close();
?>

</body>
</html>
<script language="JavaScript">
function go_theredelete()
{
var where_to= confirm("Do you really want to delete all the articles by this author??");
if (where_to == true)
  document.old_author.submit();
else
  alert("Operation Cancelled!");
  return(false);
}
</script>



Now, create another php page called delete-articles.php and copy/paste this code into it:


Code: Select all
<?
include("../setup.php");

$link = mysql_connect($dbhost, $dbuser, $dbpasswd)or die ("Could not connect to MySQL");
mysql_select_db ($dbname)or die ("Could not select database $dbname");

    $fullname=$_POST['authorname'];
    $splitter= explode(" ", $fullname);
    $auth1=$splitter[2];
    $auth2=$splitter[3];
   
    echo $fullname."<br>";
    echo $auth1."<br>";
    echo $auth2;
   
if (is_numeric($auth1)==true) {
  $resulted=mysql_query("SELECT * FROM {$table_prefix}articles WHERE penname_id='$auth1'");
  $num_rows =mysql_num_rows($resulted);
}else{   
    $resulted=mysql_query("SELECT * FROM {$table_prefix}articles WHERE penname_id='$auth2'");
    $num_rows =mysql_num_rows($resulted);
}
if (is_numeric($auth1)==true) {
  mysql_query("DELETE FROM {$table_prefix}articles WHERE penname_id='$auth1'");
}else{ 
   mysql_query("DELETE FROM {$table_prefix}articles WHERE penname_id='$auth2'");
}
mysql_close();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Delete Articles</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body { font: normal 100% verdana, arial, sans-serrif; text-align:center;background:#ccc;}
#bodydiv { margin:5px auto; padding:30px;background:#fff; width:80%;; border: solid 1px #333}
h1 { font: bold 120% verdana, arial, sans-serrif;}
-->
</style>
</head>
<body>
<div id="bodydiv">
<p>There were <?php echo $num_rows ?> articles deleted.</p>

</body>
</html>


You may want to create a link to the penname-articles.php file in your adminnav.tpl file in your admin templates folder to make this file easier to access.
User avatar
GardenSimply
Admin
 
Posts: 208
Joined: Sat Sep 15, 2007 10:31 am
Location: Oklahoma

Re: Delete Articles By Author

Postby vijay » Mon Sep 06, 2010 8:12 am

You need to log in to your account and initiate contact with them whilst logged in. They will not delete or make any account specific changes unless you contact them from within your account for obvious security reasons.
____________________________________________________________________________
buy wow accounts | wow account
vijay
New Member
 
Posts: 8
Joined: Mon Sep 06, 2010 2:52 am


Return to Article Management in AD

Who is online

Users browsing this forum: No registered users and 1 guest

cron