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://web.archive.org/web/20040616194824/http://www.wakkawiki.com/CarloZottmann Carlo Zottmann} (original code)
print("<em>Sorry, no valid user is specified</em>");
Deletions:
* @author {@link http://www.wakkawiki.de/CarloZottmann Carlo Zottmann} (original code)
print("<em>Sorry, no valid user is specified</em>");


Revision [17035]

Edited on 2007-05-31 23:27:49 by DarTar [Reverted]
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
Deletions:
case (isset($_GET['user'])


Revision [16834]

Edited on 2007-05-31 10:54:13 by PssQ5n [Reverted]
Additions:
case (isset($_GET['user'])
Deletions:
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


Revision [9770]

Edited on 2005-07-05 08:13:12 by DarTar [adding link]

No Differences

Revision [9769]

Edited on 2005-07-05 08:13:00 by DarTar [adding link]
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.


Revision [9768]

Edited on 2005-07-05 08:12:43 by DarTar [adding link]
Additions:
>>**See also:**
AdminModules
>>


Revision [8698]

Edited on 2005-05-29 12:27:22 by JavaWoman [new categories]
Additions:
CategoryDevelopmentActions CategoryDevelopmentAdmin
Deletions:
CategoryUserContributions


Revision [7343]

Edited on 2005-04-18 07:18:37 by DarTar [UserPages v.0.4]
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;
Deletions:
To use it as a standalone action simply add ##""{{userpages user="UserName"}}""## in one of your pages.<< ::c::
~-Added documentation header


Revision [7342]

Edited on 2005-04-18 07:15:39 by DarTar [UserPages v.0.4]
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>");
}
}
?>
%%

----
Deletions:
===== ""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

<<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>");
}
}
?>

%%

----


Revision [4738]

Edited on 2005-01-17 14:35:05 by NilsLindenberg [typo in changed cat. corrected]
Additions:
CategoryUserContributions
Deletions:
CategoryDUserContributions


Revision [4737]

Edited on 2005-01-17 14:34:43 by NilsLindenberg [cat. changed]
Additions:
CategoryDUserContributions
Deletions:
CategoryDevelopment


Revision [1981]

Edited on 2004-10-25 18:14:34 by NilsLindenberg [category added]
Additions:
%%
CategoryDevelopment
Deletions:
%%


Revision [1267]

Edited on 2004-09-16 09:40:15 by DarTar [category added]
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::
Deletions:
<<(This action is meant as a module to integrate the MyPages action into the UserAdmin tool).<<


Revision [1252]

Edited on 2004-09-16 09:25:16 by DarTar [category added]
Additions:
----
<<##actions/userpages.php##<<


Revision [1243]

The oldest known version of this page was created on 2004-09-16 09:09:42 by DarTar [category added]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki