I don't know how far you got with this but this razor example should work.
v7:
@{
var homeNode = Model.Content.AncestorOrSelf(1);
// replace the id with the user's ID
var nodesByCreator = homeNode.DescendantsOrSelf().Where(x => x.CreatorId == 0);
foreach(var curNode in nodesByCreator)
{
<h2>@curNode.Name - @curNode.CreatorId - @curNode.CreatorName</h2>
}
}
v8
@{
var homeNode = Model.AncestorOrSelf(1);
<h1>@homeNode.Name @homeNode.CreatorId</h1>
var nodesByCreator = homeNode.DescendantsOrSelf().Where(x => x.CreatorId == -1);
foreach (var curNode in nodesByCreator)
{
<h2>@curNode.Name - @curNode.CreatorId - @curNode.CreatorName</h2>
}
}
Or using the Creator Name works however - though this is obviously isn't ideal, it will probably work for you but it will need an exact string match.
@{
var homeNode = Model.AncestorOrSelf(1);
<h1>@homeNode.Name @homeNode.CreatorId</h1>
var nodesByCreator = homeNode.DescendantsOrSelf().Where(x => x.CreatorName == "Steve Morgan");
foreach (var curNode in nodesByCreator)
{
<h2>@curNode.Name - @curNode.CreatorId - @curNode.CreatorName</h2>
}
}
UPDATED: to remove my reference to a non-existent bug in Umbraco.
Get nodes created by specific user by query
Hi Team,
How can i get the nodes created by the specific user to show in a particular page on the website.
I've different pages for every author in my website
Hi,
I don't know how far you got with this but this razor example should work.
v7:
v8
Or using the Creator Name works however - though this is obviously isn't ideal, it will probably work for you but it will need an exact string match.
}
UPDATED: to remove my reference to a non-existent bug in Umbraco.
HTH
Steve
Created bug report https://github.com/umbraco/Umbraco-CMS/issues/8275
OK - more sleep required here. I didn't notice my user ID in my v8 instance was actually "-1" not "1".
So my query returned nothing... I thought I'd hit a bug - no just an idiot!
Thanks to Sebastiaan for spotting my stupid error.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.