discuss.answer
I have the same feature, and I get your expected result using similar code
[[!getResources?
&parents=`783,791,1314` //I have actual numbers here
&includeTVs=`1`
&where=`{"createdby:=":[[!+modx.user.id]]}`
&limit=`0`
&showHidden=`1`
&tpl=`myPublished`]]
Hope this helps
TinymceWrapper: Complete back/frontend content solution.
Harden your MODX site by
passwording your three main folders:
core, manager, connectors and renaming your
assets (thank me later!)
5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
donshakespeare, thank you so much.
I feel like an idiot. I'm pretty sure it was the missing &showHidden that was the problem.
I've been looking for a tutorial on how to allow a logged-in member to edit and/or delete their previously created resources. Do you know of any?
[ed. note: todd.b last edited this post 11 years, 9 months ago.]
Todd
Glad that one helped.
To list all resources created by the logged-in user (in the secure member area) I'm using,
I am guessing you are generating a list of published articles displayed on a page(not necessarily created by the user but by you, say, published-articles.html), and this page is then viewed by the user author?
Well if that's the case,
[[*createdby]] will always show the creator of the page, namely the Super Admin..
Try
[[+createdby]]
As for extended fields, you are better off writing a three-line code to fix your issue
Look at
https://forums.modx.com/thread/?thread=52689&i=1&page=1
https://forums.modx.com/thread/95652/getting-a-user-s-object-by-user-id-i-d-like-to-know-how-it-s-done#dis-post-517727
and of course
http://bobsguides.com/revolution-objects.html
TinymceWrapper: Complete back/frontend content solution.
Harden your MODX site by
passwording your three main folders:
core, manager, connectors and renaming your
assets (thank me later!)
5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
Scratch that, I spoke too soon. I will check out your suggestion above. Thanks again.
Also, how do you allow your members to edit their previously created resources with, I presume, NewsPublisher?
Todd
I wrote a snippet called
[[!whoPublished]], that displays the NewPublisher button always to the Admin, and to respective author.
If they land on the page from goodness me knows where:
$output = '';
$modxID = $modx->user->get('id'); //get id of the present viewer
$modxResource = $modx->resource->get('createdby'); //get id of the creator of the page (not publisher), because sometimes, I let them create, but let the Admin publish.
if ($modxID == $modxResource || $modxID == 1) { //if id of present user matches the id of the author OR Sudo Admin is viewing the page (id of 1)
$output = '[[!NpEditThisButton? &np_id=`123`&noShow=`129`]]';
}
return $output;
If you have multiple NPbuttons, say, in a getResources call, just do it as prescribed in the tut.
In the tpl
[[!NpEditThisButton? &np_id=`123` &np_edit_id=`[[+id]] `]]
TinymceWrapper: Complete back/frontend content solution.
Harden your MODX site by
passwording your three main folders:
core, manager, connectors and renaming your
assets (thank me later!)
5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
@donshakespeare: very nice!
@todd.b: You probably know this by now, but your initial problem was the &parents=`[[~2]]`, that would send the URL of resource 2 and &parents wants resource ID numbers.
@BobRay Thanks for the tip. So many simple things to trip me up.
@donshakespeare I'm using your snippet and I'm being redirected to the NP form (from a member-created page that lives outside of the members area/folder) but all the NP form fields are empty.
Todd
Try adding this property to the NpEditThisButton tag:
I added it to the NpEditThisButton tag in the whoPublished snippet but no luck.
Todd