Home › Toolset Professional Support › [Resolved] Add a Gallery (repeating image field) in Post Field Group
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | - |
- | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | - |
Supporter timezone: Asia/Kolkata (GMT+05:30)
This topic contains 13 replies, has 2 voices.
Last updated by stefanoL-3 1 year, 10 months ago.
Assisted by: Minesh.
Tell us what you are trying to do?
Scenario: We have custom post type that represents building sites. The building site's author is able to create the post with front end form. The building site post type has a Field group called Updates. Updates are managed with RFG. These updates consist of given description and photos or videos and a Date field. For Date and description fields there is no problem, but for Images and videos we need author to be able to upload multiple images or video within the front-end form associated to RFG. Subsequently we need to show these images and video in a gallery within a view of RFG.
<b>The problem is that Repeating Image is Disabled in RFG. Do you know a workaround or different approach to this?</b>
Hello. Thank you for contacting the Toolset support.
The thing is that it already shows the information that:
Repeating Fields are currently not supported inside Repeatable Field Groups - a field can only have one value inside a Repeatable Field Group.
Having said that a different possible structure would be to create another post type lets say "Site Updates" and add the fields you want by created custom field group and assign this field group to display with "Site Updates" post type and then you should create one-to-many post relationship between post type that represents building site and "Site Updates".
Will the above mention structure help?
Dear minesh,
Thank you for your valuable support!
Let's say we have 2 ways at the moment to solve this issue:
Easy Way:
We leave the RFG as it is at the moment and instead of multiple lines, Images and videos field we replace them with a WYSIWIG. This way the author could submit photos, videos, descriptions and more using the built in wordpress media gallery. This is not really a linear process but it certainly allows us to reach the goal shortly.
Question about this easy way:
Hard Way:
Your approach of creating a second post type "site updates" could be very interesting, but we need to investigate it as we have to restrict access for security reason. This approach will let the author of the post type "building site" having a front end form where he can submit updates. These "site updates" are linked to the "building site" with a one-to-many relationship. That's could be very good but we need some confirmation before proceed developing this way.
Question about this hard way:
Said that i would like to let you know that we have a big company behind this project and they are willing to pay the Repeating Fields inside Repeatable Field Groups feature development.
I saw this feature request is 3years old and many Toolset developers are requesting it. is there any update on this?
Easy Way:
We leave the RFG as it is at the moment and instead of multiple lines, Images and videos field we replace them with a WYSIWIG. This way the author could submit photos, videos, descriptions and more using the built in wordpress media gallery. This is not really a linear process but it certainly allows us to reach the goal shortly.
Question about this easy way:
Could the "building site" author only see his media into the wordpress gallery of the wysiwig of the RFG? (this is for security reason, because all building sites posts are password protected and information inside these posts are really confidential )
==>
Toolset forms offers the way you can manage media permissions. Here is the Doc:
- https://toolset.com/course-lesson/using-the-native-wordpress-media-manager-in-front-end-forms/
You will see that option at:
=> Toolset => Access Control => Toolset Forms tab => Use any Media Library file when adding files to front-end Post Forms
Can you please check first and see this works as expected for you.
Dear Minesh,
Thank you for working out of your working time, workaholic! 😀
Solution you shared seems not to work correclty with the Add media button in wysiwig field.
even if => Toolset => Access Control => Toolset Forms tab => Use any Media Library file when adding files to front-end Post Forms is not checked my custom user role user can still see others files in media library of wysiwig field.
I tried it with image(repeatable), video(repeatable), featured image, and file fields. It works good on this cases!
By the way when the media library is opened from add media button from wysiwig field it shows all media.
I think it is related to the custom permission set into the access plugin.
Check the screenshot i attached. In the form option it says that upload_files capability is required and i activated it. If i don't activate this capability then the Media Button doesn't show on wysiwig, even if i check "Use the WordPress Media Library manager for image, video, audio, or file fields(that i already said it doesn't affect wysiwig behavior)"
I would like that the option you mentioned in access plugin works for wysiwig also. Is it a bug?
in the meanwhile i'm using custom filters like this.
add_filter( 'ajax_query_attachments_args', 'role_azienda' ); function role_azienda( $query ) { $user_id = get_current_user_id(); if ( $user_id && current_user_can('azienda') ) { $query['author'] = $user_id; } return $query; }
Have you set your post type managed by access?
Ahh, ok
I would like to know using what role you are allowing users to upload the image. I mean what capabilities you assigned to role "azienda"? If you created that role using Guest user then you will have to use the code you shared.
As you can see with the table given with the following Doc:
- https://toolset.com/course-lesson/using-the-native-wordpress-media-manager-in-front-end-forms/
There its mentioned that what user role will have what capabilities during access of media library. If the custom user role does not have those capabilities you will have to add such custom code which you already added.
Dear minesh, you pointing on a wrong topic. The role "azienda" has been created with author or contributor user, i don't remeber exactly. But let me explain better.
Using access control to restrict media library to only show own files is working well!
On every forms and upon fields managed using wordpress media library i can see only the media uploaded by the current logged-in user Azienda.
The issue is only on the RFGs form that is actually using Wysiwig field with add media button enabled. When a logged-in user Azienda click on Add Media from that wysiwig button, then all media of all users are showed in the library.
Is there a solution for that? i think it could be a bug of the wysiwig on RFGs form.
To be sure of the bug i did a test.
i added two fields in a RFGs form: WYSIWIG FIELD and IMAGE FIELD.
If i click add image from the IMAGE FIELD then the media gallery show only current logged in user media files.
If i click add media from the WYSIWIG FIELD then the media gallery show all the media files of all users.
Indeed, there seems to be issue when you try to access media using form created for RFG and the WYSIWYG field added to RFG.
I see if WYSIWYG field is added directly to any custom post type it works as expected but it seems there is issue when field is WYSIWYG field and added to RFG.
However, I'm glad that you have workaround to go with as of now so I suggest you should keep using the workaround as of now as I'll just report the issue to our next level support and there will be no ETA on it when the fix made available.
I would like to inform you that this is a known issue to us and here is the errata page:
- https://toolset.com/errata/access-setting-to-limit-media-library-to-own-media-doesnt-work-with-add-media-button-of-wysiwyg-editor/
As I requested, you should keep using workaround you shared for now that will help you to take next steps with your project.
Dear minesh,
Thank you for support. Next time I will search into “errata” section before asking solution here. I didn’t know about it before you linked to the known issue post.
Btw I want share this for future users:
2 temporary workaround.
1_Using this plugin seems to fix the issue: https://wordpress.org/plugins/frontier-restrict-media/
2_this custom code work only for grid view. Switching to list view will show all media files in media library, so I definitely do not recommend this solution.
add_filter( 'ajax_query_attachments_args', 'role_azienda' ); function role_azienda( $query ) { $user_id = get_current_user_id(); if ( $user_id && current_user_can('azienda') ) { $query['author'] = $user_id; } return $query; }
thanks for sharing that information. This indeed will help other users.
You are welcome to close this ticket for now.
Minesh is very helpful. Very good support. However the bug has not been resolved and need further investigation from developers team. stay tuned here - https://toolset.com/errata/access-setting-to-limit-media-library-to-own-media-doesnt-work-with-add-media-button-of-wysiwyg-editor/