Giter Club home page Giter Club logo

guest-entries's People

Contributors

dependabot[bot] avatar duncanmcclean avatar imgbotapp avatar robdekort avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

guest-entries's Issues

Re-submission on replicator pictures make them disappeared

Description

With the previous update on allowing submission of replicator pictures, the pictures can be submitted.

However, when I try to edit the record without editing that replicator pictures field and do a submission again, pictures disappeared.

Steps to reproduce

  1. Create a page with pictures upload inside a replicator
  2. Save the record
  3. Edit the record and save without changing anythings
  4. Pictures inside replicator disappeared.

Environment

Statamic 3.3.51 Pro
Laravel 8.83.23
PHP 8.1.13
cc/guest-entries-support dev-main
doublethreedigital/guest-entries 2.0.1
jonassiewertsen/statamic-live-search 1.5.1
jonassiewertsen/statamic-livewire 2.9.0
mitydigital/sitemapamic 2.3.3
statamic/eloquent-driver 0.3.0
swiftmade/statamic-clear-assets 1.1.0
takepart-media/statamic-oreos 1.2.0

Error file upload

Description

Hey, when I try to upload an image there is shown this error:

Impossible to create the root directory
"D:\website\public\assets\D:/website/public/assets/veranstaltungen"

D:\website\vendor\league\flysystem\src\Adapter\Local.php:112


     */

    protected function ensureDirectory($root)

    {

        if ( ! is_dir($root)) {

            $umask = umask(0);

 

            if ( ! @mkdir($root, $this->permissionMap['dir']['public'], true)) {

                $mkdirError = error_get_last();

            }

 

            umask($umask);

            clearstatcache(false, $root);

 

            if ( ! is_dir($root)) {

                $errorMessage = isset($mkdirError['message']) ? $mkdirError['message'] : '';

                throw new Exception(sprintf('Impossible to create the root directory "%s". %s', $root, $errorMessage));

            }

        }

    }

 

    /**

     * @inheritdoc

     */

    public function has($path)

    {

        $location = $this->applyPathPrefix($path);

 

        return file_exists($location);

    }

 

    /**


Steps to reproduce

No response

Environment

Statamic 3.2.5 Pro
Laravel 8.61.0
PHP 7.4.4
doublethreedigital/guest-entries 1.0.4

`error_redirect` not working

Description

I can't get the error_redirect parameter to work. I've tried:

  1. error_redirect="{current_url}#form"
  2. error_redirect="{ permalink }#form"
  3. error_redirect="#form"

Steps to reproduce

.

Environment

Environment
Application Name: Stichting Lutje Geluk
Laravel Version: 10.8.0
PHP Version: 8.2.3
Composer Version: 2.2.7
Environment: local
Debug Mode: ENABLED
URL: lutjegeluk.test
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: database

Statamic
Addons: 6
Antlers: runtime
Stache Watcher: Enabled
Static Caching: Disabled
Version: dev-master PRO

Statamic Addons
doublethreedigital/guest-entries: 2.1.2
statamic/eloquent-driver: 1.2.0
studio1902/statamic-peak-browser-appearance: 2.0-beta.2
studio1902/statamic-peak-commands: 2.0-beta.3
studio1902/statamic-peak-seo: 2.0-beta.2
studio1902/statamic-peak-tools: 3.0-beta.2

Redis cache not work with file upload

Bug Description

I am using the Guest Entires to do a front end submission of form. However, when the submission is done, the picture uploaded are not showing in the collection entry. After some troubleshoot, it seems to be the Redis cache is not refreshing the Gallery.

If I am using file cache, this is not happening.
If I dont use a cache, this is not happening.

Steps to reproduce

  1. Configure the system with Redis cache
  2. Create a form with file upload to a collection entries
  3. Submit the form with file upload
  4. Go to Control Panel and take a look at the uploaded file, the are not exists
  5. Then I go to the Utilities and clear the Cache
  6. Go back to the entry in Control Panel, then can see the uploaded file again

Environment

Licensing
SITE
No site license key
CORE
Statamic Pro 3.3.34 Unlicensed
ADDONS
Guest Entries 1.2.1 Unlicensed
Live Search 1.5.1
Livewire 2.9.0
Oreos 1.2.0
UNLISTED ADDONS
Guest Entries Support dev-main
Eloquent Driver 0.3.0

Multiple files causing error (need to be able to upload multiple files)

Description

I have a assets field for images. Guests should be able to upload multiple images to this field. When I save from the cp are the image paths are saved like this:

images:
  - path/filename.jpg
  - path/filename.jpg
  - path/filename.jpg

These are my input fields:

<input class="w-full" type="file" name="images[0]" accept="image/png, image/jpeg">
<input class="w-full" type="file" name="images[1]" accept="image/png, image/jpeg">
<input class="w-full" type="file" name="images[2]" accept="image/png, image/jpeg">

I've tried it with value too:

<input class="w-full" type="file" name="images[0][value]" accept="image/png, image/jpeg">
<input class="w-full" type="file" name="images[1][value]" accept="image/png, image/jpeg">
<input class="w-full" type="file" name="images[2][value]" accept="image/png, image/jpeg">

This error is shown:

Error
Call to a member function store() on array
domain.tld/!/guest-entries/create
        event(new GuestEntryDeleted($entry));

 

        return $this->withSuccess($request);

    }

 

    protected function uploadFile(string $key, Field $field, Request $request)

    {

        if (! isset($field->config()['container'])) {

            throw new AssetContainerNotFoundSpecified("Please specify an asset container on your [{$key}] field, in order for file uploads to work.");

        }

 

        /** @var \Statamic\Assets\AssetContainer $assetContainer */

        $assetContainer = AssetContainer::findByHandle($field->config()['container']);

 

        $path = '/' . $request->file($key)

            ->store(

                isset($field->config()['folder'])

                    ? $field->config()['folder']

                    : $assetContainer->diskPath(),

                $assetContainer->diskHandle()

            );

 

        if (isset($field->config()['max_items']) && $field->config()['max_items'] > 1) {

            return [str_replace($assetContainer->diskPath(), '', $path)];

        }

 

        return str_replace($assetContainer->diskPath(), '', $path);

    }

 

    protected function honeypotPassed(Request $request): ?bool

    {

Some other thoughts to the file upload. What will happen, when a guest uploads a file with an existing name or the same file multiple times? Do they overwrite the old file from an other guest? Perhaps they should get a timestamp in the filename or something. Or is it possible to change the save path from the files? This would be great, because when all guest save into the same directory, this could be really confusing, if you have a lot of entries. It would be great to have influence and add something like {{ year }}/{{month}}/{{slug}} to the save path. Perhaps it's possible to add a param to the input, like <input data-path="{{ year }}/{{month}}/{{slug}}"> .

Steps to reproduce

No response

Environment

Statamic 3.2.5 Pro
Laravel 8.61.0
PHP 7.4.4
doublethreedigital/guest-entries 1.0.5

Add support for revisions

What would you like to see added?

When a guest edits the entry, the changes should not shown directly public. At first the moderator should be able take a look on it and publish the changes after it.

Is there a workaround you can use in the meantime?

Nope

Priority wise - where's this feature for you?

This is sort of a blocker for me/this project.

Can't Install

Description

I tried installing this last night using composer require duncanmcclean/guest-entries and got this error.
error
I think it is trying to install an old version that wouldn't work with v4?

Steps to reproduce

Install fresh, blank statamic and try to install addon with composer require duncanmcclean/guest-entries

Environment

New statamic 4 with nothing changed.

Wrong taxonomy entries created

Description

I list taxonomy entries in a multiple select field. When I choose the entries, they are saved correctly in the collection entry, but at the same time there are new entries generated in the taxonomy list.

Steps to reproduce

            <select name="eigenschaften[]" multiple>
                {{ taxonomy from="eigenschaften" }}
                <option value="{{ id }}">{{ title }}</option>
                {{ /taxonomy }} 
            </select>
            <select name="eigenschaften[]" multiple>
                {{ taxonomy from="eigenschaften" }}
                <option value="term1">Term1</option>
                <option value="term2">Term2</option>
                <option value="term2">Term2</option>
                {{ /taxonomy }} 
            </select>

New entries created:

  • eigenschaftenterm1
  • eigenschaftenterm2
  • eigenschaftenterm2

Environment

Statamic 3.2.2 Pro
Laravel 8.58.0
PHP 7.4.4
doublethreedigital/guest-entries 1.0.2

Success key collides with other succes key

Description

When you have a login form that redirects after success to a page with a guest entry form, the following code will execute:

{{ if {session:has key="success"} }}
    {{ partial:components/notification type="success" content="Good job" }}
{{ /if }}

This makes it seem like the user submitted the form already.

Steps to reproduce

.

Environment

Environment
Application Name: Stichting Lutje Geluk
Laravel Version: 10.8.0
PHP Version: 8.2.3
Composer Version: 2.2.7
Environment: local
Debug Mode: ENABLED
URL: lutjegeluk.test
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: database

Statamic
Addons: 6
Antlers: runtime
Stache Watcher: Enabled
Static Caching: Disabled
Version: dev-master PRO

Statamic Addons
doublethreedigital/guest-entries: 2.1.2
statamic/eloquent-driver: 1.2.0
studio1902/statamic-peak-browser-appearance: 2.0-beta.2
studio1902/statamic-peak-commands: 2.0-beta.3
studio1902/statamic-peak-seo: 2.0-beta.2
studio1902/statamic-peak-tools: 3.0-beta.2

File upload goes to the wrong directory

Bug Description

Hi Guest Entries,

We are trying to upload files according to the setup here.

https://statamic.com/addons/double-three-digital/guest-entries/docs

And I have specified an assets field pointing to the assets Container.

After upload, I expect it goes to /var/www/html/public/assets.

However, it goes to /var/www/html/public/assets/var/www/html/public/assets.

It just simply take the public assets folder as the root and create folders.

Steps to reproduce

  1. Create Assets Field in Collection Blueprint.
  2. Set the Container as Assets
  3. Submit the Guest Entry by following the file upload part stated in https://statamic.com/addons/double-three-digital/guest-entries/docs#file-uploads
  4. Submit the form
  5. Go to the corresponding collection entry that submitted
  6. Browse the file and it creates /var/www/html/public/assets inside the original Assests directory.
  7. You will find the uploaded file pointing to there

Environment

Statamic 3.3.9 Pro
Laravel 8.78.1
PHP 8.1.5
doublethreedigital/guest-entries 1.2.0

error and success messages not shown

Description

The default antlers seems not to work and there is nothing about it in the docs.

Steps to reproduce

No response

Environment

Statamic 3.2.1 Pro
Laravel 8.57.0
PHP 7.4.4
doublethreedigital/duplicator 1.3.4
doublethreedigital/guest-entries 1.0.1

`guest-entries:success` is permanent

Description

{{ guest-entries:success }} should probably be only true on the next page request. Currently when you've submitted one entry you get the succes notification on every page where you accept guest entreis.

Steps to reproduce

Use guest-entries:success
Add an entry
Continue browsing/refreshing - notification won't clear

Environment

Environment
Application Name: Stichting Lutje Geluk
Laravel Version: 10.13.5
PHP Version: 8.2.3
Composer Version: 2.2.7
Environment: local
Debug Mode: ENABLED
URL: lutjegeluk.test
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: database

Statamic
Addons: 6
Antlers: runtime
Stache Watcher: Enabled
Static Caching: Disabled
Version: 4.8.0 PRO

Statamic Addons
duncanmcclean/guest-entries: 3.1.0
statamic/eloquent-driver: 2.2.0
studio1902/statamic-peak-browser-appearance: 3.1.1
studio1902/statamic-peak-commands: 2.1
studio1902/statamic-peak-seo: 2.3
studio1902/statamic-peak-tools: 3.2

Failed to store images inside replicator

Description

I am using Guest Entries addon. I see that I can following the guideline here to use replicator (https://guest-entries.duncanmcclean.com/examples/using-with-replicator).

My case is I am having a file upload element inside a replicator that requires multiple file uploads. How should I do that?

I am using this line of code.

<input class="form-control" type="file" name="rich_text_and_image[0][gallery[]]" multiple="">

But after the form submission, I go to the collection and cannot find any images being uploaded.

Steps to reproduce

  1. Create a collection blueprint with a replicator item
  2. Inside the replicator item, add file upload element
  3. Create a form using Guest Entry with file upload element to the replicator element
<!--
rich_text_and_image is the handle of the replicator 
gallery is the file upload element handle
-->
<input class="form-control" type="file" name="rich_text_and_image[0][gallery[]]" multiple="">
  1. In the form, add image and submit
  2. Go back to control panel and check if the files are being added
  3. Cannot see any files

Environment

Statamic 3.3.51 Pro
Laravel 8.83.23
PHP 8.1.13
cc/guest-entries-support dev-main
doublethreedigital/guest-entries 1.2.2
jonassiewertsen/statamic-live-search 1.5.1
jonassiewertsen/statamic-livewire 2.9.0
mitydigital/sitemapamic 2.3.3
statamic/eloquent-driver 0.3.0
swiftmade/statamic-clear-assets 1.1.0
takepart-media/statamic-oreos 1.2.0

Delete entries

What would you like to see added?

Hey, I have some questions about deleting entries, if it's ok?

  • Is it possible to delete multiple entries at once? Something like this:
    {{ guest-entries:delete collection="articles" :ids="ids" }}
  • What happens to uploaded assets, when an entry is deleted? Could the assets get deleted too? Otherwise the assets would waste the assets folder, what would make no sense, I think.

Is there a workaround you can use in the meantime?

Don't think so.

Priority wise - where's this feature for you?

Will need it in the next few weeks

Multisite support

What would you like to see added?

Currently, this addon doesn't support multi-site setups. It should generate the entry in the locale/site the user is currently in.

Is there a workaround you can use in the meantime?

Do it yourself with a listener.

Priority wise - where's this feature for you?

Nice to have

Succes key not working

Description

{{ if {session:has key="success"} }}
    <p>You've filled in the thing properly. Good job!</p>
{{ /if }}

This code should work but doesn't.

Steps to reproduce

  1. Add that code
  2. Push an entry
  3. See nothing

Environment

Environment
Application Name: Stichting Lutje Geluk
Laravel Version: 10.7.1
PHP Version: 8.2.3
Composer Version: 2.2.7
Environment: local
Debug Mode: ENABLED
URL: lutjegeluk.test
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Statamic
Addons: 6
Antlers: runtime
Stache Watcher: Enabled
Static Caching: Disabled
Version: dev-master PRO

Statamic Addons
doublethreedigital/guest-entries: 2.1.1
statamic/eloquent-driver: 1.2.0
studio1902/statamic-peak-browser-appearance: 2.0-beta.2
studio1902/statamic-peak-commands: 2.0-beta.1
studio1902/statamic-peak-seo: 2.0-beta.2
studio1902/statamic-peak-tools: 3.0-beta.2

date field not saved in filename

Description

When you have a date field in your form, it's gonna saved in the .md file as value, like:
date: 2021-08-20

But is should saved as prefix in the filename, like:
2021-08-20.slug.md

Steps to reproduce

No response

Environment

Statamic 3.2.2 Pro
Laravel 8.58.0
PHP 7.4.4
doublethreedigital/guest-entries 1.0.2

Can't submit an entry when using `title_format`

Description

When you use a title format on a collection together with a hidden title field you can't submit guest entries.

Workaround: send the title with a hidden field using the same title format in Antlers.

Steps to reproduce

.

Environment

Environment
Application Name: Stichting Lutje Geluk
Laravel Version: 10.8.0
PHP Version: 8.2.3
Composer Version: 2.2.7
Environment: local
Debug Mode: ENABLED
URL: lutjegeluk.test
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: database

Statamic
Addons: 6
Antlers: runtime
Stache Watcher: Enabled
Static Caching: Disabled
Version: dev-master PRO

Statamic Addons
doublethreedigital/guest-entries: 2.1.2
statamic/eloquent-driver: 1.2.0
studio1902/statamic-peak-browser-appearance: 2.0-beta.2
studio1902/statamic-peak-commands: 2.0-beta.3
studio1902/statamic-peak-seo: 2.0-beta.2
studio1902/statamic-peak-tools: 3.0-beta.2

Ensure dates are formatted properly

Description

Apparently, sometimes date inputs aren't turned into dates properly. We can probably guess if it's a date by it's blueprint fieldtype.

Steps to reproduce

No response

Environment

Latest

File uploads

The ability to upload files to an asset container (via an asset field) with Guest Entry forms.

Maybe touch() and save() together are redundant (possible edge-case)

Bug Description

Hey!

Ive been using Guest Entries with success but I may have found a possible edge-case that could use some thought. Hear me out please.

Many thanks in advance for the excellent addon and for any insights!

Steps to reproduce

I have a listener set-up, listening for EntryCreated, so that when a File is attached to this field, it gets renamed and converted to JPG.

(...)
  if ($event->entry->presentation_file) {
      $name = 'presentation-' . $event->entry->title;
      $filename = 'abstracts/' . $name . '.' . $event->entry->presentation_file->extension();
  
      if ($event->entry->presentation_file->path() !== $filename) {
          Log::info($event->entry->presentation_file->path());
          Log::info($filename);
  
          if (Storage::disk('assets')->exists($filename)) Storage::disk('assets')->delete($filename);
  
          $new = $event->entry->presentation_file->rename($name); $filename
  
          if (strtolower($new->extension()) === "pdf") {
              $pdf = new Pdf($new->resolvedPath());
              $pdf->saveImage($new->resolvedPath() . '.jpg');
          }
      }
  }
(...)

It works fine on the CP.

Now, if i set up a Guest Entries, using file and save my attachment, the field becomes empty on the CP, despite the file was uploaded, renamed and even the JPG was processed. So the listener works, but in the end, the field is blank.

Heres what i found out:

The "culprit" was this: vendor/doublethreedigital/guest-entries/src/Http/Controllers/GuestEntryController.php @164

We have:

(...)
  // $entry->save();
  $entry->touch();
(...)

If I comment save(), everything works as expected. Hmmm.

While trying to dive in further....

Looking at: vendor/statamic/cms/src/Data/TracksLastModified.php @39

It seems that touch() also actually saves():

(...)
  public function touch($user = null)
  {
      $this->updateLastModified($user)->save();
  }
(...)

So I'm guessing having save() followed by touch() its either redundant and/or causes some bad behaviour on my listener by "double-triggering". But the funny thing is that if I actually log the actions on the Event Listener, they only happen ONCE even if I leave save() followed by touch().

What do you think? I hope that made any sense :)

Environment

Statamic 3.3.45 Pro
Laravel 8.83.25
PHP 8.0.24
anakadote/statamic-recaptcha 1.0.7
aryehraber/statamic-uuid 2.1.0
cnj/seotamic 2.1.0
doublethreedigital/guest-entries 1.2.2
optimoapps/statamic-bard-text-align 1.0.2
rias/statamic-data-import 1.2.2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.