Authors
A container tag which iterates over a list of authors (users with a permission).
Default listing includes Authors who have at least one published entry.
<mt:Authors>
<$mt:AuthorDisplayName$>
</mt:Authors>
Attributes
All fields are optional.
any_type
display_name
id
lastn
limit
min_score
max_score
min_rate
max_rate
min_count
max_count
namespace
need_entry
need_association
role
roles
scoring_to
sort_by
sort_order
status
username
include_blogs
exclude_blogs
include_websites
exclude_websites
any_type
Pass a value of “1” for this attribute to select users of any type associated with the blog, including commenters. Default is “0”. Requires the use of need_entry="0"
Display all authors of any type in the installation:
<mt:Authors any_type="1" need_entry="0">
<li><$mt:AuthorDisplayName$> [<$mt:AuthorID$>]</li>
</mt:Authors>
Bug:
any_type
attribute of mt:Authors doesn’t work as expected
display_name
Specifies the display name a particular author to select.
<mt:Authors display_name="Melody Nelson">
<!-- do something -->
</mt:Authors>
id
Specifies a particular author to select by unique id number. This attribute takes precedence over all others.
<mt:Authors id="12">
<!-- do something -->
</mt:Authors>
lastn
Limits the selection of authors to the specified number. Has nothing to do with recent (as in recent dates) as lastn
does for most other loop tags.
Limit the result to 4 newly creatd authors (using sort_by
and sort_order
attributes).
<mt:Authors lastn="4" sort_by="created_on" sort_order="descend">
<!-- do something -->
</mt:Authors>
limit
Alias to lastn
.
min_score
If ‘namespace’ is also specified, filters the authors based on the score within that namespace. This specifies the minimum score to consider the author for inclusion.
max_score
If ‘namespace’ is also specified, filters the authors based on the score within that namespace. This specifies the maximum score to consider the author for inclusion.
min_rate
If ‘namespace’ is also specified, filters the authors based on the rank within that namespace. This specifies the minimum rank to consider the author for inclusion.
max_rate
If ‘namespace’ is also specified, filters the authors based on the rank within that namespace. This specifies the maximum rank to consider the author for inclusion.
min_count
If ‘namespace’ is also specified, filters the authors based on the count within that namespace. This specifies the minimum count to consider the author for inclusion.
max_count
If ‘namespace’ is also specified, filters the authors based on the count within that namespace. This specifies the maximum count to consider the author for inclusion.
namespace
Used in conjunction with the “min_*
” and “max_*
” attributes to select authors based on a particular scoring mechanism.
need_entry
Boolean identifier to determine whether the author(s) must have published an entry to be included or not. Default “1”, author needs to have published an entry.
Select all authors with “Author” role regardless of whether they have any entries associated to them.
<mt:Authors role="Author" need_entry="0">
<$mt:AuthorDisplayName$>
</mt:Authors>
need_association
Boolean identifier to require author(s) to have explicit association to the blog(s) in context. This attribute can be used to exclude system administrators who do not have explicit association to the blog(s). This attribute requires blog context which can be created by include_blogs
, exclude_blogs
and blog_ids
. Default is “0”
role
A the role(s) used to filter returned authors.
Value can be a comma separated list of roles (which will be converted to a list of roles separated with ” OR “):
<mt:Authors role="Author, Contributor">
Or roles can be specified directly with the “OR” operator:
<mt:Authors role="Author OR Contributor">
Select all users with the role “Editor”:
<mt:Authors role="Editor">
Select all users with the role NOT “Editor”:
<mt:Authors role="!(Editor)">
Bug: Role attribute of mt:Authors using NOT syntax lists authors not associated to the current blog
roles
Alias of role
.
scoring_to
If ‘namespace’ is also specified, filters the authors based on the score within that namespace. This attribute specifies which type of object to look up. the object has to be specified in context.
sort_by
Sort by author data. See lastn
for example.
Supported values:
display_name
name
created_on
score
rate
sort_order
Order of returned authors. See lastn
for example.
Supported values:
ascend
(default)descend
status
Supported values:
enabled
(default)disabled
username
Specifies the username a particular author to select. Like the id
attribute, this attribute takes precedence over all others.
<mt:Authors display_name="Melody Nelson">
<!-- do something -->
</mt:Authors>
The username
and id
should never be used together because they are both idetifiers for a particular user.
Examples
List all Authors in a blog with at least 1 entry:
<mt:Authors>
<a href="<$mt:AuthorURL$>"><$mt:AuthorDisplayName$></a>
</mt:Authors>
List all Authors and Commenters for a blog:
<mt:Authors need_entry="0" roles="Author, Commenter">
<a href="<$mt:AuthorURL$>"><mt:AuthorDisplayName$></a>
</mt:Authors>
Recent Entries per Author:
<mt:Authors>
<h1><$mt:AuthorName$></h1>
<mt:SetVarBlock name="author"><$mt:AuthorName$></mt:SetVarBlock>
<ul>
<mt:Entries author="$author" lastn="10">
<li><a href="mt:Permalink"><$mt:EntryTitle$></a></li>
</mt:Entries>
</ul>
</mt:Authors>
Link to the author archive for each author using the ArchiveLink tag:
<mt:Authors>
<a href="<$mt:ArchiveLink type="Author"$>"><$mt:AuthorDisplayName$></a>
</mt:Authors>
Links to all commenter’s profiles:
<mt:Authors role="Commenter">
<a href="<mt:CGIPath><mt:CommunityScript>?__mode=view&blog_id=<mt:BlogID>&id=<mt:AuthorID>"><mt:AuthorDisplayName></a>
</mt:Authors>
Related
- Template Loop Meta Variables offer conditionals for odd, even, first, last, and counter.
- Blog authors who no longer have the ability to publish entries are not listed in mt:Authors
PRO IT Service on March 17, 2010, 10:40 a.m. Reply
A solution until the “any_type” attribute bug is addressed, is to specify the roles attribute with all the roles you’re interested on.
For instance:
<mt:Authors need_entry=”0” roles=”Author, Commenter, Contributor, Editor”>
Happy Blogging,
Mihai Bocsaru
Daily Movable Type Consultant
Web Development - Movable Type Consulting - Six Apart Partner
http://www.pro-it-service.com/
Movable Type Demo
http://www.movabletypedemo.org/
François Nonnenmacher on August 6, 2010, 3:03 a.m. Reply
Be careful that for the role(s) attribute, the values are localized. E.g. role=”Author, Editor” becomes role=”Par auteurs, Éditeur” on a French-localized installation. I wish there was a foolproof and unique way to identify a role without the fear that the syntax will break because of the blog language.