Heres a simple snippet I made to do the job. Just include the snippet in a
page and point your browser to that page. There you'll find a form where you
can insert the id :)
Tarjei

<---- here be snippets ---->
<h1> Approve pages</h1>
<?
/*

NU_approve snippet.

This snippet aproves all the pages on a given tree with the id(id). Include
it in a page and it will display a form.
*/

// page logic:
if ($form_page_approve == 1 )
{
walk_tree($rootid);
} else {
form_page_approve();
}



function walk_tree ($rootid)
{
if ( mgd_walk_page_tree(approve_page, $rootid,15,&$user,true) ) {
echo "Pages approved";
} else {
echo "Something's not working.  :(";
}
}

function approve_page($id,$level,&$user)
{
$pageobject = mgd_get_page($id);
if ($pageobject) {
$pageobject->parameter("approval","status","always");
if ($pageobject->update())
{ echo "Approved"; } else { echo "Page $id not approved"; }
}


function form_page_approve()
{
echo "<p>Insert root page for aproval<br>";
echo "<form action=\"$PHP_SELF\">
<input type=hidden value=1 name=form_page_approve>
<input type=text name=rootid maxlength=5><br>";
echo "<input type=submit value=approve>";
}

?>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to