Announcement

#1 2020-10-30 12:26:01

piwent
Member
2020-10-24
97

Adding some text above the upload form? (Community plugin?)

Hello!

I'm trying to figure out how to put some text above the regular user upload form that is used by the Community plugin. I don't know enough about how the pages are built to really figure it out.

My use case is that I want to remind users of the uploading guidelines before they upload anything. Something like "By uploading these images I assert that I own the copyright or that they are in the public domain." Possibly even with a link to a longer guidelines page.

I have played around with PWG Stufs plugin, but it doesn't have an option to include on the upload form.

If one was to make a plugin to do this, is there a way to hook in with a function? I have a friend who might be able to code it, but I'd like to be able to explain the code a bit. @PLG, would you have a moment to explain how the form is generated?

Offline

 

#2 2020-10-31 02:24:54

executive
Member
2017-08-16
1214

Re: Adding some text above the upload form? (Community plugin?)

the front end is designed with templates. Just find the right template and modify it with localfiles editor.  Try searching your Piwigo installation for key text phrases.

Offline

 

#3 2020-10-31 15:40:34

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13786

Re: Adding some text above the upload form? (Community plugin?)

executive wrote:

the front end is designed with templates. Just find the right template and modify it

problem is you will have to refresh it each time the original template is modified, to keep the template consistent with the backend.

piwent wrote:

I'm trying to figure out how to put some text above the regular user upload form that is used by the Community plugin.

The good solution would be to add a setting in the Community plugin configuration page. I just added a request for that [Github] Piwigo-community issue #55

I've recently implemented this:

https://sandbox.piwigo.com/i?/uploads/4/y/1/4y1zzhnrnw//2020/10/31/20201031153602-fd961fbd-me.png

To do that, I have used the [extension by sakkhho] Statistics with this code:

Code:

<script type="text/javascript">
$(document).ready(function(){
  jQuery('body#community_add_photos #photosAddContent').prepend("<p class='cccp-upload-intro'>Afin d'enrichir la photothèque et de mettre à l'honneur vos villages, il vous est possible de nous transmettre vos photos. Lors du transfert, les droits d'auteur seront cédés automatiquement. La Champagne Picarde se réserve le droit d'effectuer une sélection des photos reçues, dans un souci d'équilibrage des rubriques, de gestion de la capacité d'hébergement de l'outil, et selon des critères esthétiques, techniques (taille de l'image) ou juridiques (droit à l'image). Merci de votre participation !</p>");
});
</script>

The trick works, but absolutely not what I would consider as "user friendly".

Offline

 

#4 2020-10-31 16:22:25

piwent
Member
2020-10-24
97

Re: Adding some text above the upload form? (Community plugin?)

plg wrote:

problem is you will have to refresh it each time the original template is modified, to keep the template consistent with the backend.

So do I understand correctly that there is no concept of child theme as we have in Wordpress? Isn't that what the Templates section in the localfiles section is for? Sorry, couldn't find any documentation for that.

plg wrote:

I've recently implemented this:

OK, gets the job done! That will work for now. Thank you so much.


plg wrote:

To do that, I have used the [extension by sakkhho] Statistics with this code:

So it wouldn't work to put the code into the personal plugin LocalFile? I guess because this is js and the personal plugins are PHP? I'm really out of my depths(again).

Thanks!

Last edited by piwent (2020-10-31 16:24:06)

Offline

 

#5 2020-10-31 16:33:14

homdax
Member
Sweden
2015-02-02
294

Re: Adding some text above the upload form? (Community plugin?)

the jscript will execute in a php page as posted by plg... 

As long as you use the language tags properly you can delimit and execute many code languages within pages of a different language.. php jscript css are all examples of that

Last edited by homdax (2020-10-31 16:34:15)

Offline

 

#6 2020-10-31 19:17:54

executive
Member
2017-08-16
1214

Re: Adding some text above the upload form? (Community plugin?)

If you use the template section, you are replacing the template file wholesale. A blunt instrument. As PLG said, this would require maintenance every time it is updated.

PLG's solution is more precise. It injects HTML after the template is rendered. It doesn't require maintenance unless the upload page was severely changed.

He's using the the statistics plugin for convenience. It's a quick and simple way to inject code into the head element. I'm sure you could adapt personal plugins to work, with a bit more work, but I'm not sure what you would gain.

Last edited by executive (2020-10-31 19:18:43)

Offline

 

#7 2020-11-02 10:02:44

piwent
Member
2020-10-24
97

Re: Adding some text above the upload form? (Community plugin?)

OK. And now that I look more deeply at the statistics plugin, it does have the feature to disable the inserted text for the Admin, which is something specifically needed for the statistics trackers.

I wonder if the code could be used in the [extension by ddtddt] Add < head > Element plugin instead.

Unfortunately for me, using either plugin gives me a 500 Internal Server Error. :-( But that is an issue for another post.

Thanks everyone.

Last edited by piwent (2020-11-02 10:04:13)

Offline

 

#8 2020-11-02 11:35:24

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13786

Re: Adding some text above the upload form? (Community plugin?)

I've used the "Statistics" plugin instead of "Add <head> element" because the code is injected at the end of the page, where there's more chance jQuery was already loaded (but not 100% sure, unfortunately).

Offline

 

#9 2020-11-02 13:29:13

piwent
Member
2020-10-24
97

Re: Adding some text above the upload form? (Community plugin?)

plg wrote:

I've used the "Statistics" plugin instead of "Add <head> element" because the code is injected at the end of the page, where there's more chance jQuery was already loaded (but not 100% sure, unfortunately).

Oh, that makes a lot of sense. Thanks!

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact