Problem/Motivation

The Recipe content type has field_author, which is an entity reference to a user. This is not necessary to show an author on an article - Drupal does that automatically based on the author that actually created the article.

The only reason for having a separate field for author is if you have the use case where some authors do not actually use the system but should still be publicly credited. For example if Gordon Ramsay was the author of a recipe, it is unlikely he would be logging in to a CMS to enter the content himself, but he would still expect to be credited.

However this is somewhat of a niche case, and could be misleading to the target audience of Umami; those that don't know Drupal. It could be inferred that this type of field is required for a node to have an attributed author.

It also unnecessarily complecting the demo for a niche case. There are other places where we demonstrate use of an entity reference field.

Proposed resolution

Remove the field. Use the node author instead.

Remaining tasks

All the things.

User interface changes

TBD.

API changes

None.

Data model changes

Remove field_author from recipe content type.

Comments

Eli-T created an issue. See original summary.

markconroy’s picture

We created this originally to link to an "author" content type, so we could:

  1. Have guest authors who do not have an account
  2. Have more than one author for a post
  3. Create lists of authors
  4. See "more from this author"
  5. Etc

Since it's not being used (and is only referencing the user field anyway, let's remove it. We can add it again later if we have enough content to justify it.

markconroy’s picture

Status: Active » Needs review
StatusFileSize
new7.75 KB

Here's a patch to remove the field_author from the recipe content type.

nickdickinsonwilde’s picture

Status: Needs review » Needs work

All field configuration has been removed and looks good.
However 2 related files still mention/expect it:

Drupal\demo_umami_content\InstallHelper::importRecipes lines 202-206
core/profiles/demo_umami/modules/demo_umami_content/default_content/recipes.csv - every item has an author.

The author in the recipes.csv could probably be left as long as it isn't used/checked in InstallHelper::importRecipes()

jaykandari’s picture

Agree with @NickWilde.

Tested on local. Works fine for me. No issues during install. Recipe page looks okay.

The only change I'd recommend would be to remove Line no. 205 in InstallHelper::importRecipes(). If the whole 202-206 section is removed then.. the recipes would be authored as an anonymous. The Article & basic content imports have their "UID" setup.

eli-t’s picture

We need to keep this in the CSV so that we can set the author to the user when importing content.

nickdickinsonwilde’s picture

Then as Jay said, just removing line 205 from InstallHelper::importRecipes() should be adequate

eli-t’s picture

Raised #2991895: Remove the Umami user from the Umami demo to remove the Umami user as a follow up.

rahulrasgon’s picture

Assigned: Unassigned » rahulrasgon
rahulrasgon’s picture

Assigned: rahulrasgon » Unassigned
Status: Needs work » Needs review
StatusFileSize
new683 bytes

Hello everyone,
Here is the patch to resolve the above mentioned issue.

jaykandari’s picture

Status: Needs review » Needs work

Hi @rahulrasgon,

#10 does the required changes. But it does not Include #3. Coul you please re upload a new patch including changes of both #3 and #10?

Thanks !!

markconroy’s picture

Status: Needs work » Needs review
StatusFileSize
new8.43 KB
new517 bytes

Here's a patch that combines #3 and #10 and also an interdiff.

jaykandari’s picture

Status: Needs review » Reviewed & tested by the community

#12 works perfect !! Thanks @markconroy! Marking it as RTBC.

EDIT: There are some comments which need to be corrected. Like we have a same comment repeated thrice "// Set article author." in InstallHelper.php when setting author for Article, Recipe & Page content types. This doesn't seem to be part of the scope of this ticket, or maybe we create a new ticket?

rahulrasgon’s picture

RTBC + 1.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 12: 2991473-12.patch, failed testing. View results

Vidushi Mehta’s picture

Status: Needs work » Needs review
StatusFileSize
new8.37 KB

Just a reroll of #12 so that it gets pass again without any error I hope..

jaykandari’s picture

hi @Vidushi Mehta,
If you could add an interdiff.txt to see the difference since the last patch.
Thanks :)

Vidushi Mehta’s picture

Hi @JayKandari

There's no difference in #12 and #16 its just a reroll of #12 so that the test gets pass again and someone can review.

Thanks :)

nickdickinsonwilde’s picture

Status: Needs review » Reviewed & tested by the community
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 6381b01 and pushed to 8.7.x. Thanks!

This looks good. I checked out the comment #13 and the additional work. For me

        // Set article author.
        if (!empty($data['author'])) {
          $values['uid'] = $this->getUser($data['author']);
        }

For me the comment is fine. On a lot of Drupal sites the node uid value is the author - in fact in the template you get author_* variables based on the user entity so this looks good.

I've only committed this to 8.7.x as it is not a bug fix and is a task.

  • alexpott committed 6381b01 on 8.7.x
    Issue #2991473 by markconroy, rahulrasgon, Vidushi Mehta, JayKandari,...
alexpott’s picture

Version: 8.7.x-dev » 8.6.x-dev

Discussed with @Gábor Hojtsy who pointed out that this should be backported to 8.6.x because

Umami should always be the best in the current patch release it can be

  • alexpott committed 9846258 on 8.6.x
    Issue #2991473 by markconroy, rahulrasgon, Vidushi Mehta, JayKandari,...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.