I am looking for the simplest way to create a menu item that lists all articles by a specific author.
Any help is appreciated. Elad.
Joomla Stack Exchange is a question and answer site for Joomla! administrators, users, developers and designers. It only takes a minute to sign up.
Sign up to join this communityThere is another solution that you can use which doesn't require any installs or modifications.
First create a new module of type: "Articles - Category". This type of module allows you to filter results by author:
Choose author(s):
Then, create an article and load the module created above, using:
{loadposition position[, style]}
{loadmodule module[, title[, style]]}
Finally create a new menu item pointing to the specific article.
This is not provided by default from Joomla. You could either use a module, create your own model-view
with a custom menu item
, or use 3rd party content component or CCKs like k2.
You could search in JED for modules that filter by user and use a module
- either embed it inside an article
- or to a module position at the content area of a blog menu item that you will set to display 0 articles.
I could suggest Raxo All-mode pro, which has Author Filters and a lot of display options.
if you want to display articles using the com_content component, then you will have to create your own Model/View and create a menu item.
I think you could easily base your menu item on the Featured MV.
So a basic implementation would be like:
Duplicate in components/com_content/
a. the models/featured.php
file
b. the views/featured/
folder
author.php
and views/author/
respectively.Then open models/author.php
and
a. edit Class Name to:
class ContentModelAuthor
{ //.... class code goes here....
b. Remove any query that filters for the front-page (featured items).
c. Add your WHERE
for the author ID, like:
$query->where('a.created_by ='.$params->get('author', ''));
// You should use the name of this param that you will define in the default.xml later.
In views/author
folder:
a. Edit in view.html.php
the Class Name to:
class ContentViewAuthor extends JViewLegacy { //.... class code goes here....}
Open the views/author/tmpl/default.xml
and
a. edit titles to something like:
b. Add the author field, to select the User you want to filter on:
Create a new menu item, select a user to test it.
These should be the basics, and most likely at this point you will have blog layouts that will be filtered by user.
You can go further at your own.
Report back any issues, as this is a quick solution and not really tested.
Also, so far, the structural organization of the articles will still be the categories and not the user entity.
K2 provides this feature to create authors' article pages.
Articles Anywhere Pro can help with this by using {if}
tags to filter out articles you don't want to show.
See filter by article author ID for more details.
November 2018 Update:
As at Joomla 3.9.0, the "Latest Articles" module now has an option to display articles by a specific author. You can set up a module with a custom module position and then add this to an article using {loadposition custom-module-position}
or similar.