# Panel pages modified by users

**URL:** <https://forum.getkirby.com/t/panel-pages-modified-by-users/20217>\
**Category:** Questions\
**Created:** [December 1, 2020, 4:16pm UTC](https://forum.getkirby.com/t/panel-pages-modified-by-users/20217 "2020-12-01T16:16:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oziris](https://avatars.discourse-cdn.com/v4/letter/o/df788c/32.png) [@Oziris](https://forum.getkirby.com/u/Oziris)\
**Post date:** [December 1, 2020, 4:16pm UTC](https://forum.getkirby.com/t/panel-pages-modified-by-users/20217/1 "2020-12-01T16:16:09Z")

</div>

Hi  
I come back to a previous post from [here](https://forum.getkirby.com/t/kirby-3-panel-last-edited-pages/17259/15), I’ve set up a custom panel field to show the historic of modified pages. The problem is that each users can only see their own modifications. My goal is now to show every modified pages from every users. Can I do that without Database, and how ?

This is the actual code :

```auto
<?php

Kirby::plugin('medienbaecker/history', [
	'sections' => [
		'history' => [
			'props' => [
				'headline' => function($headline = "History") {
					return $headline;
				},
				'limit' => function($limit = 5) {
					return $limit;
				}
			],
			'computed' => [
				'latestPages' => function() {
					$latestPages = array();
					foreach(site()->index()->sortBy('modified', 'desc')->limit($this->limit()) as $latestPage) {
						$latestPages[] = [
							'title' => $latestPage->title()->value(),
							'link' => $latestPage->panelUrl(),
                            'last' => $latestPage->modified('d/m/y H:i'),
                            'user' => kirby()->user()->name()->value(),
						];
					}
					return $latestPages;
				}
			]
		]
	]
]);

```

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [December 1, 2020, 4:35pm UTC](https://forum.getkirby.com/t/panel-pages-modified-by-users/20217/2 "2020-12-01T16:35:02Z")

</div>

I don’t really see why this should only display modifications made by the current user. According to the code, you display the last x modified pages and then attach the current user to this information, no matter who actually modified a page, because that information does not exist.

And indeed, if you want to get the information who actually last modified a page, then you first have to store this information somewhere, either with each page via hooks, or in an external data base).

---

<div class="post-metadata">

**Author:** ![Oziris](https://avatars.discourse-cdn.com/v4/letter/o/df788c/32.png) [@Oziris](https://forum.getkirby.com/u/Oziris)\
**Post date:** [December 1, 2020, 4:56pm UTC](https://forum.getkirby.com/t/panel-pages-modified-by-users/20217/4 "2020-12-01T16:56:23Z")

</div>

Yes you right, and if I want to store this information in a csv file for example, how to make this hooks ?

I found these lines that could help but don’t how to permute :

```auto
Kirby::plugin('mypage/historyhooks', [
    	'hooks' => [
            'page.update:after' => function ($newPage, $oldPage) {

            	$lasteditedpages = Db::insert('lasteditedpages', [
    	        	'user' => kirby()->user()->email(),
    	        	'title' => $newPage->title(),
    	        	'image' => $imageUrl,
    	        	'link' => $newPage->panelUrl(),
    	        ]);        	

            }
        ]
    ]);

```

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [December 1, 2020, 5:05pm UTC](https://forum.getkirby.com/t/panel-pages-modified-by-users/20217/5 "2020-12-01T17:05:12Z")

</div>

This code would store the information in a database. For this to work, however, you first have to set up your database.

I’m not really sure what sort of changes `$page->modified()` actually catches.

Depending on what you want to store in your csv file (which will then be your source of truth for the section, I guess), you might have to use multiple hooks, because `page.update:after` only catches actual changes to the content, but not changes to the title, slug, status, sorting etc.

---

<div class="post-metadata">

**Author:** ![Oziris](https://avatars.discourse-cdn.com/v4/letter/o/df788c/32.png) [@Oziris](https://forum.getkirby.com/u/Oziris)\
**Post date:** [December 1, 2020, 7:38pm UTC](https://forum.getkirby.com/t/panel-pages-modified-by-users/20217/6 "2020-12-01T19:38:20Z")

</div>

Ok, I think I will combine the solution from this topic [Simple changelog hook for Kirby](https://forum.getkirby.com/t/simple-changelog-hook-for-kirby/20071) with this one [Kirby 3 Panel - last edited pages](https://forum.getkirby.com/t/kirby-3-panel-last-edited-pages/17259/15)

One last question : how to make a link on a specific tab from this custom historic panel ? I would like to click on the link to show directly the tab of the page containing the changelog (called #historique) ?

I’ve set this but the link don’t show directly the tab of the page

`<a v-for="page in latestPages" :href="page.link#historique"><span aria-hidden="true" data-back="pattern" class="k-icon k-icon-circle-filled"><svg viewBox="0 0 16 16" style="color: rgb(197, 201, 198);"><use xlink:href="#icon-circle-filled"></use></svg></span><span>{{ page.title }}</span><div>{{ page.user }}</div><div>{{ page.last }}</div></a>`
