Revision [1243]
This is an old revision of UserPagesAction made by DarTar on 2004-09-16 09:09:42.
UserPages Action
This is an upgraded version of the MyPages action. It allows not only to display pages owned by current user but also by any other registered user via a user GET variable
Save the following code as actions/userpages.php.
-- DarTar
<?php
// Shows pages owned by $_GET["user"] or, if this is not provided, by the current user.
// Adapted from actions/mypages.php written by Carlo Zottmann
$user = ($_GET["user"])? $_GET["user"] : $this->GetUserName();
if (!$user) {
print("<em>No user specified</em>");
} else {
echo $this->Format("== Pages owned by ".$user." == --- --- ");
$user_pages_count = 0;
if ($pages = $this->LoadAllPages()) {
foreach ($pages as $page) {
if ($user == $page["owner"]) {
$firstChar = strtoupper($page["tag"][0]);
if (!preg_match("/[A-Z,a-z]/", $firstChar)) {
$firstChar = "#";
}
if ($firstChar != $curChar) {
if ($curChar) print("<br />\n");
print("<strong>$firstChar</strong><br />\n");
$curChar = $firstChar;
}
print($this->Link($page["tag"])."<br />\n");
$user_pages_count++;
}
}
if ($user_pages_count == 0) {
print("<em>User doesn't own any pages.</em>");
}
} else {
print("<em>No pages found.</em>");
}
}
?>
// Shows pages owned by $_GET["user"] or, if this is not provided, by the current user.
// Adapted from actions/mypages.php written by Carlo Zottmann
$user = ($_GET["user"])? $_GET["user"] : $this->GetUserName();
if (!$user) {
print("<em>No user specified</em>");
} else {
echo $this->Format("== Pages owned by ".$user." == --- --- ");
$user_pages_count = 0;
if ($pages = $this->LoadAllPages()) {
foreach ($pages as $page) {
if ($user == $page["owner"]) {
$firstChar = strtoupper($page["tag"][0]);
if (!preg_match("/[A-Z,a-z]/", $firstChar)) {
$firstChar = "#";
}
if ($firstChar != $curChar) {
if ($curChar) print("<br />\n");
print("<strong>$firstChar</strong><br />\n");
$curChar = $firstChar;
}
print($this->Link($page["tag"])."<br />\n");
$user_pages_count++;
}
}
if ($user_pages_count == 0) {
print("<em>User doesn't own any pages.</em>");
}
} else {
print("<em>No pages found.</em>");
}
}
?>