Jump to content

Show "last modified by user" info in Frontend Edit Modal


Recommended Posts

Hi @bernhard!

I don't know if this is a RockFrontend or RockPageBuilder related question (or maybe only PageFrontEdit?). But here we go:

In the PW backend I can see unter the "settings" tab of a page which user modified this page recently:

image.png.6b4e767c0a150177677dbba408a77291.png

$modifiedFormatted = date("d.m.y H:i", $page->modified);
$lastModifiedByUser = $page->modifiedUser->name;

Is it possible to display this information when editing a RPB Block in a modal window, for example on the top?

Something like this:

image.thumb.png.2ecf96004c1173d69411cd770c559861.png

  • Like 1
Link to comment
Share on other sites

4 hours ago, bernhard said:

What do you think of showing a warning if the block has been modified < 5min by another user by default?

I just want to see which user did the latest changes on a specific block.

In the backend page tree I modified the view like this:

image.png.5c396599b6c77a3197b6feb47c750cc6.png

This works for pages but you can not see which page builder block (inside those pages) has been edited by which user.

Link to comment
Share on other sites

  • 2 weeks later...

Here you go:

2gH8gl8.png

wire()->addHookAfter('ProcessPageEdit::buildForm', function ($event) {
  $page = $event->object->getPage();
  if (!$page instanceof \RockPageBuilder\Block) return;
  $form = $event->return;
  $user = $page->modifiedUser->name;
  $relativeTime = wire()->datetime->relativeTimeStr($page->modified);
  $form->prepend(rockmigrations()->inputfield([
    'type' => 'markup',
    'label' => 'Block Info',
    'icon' => 'clock-o',
    'value' => "Zuletzt bearbeitet von: $user ($relativeTime)",
  ]));
});

This will show the info for all blocks, but you can define conditions as you need on the $page object.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...