Revision history for UserPagesAction
Revision [19297]
Last edited on 2008-01-28 00:14:45 by JavaWoman [Modified links pointing to docs server]No Differences
Revision [17224]
Edited on 2007-07-07 15:18:59 by JavaWoman [updated Carlo Zottmann link in **code**]Additions:
* @author {@link http://www.wakkawiki.com/CarloZottmann Carlo Zottmann} (original code)
print("<em>Sorry, no valid user is specified</em>");
print("<em>Sorry, no valid user is specified</em>");
Deletions:
print("<em>Sorry, no valid user is specified</em>");
Additions:
case (isset($_GET['user']) && $this->LoadUser($_GET['user'])): # a valid user is specified as an URL parameter
$owner = $_GET['user'];
break;
case (isset($user) && $this->LoadUser($user)): # a valid user parameter is used
$owner = $user;
break;
case ($this->GetUser()):
$owner = $this->GetUserName();
break;
}
if (strlen($owner) == 0) {
print("<em>Sorry, no valid user is specified</em>");
} else {
echo $this->Format("== Pages owned by ".$owner." == --- --- ");
$user_pages_count = 0;
if ($pages = $this->LoadAllPages()) {
foreach ($pages as $page) {
if ($owner == $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>");
}
}
?>
%%
CategoryDevelopmentActions CategoryDevelopmentAdmin
$owner = $_GET['user'];
break;
case (isset($user) && $this->LoadUser($user)): # a valid user parameter is used
$owner = $user;
break;
case ($this->GetUser()):
$owner = $this->GetUserName();
break;
}
if (strlen($owner) == 0) {
print("<em>Sorry, no valid user is specified</em>");
} else {
echo $this->Format("== Pages owned by ".$owner." == --- --- ");
$user_pages_count = 0;
if ($pages = $this->LoadAllPages()) {
foreach ($pages as $page) {
if ($owner == $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>");
}
}
?>
%%
CategoryDevelopmentActions CategoryDevelopmentAdmin
Deletions:
Additions:
case (isset($_GET['user'])
Deletions:
$owner = $_GET['user'];
break;
case (isset($user) && $this->LoadUser($user)): # a valid user parameter is used
$owner = $user;
break;
case ($this->GetUser()):
$owner = $this->GetUserName();
break;
}
if (strlen($owner) == 0) {
print("<em>Sorry, no valid user is specified</em>");
} else {
echo $this->Format("== Pages owned by ".$owner." == --- --- ");
$user_pages_count = 0;
if ($pages = $this->LoadAllPages()) {
foreach ($pages as $page) {
if ($owner == $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>");
}
}
?>
%%
CategoryDevelopmentActions CategoryDevelopmentAdmin
No Differences
Additions:
>><<This action is meant as a module to integrate the MyPages action into the **UserAdmin** tool.
Deletions:
<<This action is meant as a module to integrate the MyPages action into the **UserAdmin** tool.
Additions:
>>**See also:**
AdminModules
>>
AdminModules
>>
Additions:
CategoryDevelopmentActions CategoryDevelopmentAdmin
Deletions:
Additions:
To use it as a standalone action simply add: --- ##""{{userpages user="UserName"}}""## in the page body.<< ::c::
~-Added documentation header;
* - (Optionally) create a config option allowing admins to decide whether users can
* display pages owned by other users;
~-Added documentation header;
* - (Optionally) create a config option allowing admins to decide whether users can
* display pages owned by other users;
Deletions:
~-Added documentation header
Additions:
===== ""UserPages"" Action =====
<<This action is meant as a module to integrate the MyPages action into the **UserAdmin** tool.
To use it as a standalone action simply add ##""{{userpages user="UserName"}}""## in one of your pages.<< ::c::
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 specified either via a ##user## action parameter or via a ##user## GET variable.
Save the code below as ##actions/userpages.php##.
=== The action ===
Current version: 0.4
Changes:
~-Added documentation header
~-Initialized variables;
~-User is checked in the following order: GET parameter, action parameter, current user;
To do:
~-(Optionally) create a config option allowing admins to decide whether users can display pages owned by other users;
----
%%(php)
<?php
/**
* Display an alphabetical list of pages owned by a user.
*
* This action can be used to display a list of pages owned by a specific user. It
* accepts a user value both as an action parameter and as a GET parameter. The
* specified user must be an existing user. If no user parameter is specified
* or the specified user is invalid, an error message is printed. If no user parameter
* is specified or the specified user is invalid, and the current user is logged in,
* the action will display a list of pages owned by the current user.
*
* @package Actions
* @name Userpages
*
* @author {@link http://www.wakkawiki.de/CarloZottmann Carlo Zottmann} (original code)
* @author {@link http://wikka.jsnx.com/DarTar Dario Taraborelli} (modified action)
* @version 0.4
* @since Wikka 1.1.X.X
* @output list of pages owned by the specified user
* @input string $user optional: a valid user name;
* default: current user, if user is logged in;
* the default can be overridden by providing a URL parameter 'user';
* @todo
*/
$owner =''; #initializing variable
switch(true) {
case (isset($_GET['user']) && $this->LoadUser($_GET['user'])): # a valid user is specified as an URL parameter
$owner = $_GET['user'];
break;
case (isset($user) && $this->LoadUser($user)): # a valid user parameter is used
$owner = $user;
break;
case ($this->GetUser()):
$owner = $this->GetUserName();
break;
}
if (strlen($owner) == 0) {
print("<em>Sorry, no valid user is specified</em>");
} else {
echo $this->Format("== Pages owned by ".$owner." == --- --- ");
$user_pages_count = 0;
if ($pages = $this->LoadAllPages()) {
foreach ($pages as $page) {
if ($owner == $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>");
}
}
?>
%%
----
<<This action is meant as a module to integrate the MyPages action into the **UserAdmin** tool.
To use it as a standalone action simply add ##""{{userpages user="UserName"}}""## in one of your pages.<< ::c::
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 specified either via a ##user## action parameter or via a ##user## GET variable.
Save the code below as ##actions/userpages.php##.
=== The action ===
Current version: 0.4
Changes:
~-Added documentation header
~-Initialized variables;
~-User is checked in the following order: GET parameter, action parameter, current user;
To do:
~-(Optionally) create a config option allowing admins to decide whether users can display pages owned by other users;
----
%%(php)
<?php
/**
* Display an alphabetical list of pages owned by a user.
*
* This action can be used to display a list of pages owned by a specific user. It
* accepts a user value both as an action parameter and as a GET parameter. The
* specified user must be an existing user. If no user parameter is specified
* or the specified user is invalid, an error message is printed. If no user parameter
* is specified or the specified user is invalid, and the current user is logged in,
* the action will display a list of pages owned by the current user.
*
* @package Actions
* @name Userpages
*
* @author {@link http://www.wakkawiki.de/CarloZottmann Carlo Zottmann} (original code)
* @author {@link http://wikka.jsnx.com/DarTar Dario Taraborelli} (modified action)
* @version 0.4
* @since Wikka 1.1.X.X
* @output list of pages owned by the specified user
* @input string $user optional: a valid user name;
* default: current user, if user is logged in;
* the default can be overridden by providing a URL parameter 'user';
* @todo
*/
$owner =''; #initializing variable
switch(true) {
case (isset($_GET['user']) && $this->LoadUser($_GET['user'])): # a valid user is specified as an URL parameter
$owner = $_GET['user'];
break;
case (isset($user) && $this->LoadUser($user)): # a valid user parameter is used
$owner = $user;
break;
case ($this->GetUser()):
$owner = $this->GetUserName();
break;
}
if (strlen($owner) == 0) {
print("<em>Sorry, no valid user is specified</em>");
} else {
echo $this->Format("== Pages owned by ".$owner." == --- --- ");
$user_pages_count = 0;
if ($pages = $this->LoadAllPages()) {
foreach ($pages as $page) {
if ($owner == $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>");
}
}
?>
%%
----
Deletions:
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
<<This action is meant as a module to integrate the MyPages action into the **UserAdmin** tool.
To use it as a standalone action simply add ##""{{userpages}}""## in one of your pages.<< ::c::
Save the following code as ##actions/userpages.php##.
-- DarTar
----
<<##actions/userpages.php##<<
%%(php)
<?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>");
}
}
?>
%%
----
Additions:
CategoryUserContributions
Deletions:
Additions:
CategoryDUserContributions
Deletions:
Additions:
%%
CategoryDevelopment
CategoryDevelopment
Deletions:
Additions:
<<This action is meant as a module to integrate the MyPages action into the **UserAdmin** tool.
To use it as a standalone action simply add ##""{{userpages}}""## in one of your pages.<< ::c::
To use it as a standalone action simply add ##""{{userpages}}""## in one of your pages.<< ::c::
Deletions:
Additions:
----
<<##actions/userpages.php##<<
<<##actions/userpages.php##<<