Forum for discussing general topics related to Couch.
3 posts Page 1 of 1
Hi, I like couchcms very much, but I need help with this.

I want to find all postings made by a certain author using the search function, is this possible ?
In order to do that, first you need to link a post to the author who wrote it. Couch doesn't keep track of that automatically. To mark a post with the author's name, add the following editable region to the template. Now each post is linked to the author who wrote it. Posts can be searched, sorted, and otherwise managed and organized by author.
Code: Select all
<cms:editable name='author'
    label="Author"
    type='text' ><cms:show k_user_title/></cms:editable>

This should show the Display Name of the admin who first adds the post, but it can be changed.
My bad, @Goliath. The code above doesn't work. It always shows the super-admin in the author field because that's who was logged in when the template was initiated. But it's the right idea.

To fetch the currently logged in user, we need to make the field accept dynamic data.
Code: Select all
<cms:editable name="author" type="text" dynamic='default_data'>
author.html
</cms:editable>

In your snippets folder, place a file called "author.html" with the single line:
Code: Select all
<cms:show k_user_title/>

Now every time the admin panel page is accessed it will look for the snippet and fill the field with that code, in this case showing the author's name.

I hope that helps you.

Tim
3 posts Page 1 of 1