At the user "Scheduled" tab, if you view another user profile and go to their "Scheduled" page the empty results of scheduler_list display message "There are no scheduled nodes for @username." using current user name instead of the user that correspond to the viewed page. The query that builds the scheduled list is correctly using the appropriate user that is retrieved from argument from user menu. This user should also be used for the message.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

citlacom created an issue. See original summary.

citlacom’s picture

In order to display the correct username we need to use the user from menu arguments not the global user that not neccesarily correspond to the viewed scheduler user items list.

Heres is the patch generated based on 7.x-1.4 version.

jonathan1055’s picture

Assigned: Unassigned » jonathan1055
Status: Active » Needs review

Hi citlacom,
You are right. I don't know how I missed that. Thanks for the patch - setting to 'needs review' so that the automated tests are run, but this functionality is not actually covered by any tests.

In 8.x the view is created differently and we just get a plain 'No scheduled content available' message. That could be confusing - it would be nicer to show the users name. I will take a quick look at the 8.x code to see if it is simple to fix. Either way, this will definitely be committed at 7.x

Jonathan

jonathan1055’s picture

Status: Needs review » Needs work

I have been trying to do this in 8.x and it's been very unproductive so far. In 'No results behavior' the Replacement Tokens from the context filter are:

    {{ arguments.uid }} == Content: Authored by title
    {{ raw_arguments.uid }} == Content: Authored by input

But these only give the user id, not the name. In 'Global Tokens' we only get site: and view fields. There is no php input filter in D8, this has been removed in favour of theming via twig replacement. I can't find out how to load the user entity to get the name, and I can't find out how to create a custom token to make it available directly.

I don't know if this is my lack of knowledge of D8 or whether it really is a regression of functionality that was available in D7. Any ideas?

jonathan1055’s picture

Version: 7.x-1.4 » 8.x-1.x-dev

I find it hard to believe that when using a view on a users profile page, the user's name is not readily available for use in the view, for example in the title or header, not relying on getting the user data via returned rows. But I have not found a way to get it yet. I did see that you can specify a separate view to be used in the 'no results' section, so I created a user view (i.e. based on the user table) which returns the user data, and that works fine. But it does seem like a very loong way round just to get the users name.

I will keep investigating. It must be easier than that.

Or we could just ignore the proper fix for 8.x, and change it to something like 'No scheduled content by this user' and fix 7.x as in the patch in #2, which is a trivial change.

jonathan1055’s picture

Not giving up on the 8.x fix yet, but here is a modified patch for 7.x. The user_load($args[1]) has to be done only when there is a user id in the arguments, otherwise an error is produced. Simple to move that line. I also took the opportunity to document the parameters of the function being changed.

  • jonathan1055 committed 306865a on 7.x-1.x
    Issue #2692435 by jonathan1055, citlacom: Incorrect username at "There...
jonathan1055’s picture

Status: Needs review » Needs work

I still intend to find a way to get the user name in the 8.x view, but this should not delay the 7.x fix. It will be no further loss of functionality if the 8.x version cannot be fixed, as it is currently not showing the user name at all.

Hence committed to 7.x, so that this fix can be in the upcoming 1.5 release. Thanks @citlacom for noticing this and providing the initial patch.

jonathan1055’s picture

Status: Needs work » Needs review
FileSize
1.29 KB

At 8.x if the user name cannot be retrieved then it is better to say 'No scheduled content for user x' rather than 'No scheduled content availbale'. Can still change this in future if anyone finds a way, but better to make progress and move on.

  • jonathan1055 committed 561d033 on 8.x-1.x
    Issue #2692435 by jonathan1055: Empty result text for scheduled content...
jonathan1055’s picture

Assigned: jonathan1055 » Unassigned
Status: Needs review » Fixed

Committed at 8.x
Already fixed for 7.x so setting this issue to 'Fixed'.

jonathan1055’s picture

Issue summary: View changes

Fixed typos in original summary.

Status: Fixed » Closed (fixed)

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