| | 6825 | =head2 AuthorEntryCount |
|---|
| | 6826 | |
|---|
| | 6827 | Returns the number of published entries associated with the author |
|---|
| | 6828 | currently in context. |
|---|
| | 6829 | |
|---|
| | 6830 | =for tags authors |
|---|
| | 6831 | |
|---|
| | 6832 | =cut |
|---|
| | 6833 | |
|---|
| | 6834 | sub _hdlr_author_entry_count { |
|---|
| | 6835 | my ($ctx, $args, $cond) = @_; |
|---|
| | 6836 | my $author = $ctx->stash('author'); |
|---|
| | 6837 | unless ($author) { |
|---|
| | 6838 | my $e = $ctx->stash('entry'); |
|---|
| | 6839 | $author = $e->author if $e; |
|---|
| | 6840 | } |
|---|
| | 6841 | return $ctx->_no_author_error() unless $author; |
|---|
| | 6842 | |
|---|
| | 6843 | my (%terms, %args); |
|---|
| | 6844 | my $class = MT->model('entry'); |
|---|
| | 6845 | $ctx->set_blog_load_context($args, \%terms, \%args) |
|---|
| | 6846 | or return $ctx->error($ctx->errstr); |
|---|
| | 6847 | $terms{author_id} = $author->id; |
|---|
| | 6848 | $terms{status} = MT::Entry::RELEASE(); |
|---|
| | 6849 | my $count = $class->count(\%terms, \%args); |
|---|
| | 6850 | return $ctx->count_format($count, $args); |
|---|
| | 6851 | } |
|---|
| | 6852 | |
|---|
| | 6853 | ########################################################################### |
|---|
| | 6854 | |
|---|