Textpattern tips, tutorials and code snippets

Display unordered list of your authors

Here is a simple PHP script to display an unordered list of your authors.

In the script, privileges have been set for all authors except for administrator (1) and managing editor (2). Note that you can change the privilege level for your purposes.

The script

$authors = safe_rows('Realname, privs', 'txp_users', 'privs > 2');
if ($authors > 1) {
echo '<h3>Our Authors:</h3>'."\r".'<ul>'."\r";
foreach($authors as $key => $value) {
$name = sanitizeForUrl($authors[$key][Realname]);
echo '<li><a href="'.hu.'authors/'.$name.'" title="About this author...">'.$authors[$key][Realname].'</a></li>';
echo '</ul>'."\r";

Save the form and output in your page

Save the code in a form (type misc), and call it into your page template in the usual way – <txp:output_form form="my_form_name" />.

Use Textile help to style your comments