The simpler media website CMS
Hi, I'm a photograher building up a galery with ZenPhoto and I want users to be able to put comments under images, can you help me with this "Place a call on the function printCommentForm() in your script where you wish the comment items to appear. " So I have tried a few things in this string in the image.php . Can you tell me what and where to place the call.
?> </div> <div class="media_supp_content_col"> <?php if (function_exists('printCommentForm')) { if ($_zp_current_image->getCommentsAllowed() || $_zp_current_image->getCommentCount()) { echo '<section class="bloc-comments">'; echo '<h2>Commentaires</h2>'; printCommentForm(); echo '</section>'; } } ?>
Many Thanks
Michel
Comments
That should work. You're sure the comment_form plugin is enabled?
Thanks for the answer, no it is not enable, how can I do so?
Thanks Again Michel
Go to: Admin —> Plugins —> check the box next to comment_form
Shame on me, I forgot somes gettext on Collections,
if you are not a french user Mazurki,
you can change the line ;
echo '<h2>Commentaires</h2>';
to
echo '<h2>'.gettext('Comments').'</h2>';
so you will get a localized string.
Thanks fretzl & Roland for your delicacy,
I am french and it was already changded for
echo
<h2>Commentaires/Comments</h2>
,my gallery is or will be 'Français/English' when published.
The plugin was alredy enabled and in Plugins/Active. I tought that enable meant activate the plugin like for Rating or other plugins
</a><?php } ?> <?php #start function CommentForm if(function_exists('printCommentForm')) {?> <?php
However the plugin still not working but the Gallery itself is working pretty well with 12,000 pictures.
Thanks again for your support
mazurki
What theme are you using?
I'm using Collections with these plugins; comment_form, contact_form, hitcounter, ipBloocker, mobileTheme, print_album_menu, rating, reCaptcha, rss, security_logger, seo_zenphoto, sitemap_extended and uploader_jQuery. May be some are not really necessary or useful?
Thanks
mazurki
Weird, it works for me.
Any errors in the logs?
BTW: the plugin mobileTeme is not needed.
{2716853:Wed, 21 Feb 2024 00:38:56 GMT}
WARNING: mysqli::__construct(): (42000/1203): User photo698_zen82 already has more than 'max_user_connections' active connections in /home/photo698/galerie.photosmichel.com/dossier/zp-core/classes/class-dbmysqli.php on line 26
mysqli->__construct called from dbMySQLi->__construct (class-dbmysqli.php [26])
from require_once (functions-basic.php [219])
from i.php [35]
{2716853:Wed, 21 Feb 2024 00:38:56 GMT}
WARNING: mysqli::query(): Couldn't fetch mysqli in /home/photo698/galerie.photosmichel.com/dossier/zp-core/classes/class-dbmysqli.php on line 72
mysqli->query called from dbMySQLi->query (class-dbmysqli.php [72])
from dbMySQLi->querySingleRow (class-dbmysqli.php [98])
from dbBase->getVersionComplete (class-dbbase.php [633])
from dbBase->getVersion (class-dbbase.php [611])
from dbBase->hasUtf8mb4Support (class-dbbase.php [694])
from dbMySQLi->__construct (class-dbmysqli.php [38])
from require_once (functions-basic.php [219])
from i.php [35]
{2716853:Wed, 21 Feb 2024 00:38:56 GMT}
WARNING: mysqli_error(): Couldn't fetch mysqli in /home/photo698/galerie.photosmichel.com/dossier/zp-core/classes/class-dbmysqli.php on line 178
mysqli_error called from dbMySQLi->getError (class-dbmysqli.php [178])
from dbMySQLi->query (class-dbmysqli.php [83])
from dbMySQLi->querySingleRow (class-dbmysqli.php [98])
from dbBase->getVersionComplete (class-dbbase.php [633])
from dbBase->getVersion (class-dbbase.php [611])
from dbBase->hasUtf8mb4Support (class-dbbase.php [694])
from dbMySQLi->__construct (class-dbmysqli.php [38])
from require_once (functions-basic.php [219])
from i.php [35]
{2716853:Wed, 21 Feb 2024 00:38:56 GMT}
USER ERROR: mysqli Error: ( SELECT version() ) failed. mysqli returned the error in /home/photo698/galerie.photosmichel.com/dossier/zp-core/classes/class-dbmysqli.php on line 83
trigger_error called from dbMySQLi->query (class-dbmysqli.php [83])
from dbMySQLi->querySingleRow (class-dbmysqli.php [98])
from dbBase->getVersionComplete (class-dbbase.php [633])
from dbBase->getVersion (class-dbbase.php [611])
from dbBase->hasUtf8mb4Support (class-dbbase.php [694])
from dbMySQLi->__construct (class-dbmysqli.php [38])
from require_once (functions-basic.php [219])
from i.php [35]
That error means you mysql database server cannot handle the connections made. That can only be solve by rasing that limit on the server. All the others are follow ups errors of the first.t
This normally only happens on sites with really lots of traffic when the server cannot handle that.
Thanks acrylian,
I have open a ticket with my Host awaiting a response.
I am wndering if this have a real impact on the fact that the comment_form plugin does not load or print on thje page?
Have a nice day
mazurki
Yes and no I would say. the site itself uses database requests even without the comment_form. But that of course uses an additional one at least to ge the existing comments. Could be that this is the one that exceeds your db server. But likely it is a general server things.
Do you have other sites on thesame account that perhaps "eat" server limits here? Do you have shared hosting? There is a huge differences in these hosts and plans. You don't need your own server or something if you have a "normal" site. The larger a site regarding albums and images the more power it certainly needs in general. Especially the more traffic you might get. Our own site is on shared hosting as well.
If your server is really reaching db limits too fast, also try the static_html_cache plugin. If you don't update that often use a long time frame until it updates itself.
Yes in deed, this new gallery is on a subdomain...
I will wait to see their answer and decide what I will do according and might decide to go live even if gallery is not complete. Very anxious to be live!
I will keep in touch
Many thanks for your support
mazurki
I am no longer on a subdomaine I am live on a clean fresh installation, I have also isntalled static_html_cache plugin and unfortunatly the comment_form is still not printing...
Thanks
mazurki
https://photosmichel.com/
Are comments activated for individual images?
https://www.zenphoto.org/screenshots/zenphoto-admin/album.jpg.html
Thank you so much, it wors...
So simple finally.
Have a nice day
mazurki
My comment_form has the Name field, the Email field and the comment block, when I hit submit the information is saved and the comment block empties but the other two don't. What to do so that they disappear at the same time. I tried several things but couldn't do it.
Many thanks
mazurki
That only happens when you are logged-in.
Nobody else will see it.
Good morning,
Unfortunately, I am not logged in as an admin and I connect to https://photosmichel.com in 3 different browsers and when I enter a comment on an image and I click add, the comment is saved and the Name and Email informations are not erased and not only they are not erased but they are duplicated in all the comment forms in the Gallery.
You can see for yourself.
Thank you for your support.
mazurki
I admit I basically never use this plugin myself. So I indeed had to look that up. That is actually stored in cookie as a "known user" once you commented previously. You can try that by clearing cookies and/or using a private tab/window in your browser.
Actually I think the plugin should not do that at all. Actually in the code there is a check for $_POST['remember'] that is apparently set via an invisible field.
A reason for this seems to be that the form keeps data in case an error on posting occurs. I will see to turn that into a checkbox so a comment has a choice. Perhaps even make it an option for that checkbox to appear at all. More GDPR/privacy friendly anyway.
Thank you acrylian for the answer,
I did a test with a private window plus cleaning cookies and closing the tab then reopening and still the same behavior.
Thanks again for the support
Sincerely
Mazurki
Then you perhaps have your browser setup to remember and fill in form data automatically?
Good morning,
Can I expect a fix eventually?
Thanks
mazurki
We did investigate and we don't see anything from our side that "remembers" except when you are logged in.
Check your browser setting regarding autocomplate perhaps.
Hi,
For your information my three Browsers are not set to autocomplete.
But it’s OK now I have changed the ‘remember’ command of line 545 and 557 of the function.php file
In public_html/zp-core/zp-extensions/comment_form and all is working as expected now, comment saved and field erased and non duplicated in the other comments forms.
I gave you the link to my Gallery, you could have gone and checked for yourself, I asked three people outside to check the behavior and the result was the same, they rechecked after my change and everything works fine.
Mazurki
Okay, good, better to have that off to avoid the browser adding that to forms you don't want to.
Weird, I looked at it and it looks like it os for admins only. And using a private tab to comment on a local test site nothing was remembered… It only worked when I was loggedin. We'll try that again tommorrow…
Btw, for now you don't have to modify the plugin itself. You can have a custom form within
/plugins/comment_form/comment_form.php
folder, too. Just take the one from/zp-core/zp-extensions/comment_form//comment_form.php
and modify it. There is a hidden input field named "remember" right at the beginning. Removing it should help actually.Hi acrylian,
I undid the changes I made in function.php and modified comment_form and everything works as it should.
Great!
Thanks
mazurki