Add option to dashboard widget to show all submissions, or just for the current user
Currently, all submissions are shown in the dashboard widget, including ones users might not have access to, which isn't a good look. Add the option to show all, or just the ones that the current user is the editor/reviewer/publisher on.
@engram-design That would be great!
We already needed this, so we built it as a custom widget that extends the built-in widget. Just leaving this here in case someone needs it:
use Craft;
use verbb\workflow\elements\Submission;
use verbb\workflow\widgets\Submissions;
class OwnSubmissions extends Submissions
{
public static function displayName(): string
{
return Craft::t('custom_workflows', 'My submissions');
}
public function getBodyHtml(): ?string
{
$user = Craft::$app->user?->getIdentity();
if (!$user) {
return '';
}
$submissions = Submission::find()
->status($this->status)
->limit($this->limit)
->editorId($user->id)
->all();
return Craft::$app->getView()->renderTemplate('workflow/_widget/body', [
'submissions' => $submissions,
]);
}
}
Might make sense to have it as a separate widget (as opposed to an option in the existing widget) so we can provide some users access to only this limited widget.
Thanks for that! Yep, might be it's own separate widget, or just adding some settings to chose what to show. Appreciate it 👍