Extension talk:CIForms

Is there anyway to turn off the Google Validation?

edit

We have a wiki on an internal server so do not require this security step, can we remove it? Equalze (talk) 18:40, 16 February 2021 (UTC)Reply

hello Equalze, sorry for the late reply. We have been working on a new version, with several additional features, here you can see a working example
https://culturaitaliana.org/organizations/Istituto_cultura_italiana_(NGO)/Language_courses/Esercizi/settimana-23-26/4
when interpreted using vuejs.
I will include the option to disable recaptcha on the first stable version.
(Thomas) Thomas-topway-it (talk) 20:30, 14 June 2021 (UTC)Reply
Has anything progressed with options to disable google validation? 209.239.96.194 (talk) 21:32, 5 August 2021 (UTC)Reply
@Equalze, I have updated the repository now, the captcha verification can now be disabled Thomas-topway-it (talk) 22:59, 11 August 2021 (UTC)Reply

Emails have no content?

edit

I'm testing this extension, using the first example that's just name, email, and a textarea. The email sends successfully, but what I receive does not contain the form data? I only get the following:


<div class="ci_form_table"><div class="ci_form_section"><table class="ci_form_section_table""></table></div></div> Jhollinden (talk) 19:20, 9 August 2021 (UTC)Reply

@Jhollinded, I have updated the repository now, can you verify everything works well ? Thanks Thomas-topway-it (talk) 23:00, 11 August 2021 (UTC)Reply
It does, thanks. Jhollinden (talk) 20:13, 23 August 2021 (UTC)Reply
hello @Jhollinden, I suggest you to upgrade to the latest version ! (1.2.1) Thomas-topway-it (talk) 11:56, 21 February 2022 (UTC)Reply

Error during form submission

edit

I am facing a problem when I try to submit CIForm, this is the error:

Warning: file_get_contents(http: // localhost:8080/extensions/CIForms/resources/style.css): failed to open stream: Connection refused in /var/www/html/extensions/CIForms/includes/specials/CIFormsSubmit.php on line 160


Do you have any ideas what could be wrong? My wiki can send stuff to users, SMTP is thus correctly configured (using SwiftMailer extension). Agajdosi (talk) 10:11, 16 September 2021 (UTC)Reply

Hello @Agajdosi, we have just upgraded all the repository. Just download / install the latest version and the issue should disappear! Thomas-topway-it (talk) 21:53, 9 January 2022 (UTC)Reply

Thank you to the creators.

edit

This is a great extension, and it seems like not many people had problems with it. Thank you very much for creating it. Makertrainer (talk) 21:10, 20 January 2022 (UTC)Reply

hello @Makertrainer, thank you, I suggest you to upgrade to the latest version ! (1.2.1) Thomas-topway-it (talk) 11:55, 21 February 2022 (UTC)Reply
Hi Thomas,
I updated to the newest version, and it doesn't seem to work for some reason. I ran update.php, but I still get this error:
Error 1146: Table 'makertra_mw19564.mwrh_CIForms_submissions' doesn't exist (localhost)
If you have any suggestions, I'd be glad to hear them. For now I switched back to the older version, which works fine. Makertrainer (talk) 19:47, 31 May 2022 (UTC)Reply
@Makertrainer hello, I did a major update to CIForms, now it supports table prefix and postgres. Before it didn't. You can check the full list of new features in the main page of the extension. Thomas-topway-it (talk) 08:50, 25 July 2022 (UTC)Reply

Translating / where to edit

edit

Hey, thank you for this great extension, by testing right now, I was wondering if it would be possible to change the text in the "Form Submission Page" and the "Submissions Spezial Page" ? 212.23.139.2 (talk) 13:18, 7 February 2022 (UTC)Reply

You can edit the messages in the file i18n/en.json
I suggest you to upgrade to the latest version ! (1.2.1) Thomas-topway-it (talk) 11:57, 21 February 2022 (UTC)Reply
and how can i edit the message "submit" (the text of the button), please? Brunodapei (talk) 21:32, 24 May 2022 (UTC)Reply
@Brunodapei hello, I did a major update to CIForms, now labels of buttons can be edited from the form descriptor. You can check the full list of new features in the main page of the extension. Thomas-topway-it (talk) 08:51, 25 July 2022 (UTC)Reply
grazie! Brunodapei (talk) 20:42, 25 July 2022 (UTC)Reply

Compatibility with Postgres?

edit

Im getting this error when trying to submit a CIForm:

Error 42P01: relation "CIForms_submissions" does not exist

I've successfully followed all the installation steps (I did skip step 2: "Run composer update inside the folder extensions/CIForms" because i dont need the email functionality).

We are using Postgres and it looks like CIForms.php is only making the the DB changes if mysql is being used?

Is it correct that only mysql is supported? if so, what would it take to get this working with Postgres?

Thanks in advance! YahboobayYahboobay (talk) 17:15, 25 February 2022 (UTC)Reply

Update: I've been able to get Forms to submit successfully by
1. translating the two files in "CIForms/sql/" from mysql to postgres
2. making some minor changes to "CIForms/includes/specials/CIFormsSubmit.php" & "CIForms/includes/specials/CIFormsManage.php" (changing any references to the "CIForms..." tables to lower case i.e. "ciforms...")
But now i get a new database error when trying to view the results at Special:CIFormsManage:
Error 42803: ERROR: column "ciforms_submissions.id" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: SELECT /* CIFormsManage::reallyDoQuery */ ciforms_submissio...
Function: CIFormsManage::reallyDoQuery
Query: SELECT ciforms_submissions.*,
COUNT(*) as submissions,
(SELECT MAX(created_at)
FROM ciforms_submissions as b
WHERE b.title = ciforms_submissions.title
) as last_submission_date,
SUM(CASE WHEN shown IS NULL THEN 1 ELSE 0 END) as new
FROM ciforms_submissions
GROUP BY ciforms_submissions.page_id, ciforms_submissions.title
ORDER BY last_submission_date DESC LIMIT 51 OFFSET 0
It seems to originate from the database query that results from line 413 in "CIForms/includes/specials/CIFormsManage.php"
Im afraid i've reached the limits of my troubleshooting capabilities. Do you have any ideas to help me view the results in given our Postgres database?
Thanks again! YahboobayYahboobay (talk) 20:47, 25 February 2022 (UTC)Reply
Update #2:
I changed line 457 in "CIForms/includes/specials/CIFormsManage.php" to:
GROUP BY ciforms_submissions.id, ciforms_submissions.page_id, ciforms_submissions.title
and now i can view the results! So it seems to be working now. YahboobayYahboobay (talk) 21:30, 25 February 2022 (UTC)Reply
@YahboobayYahboobay thanks for reporting, so the issue is related to camelcase table names, right ? Thomas-topway-it (talk) 15:26, 26 February 2022 (UTC)Reply
@Thomas-topway-it, Sorry that my comments may have been hard to follow, I wasn't able to properly format the update comments. To summarize, in the end, there were four things to get it working with Postgres:
  1. The two .sql files had to be translated from Mysql to Postgres. (CIForms_submissions.sql and CIForms_submissions_groups.sql)
  2. Then there's the capitalization issue (postgres apparently defaults to lower case) which required changing all sql references to the database table "CIForms_..." to "ciforms_..." (in CIFormsManage.php and CIFormsSubmit.php)
  3. Finally one small change to line 457 in CIFormsManage.php made an "ERROR: column must appear in the GROUP BY clause or be used in an aggregate function" error go away. This was changing GROUP BY ciforms_submissions.page_id, ciforms_submissions.title to GROUP BY ciforms_submissions.id, ciforms_submissions.page_id, ciforms_submissions.title
  4. adjust the if statement on line 130 of CIForms.php which checks for mysql before proceeding
Hopefully that helps? Thank you for the great work on this extension! YahboobayYahboobay (talk) 16:36, 7 March 2022 (UTC)Reply
@YahboobayYahboobay thanks for your notes, I've included them in the latest version. Can you check that everything work fine on your side ? You'll also find the full list of new features in the main page of the extension. Thomas-topway-it (talk) 08:53, 25 July 2022 (UTC)Reply

Problem with install, recieving error.

edit

I'm receiving the following error: [Yhmlbwo4R_Yu6pqZqcYh0gAB1Ao] 2022-02-26 03:58:39: Fatal exception of type "Wikimedia\Rdbms\DBQueryError"

During install I was not able to get this command to execute "php maintenance/update.php" , but the extension is showing installed in the mediawiki install. I may not have "submission groups = STUFF HERE" and "$wgCIFormsSubmissionGroups" configured properly. I cannot find anything on the format of users, such as is the list comma delimited, etc.

For further information, I'm using the HostGator service for hosting. JackKE4LWT (talk) 04:25, 26 February 2022 (UTC)Reply

@JackKE4LWT if you cannot run the command "php maintenance/update.php" you need to run directly the sql to create tables in your database, either from console or through phpmyadmin. (just copy/paste the content of the files in the sql folder in the sql tab of phpmyadmin and execute it) Thomas-topway-it (talk) 15:29, 26 February 2022 (UTC)Reply
Thank you. I ran those two files (CIForms_submissions.sql and CIForms_submissions_groups.sql) and got a lot of green checks, which I'm assuming is good thing, but I'm still getting errors. The form loads and displays well, but still that flippin' error!
I have no idea if this is correct or not, but this is the section from the LocalSettings.php
wfLoadExtension( 'CIForms' );
$wgCIFormsSenderEmail= 'address@gmail.com';
$wgCIFormsSenderName= 'DEC_EC Reports';
$wgCIFormsSubmitEmail= 'address@gmail.com';
$wgCIFormsSubmissionGroups= 'user1 user2';
And this is the submit lines in the form:
{{#CI form: title = Monthly DEC/EC Report
| submission groups = user1 73.152.111.40 (talk) 21:50, 26 February 2022 (UTC)Reply
@JackKE4LWT submission groups is comma separated. I'm not sure this solves the issue, "Wikimedia\Rdbms\DBQueryError" seems a generic error, can you activate the debug and post further details ? Thomas-topway-it (talk) 16:04, 27 February 2022 (UTC)Reply

Design Problem

edit

I have mediawiki 1.35.5 installed and I installed the latest 1.2.1 version of the extension.

When I enter the codes, I have the forms and they are working correctly, but their design is as simple as possible and not at all like the pictures.

What is my problem? I had this extension on 1 MW 1.37.1 on a localhost and the graphic design was ok


thnx Idris, the wise (talk) 10:00, 9 March 2022 (UTC)Reply

@Idris, the wise it could be related to the css, which is not loading. Do you have a screenshot or a link or can you check that the css load correctly ? (for instance hard-refreshing the browser) Thomas-topway-it (talk) 12:37, 9 March 2022 (UTC)Reply
[SOLVED]
Update:
I copied the contents of Style.css (found in /extensions/CIForms/resources/style.css) inside the /index.php/MediaWiki:Common.css.
It is working now
@Thomas-topway-it thanks for the tip to the css load problem Idris, the wise (talk) 06:16, 10 March 2022 (UTC)Reply
hello @Idris, the wise, I think it's related to the skin chameleon, the resources (css and javascript) are not loading, you can add them manually or I will check it as soon as possible Thomas-topway-it (talk) 08:32, 10 March 2022 (UTC)Reply
@Thomas-topway-it
but I found that this problem reoccurred with other skins too.
However my issue is solved now
I edited my previous comment. Idris, the wise (talk) 08:35, 10 March 2022 (UTC)Reply
@Idris, the wise but still the Javascript is not loading, so you need to load it in some way Thomas-topway-it (talk) 08:37, 10 March 2022 (UTC)Reply
@Thomas-topway-it I can send messages and there is no error. Idris, the wise (talk) 08:40, 10 March 2022 (UTC)Reply
yes but the validation will not work well Thomas-topway-it (talk) 08:42, 10 March 2022 (UTC)Reply
@Thomas-topway-it
can i load javascript with Common.js as well? Idris, the wise (talk) 08:47, 10 March 2022 (UTC)Reply
perhaps yes, but the Javascript select (for long lists of options) will not work Thomas-topway-it (talk) 08:51, 10 March 2022 (UTC)Reply
@Thomas-topway-it I'll consider it thanks Idris, the wise (talk) 09:21, 10 March 2022 (UTC)Reply
@Idris, the wise that should have been solved in the latest version! there was a mistake in the js and css module declaration, now fixed Thomas-topway-it (talk) 11:05, 14 September 2022 (UTC)Reply

Problem with table name

edit

When i try to read Submissions special page it founds an error because it looks for the table "CIForms_submissions" without the prefix name (in my case: mw_) Brunodapei (talk) 21:30, 24 May 2022 (UTC)Reply

@Brunodapei yes, this is also solved in the latest version Thomas-topway-it (talk) 08:52, 25 July 2022 (UTC)Reply
grazie! Brunodapei (talk) 20:41, 25 July 2022 (UTC)Reply
hello, in which version this is fixed? thanks Saibgs (talk) 11:01, 28 July 2022 (UTC)Reply

Username of submitter

edit

Nice extension, but it REALLY misses the ability to show the username of the form submitter, OR you have forgotten to show how to include it.


It's pretty useless to use it as a site contact form if you don't know the username of whoever submitted it. Ppehrson (talk) 16:36, 6 July 2022 (UTC)Reply

@Ppehrson the extension is meant for external visitors. However I was thinking to add an hidden input field, through which to add arbitrary data, like the username itself (that can be added using a magic word). I will try to add it in the next release Thomas-topway-it (talk) 22:28, 13 July 2022 (UTC)Reply
@Ppehrson I did a major update to CIForms, now it always saves the username of the user who submitted the form. You can check the full list of new features in the main page of the extension Thomas-topway-it (talk) 08:49, 25 July 2022 (UTC)Reply

limiting submissions.

edit

is it possible to limit repeated submissions? like the ability to flag a form to only accept a single submission from a user or IP or whatever 104.136.23.63 (talk) 00:29, 10 July 2022 (UTC)Reply

sorry, I did not see this comment. I think the proper way it's to use Google Recaptcha, $wgCIFormsGoogleRecaptchaSiteKey and $wgCIFormsGoogleRecaptchaSecret Thomas-topway-it (talk) 12:44, 17 July 2022 (UTC)Reply

Submissions page not showing the submitted forms and no notification alerts for the submitted pages

edit

Hello Team.

we are using CIForms extensions 1.38 version.

we are not able to see the submissions on this page : https://*******/index.php/Special:CIFormsManage.

When we installed the extensions, the tables created without prefix( offcourse 1.38v is having tables without prefix) and these tables doesn't get updated with the submitted data.

So i had to manually create tables with prefix ( mw_) and the tables get updated post form submission.

Now, when we check the submission page under Special:CIFormsManage , can't see the submission data..... out of interest i did go and reloaded the data from mw_CIForms* tables to CIForms tables .. then i can see submission data. I think still MW is referring the without prefix tables rather than the tables with prefix.

I see from old tickets that this prefix issue was fixed in master build but it was not released in version, currently the way we setup the MW on k8s is to install the extensions basis the version tag....

Could you please help me on how to fix the issue ? will I need to update any config to tell MW to use prefix tables.

Thanks

Sainath Saibgs (talk) 11:36, 28 July 2022 (UTC)Reply

I have downloaded master build and it works fine, but i cannot download the form from submissions page is this some issue in the code ? Saibgs (talk) 12:31, 28 July 2022 (UTC)Reply
@Saibgs yes, so the branch 1.38 is the old version, it should be deleted. This is the latest version
https://extdist.wmflabs.org/dist/extensions/CIForms-master-25abc20.tar.gz
I don't understand this passage "cannot download the form from submissions page is this some issue in the code ?" can you be more precise and to post the error message ? You mean the export button ? Thomas-topway-it (talk) 17:35, 28 July 2022 (UTC)Reply
@Thomas-topway-it
Thanks for the update, yes i used the CIForms-master* and it is working fine.
under the submissions page -> we can see the submitted forms here --> click on action:view , where you can see all forms and download them..but sometimes the download button is not working if i refresh then it works.Unable to attach the screenshot.
Also, i wanted to use email notification to be sent when every there is a form submission done, i am using this ($wgCIFormsEmailTo) parameter in the localsettings.php but it is not working. i have smtp configured and working fine but not the submission alerts. Saibgs (talk) 13:15, 29 July 2022 (UTC)Reply
@Saibgs regarding email notification you have to run composer update --no-dev inside the folder extensions/CIForms, regarding the issue with the download button I'm not sure, it does not depend by Javascript so page reload shouldn't affect Thomas-topway-it (talk) 08:50, 30 July 2022 (UTC)Reply
Thnaks @Thomas-topway-it.
Below are the results after ruunning the composer update --no-dev
php /tmp/composer.phar update --no-dev
931Loading composer repositories with package information
932Info from https://repo.packagist.org: #StandWithUkraine
933Updating dependencies
934Lock file operations: 0 installs, 6 updates, 0 removals
935 - Downgrading psr/container (2.0.2 => 1.1.2)
936 - Downgrading psr/log (2.0.0 => 1.1.4)
937 - Upgrading symfony/console (v5.4.10 => v5.4.11)
938 - Downgrading symfony/deprecation-contracts (v3.1.1 => v2.5.2)
939 - Downgrading symfony/service-contracts (v3.1.1 => v2.5.2)
940 - Downgrading symfony/string (v6.1.2 => v5.4.11)
941Writing lock file
942Installing dependencies from lock file
943Nothing to install, update or remove
944Generating autoload files
and added $wgCIFormsEmailTo to the localsetting.php.
But i don't see any email received after submitting a test form. Do i need to change/update any config ?
Thanks Saibgs (talk) 09:15, 1 August 2022 (UTC)Reply
ok, let me check ... Thomas-topway-it (talk) 10:16, 1 August 2022 (UTC)Reply
@Saibgs It should have been solved, you can replace directly this file https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/CIForms/+/b50b5aac0e1d67fb7352a820efcc45309b8fe213/includes/specials/CIFormsSubmit.php Thomas-topway-it (talk) 07:39, 4 August 2022 (UTC)Reply
@Thomas-topway-it , Thanks for updating the code.
I cannot edit the file due to some restrictions inside the pod.
I did use the updated build from here : https://extdist.wmflabs.org/dist/extensions/CIForms-master-b50b5aa.tar.gz
But I don't see any email triggering post update.
No specific error from debug.log Saibgs (talk) 09:34, 5 August 2022 (UTC)Reply
hello @Saibgs it seems the right branch, so if you are using it or you have replaced the file includes/specials/CIFormsSubmit.php it should work fine.
Can you ensure that this line
$local = preg_split( "/\s*,\s*/", $local, -1, PREG_SPLIT_NO_EMPTY );
is present ?
If so, and still it does not work, can you insert
var_dump($submit_valid);
before the first occurrence of
$success = false;
in the same file. This should inform you if the email has been correctly parsed. Also, can you send your configuration (limited to the CIForms parameters in LocalSettings.php) to thomas.topway.it@mail.com so I can check it ? Thomas-topway-it (talk) 10:29, 5 August 2022 (UTC)Reply
Hello @Thomas-topway-it ,
Sorry for delay.
Below is the part of code after insert "var_dump($submit_valid);"
foreach ( $formSubmit as $email ) {
var_dump($submit_valid);
if ( Sanitizer::validateEmail( $email ) ) {
$submit_valid[] = $email;
}
}
$success = false;
also, I have sent a email ( from: saichi@bgs.ac.uk ) with limited to CIForms.
after adding all the bit in the code, I tested a submission and got below error.
Error:
/var/www/html/Special:CIFormsSubmit, referer: https://SITE/index.php/Feedback                                            │
│ sh: 1: /usr/sbin/sendmail: not found                                                      
I did see the same error before when I was testing forgot password functionality where "set_include_path('/opt/www-scripts')" in Localsettings.php was causing the problem and after removing it resolved the issue. Not sure why i am seeing that again.
Thanks
Sainath Saibgs (talk) 08:35, 10 August 2022 (UTC)Reply
what is the output of var_dump($submit_valid); ?
by the way it seems a server config error, related to sendmail, are you able in general to send email with your server ? Thomas-topway-it (talk) 09:21, 10 August 2022 (UTC)Reply
hello @Thomas-topway-it,
Sorry for delay, not able to progress on this issue as i am getting on 504 gateway time out once i clock on submit on feedback form. all my network is allowed and no restrictions but still i see this issue stopping me to debug the email alerts. Saibgs (talk) 14:14, 17 August 2022 (UTC)Reply
It could be related to PhpMailer
https://github.com/PHPMailer/PHPMailer
perhaps can you create a separate script and try to send an email manually ? (through the script) so you know if it is related to PhpMailer on your system Thomas-topway-it (talk) 20:44, 17 August 2022 (UTC)Reply

PDF no longer contains field descriptions?

edit

I recently updated my mediawiki to 1.38.2, and updated CIForms to the CIForms-master-b50b5aa version.

I've noticed when forms are submitted now, the field descriptions no longer display in the PDF?

For example, I have a form that's is the following:

{{#CI form: title = Testing Suggestion Form | {{#CI form section: type = inputs | [Full Name=text] *}}


Previously the PDF that was emailed would say:


Full Name [ Jason Hollinden ]


But now it just shows as:


[Jason Hollinden]


Has this feature moved to a configuration that I'm missing? Jhollinden (talk) 15:22, 10 August 2022 (UTC)Reply

Actually I figured this out. It's when using the Placeholder style of form vs standard. So
Full Name [] * ("Full Name" will display on PDF)
[Full Name] * ("Full Name" wil not display on PDF) Jhollinden (talk) 15:43, 10 August 2022 (UTC)Reply
thanks, I will check Thomas-topway-it (talk) 09:16, 11 August 2022 (UTC)Reply
@Jhollinden fixed in the latest version ! Thomas-topway-it (talk) 11:03, 14 September 2022 (UTC)Reply

List of input types?

edit

I'm not seeing a list of input types available? From the examples I've seen textarea, email, number, and tel. The tel one doesn't seem to do anyting? Just wanted to see if there was a full list of options for input types?


Thanks! Jhollinden (talk) 20:44, 10 August 2022 (UTC)Reply

currently textarea and select are rendered separately, while the other ones, like text, email, date, etc. are rendered as a standard input with the chosen type. You can find here a list
https://www.w3schools.com/html/html_form_input_types.asp
so it mainly depends by the browser, date works well, I haven't tested all of them, with "tel" the browser should prevent to insert letters ? (of course using "submit", "button", or "checkbox" does not make sense, perhaps I have to filter/restrict the list, while "file" could be added in future) Thomas-topway-it (talk) 09:22, 11 August 2022 (UTC)Reply

Can both this extension & Page Forms be on the same wiki?

edit

My question sums it up. Christharp (talk) 19:23, 2 September 2022 (UTC)Reply

sure, you can check here Manual:Forms for an overview, the two extensions cover different needs Thomas-topway-it (talk) 22:26, 2 September 2022 (UTC)Reply

Configuration instructions for notifications

edit

I didn't want to directly edit it, but the Configuration section instructions read:

Insert the following code after wfLoadExtension( 'CIForms' ); in LocalSettings.php (this facilitates setting the global variables listed below)

define( 'CIFORMS_VALUE_IF_NULL', 0 );
define( 'CIFORMS_VALUE_OVERRIDE', 1 );
define( 'CIFORMS_VALUE_APPEND', 2 )

That last line needs a closing semicolon (I think? w/o it it broke my site) School4schools (talk) 18:39, 30 October 2022 (UTC)Reply

thanks, fixed Thomas-topway-it (talk) 18:47, 30 October 2022 (UTC)Reply

Email notification settings clarification

edit

Doing my best to follow instructions for installation/ configuration. I've run the terminal commands and the form works fine w/ output to the special page.

However, I can't figure out email notification settings.

As best I can understand, the proper place to add the user for default email notifications in the file /extensions/CIForms/includes/CIForms.php ? It's the only place I can find 'email to' => null. I changed the null to 'username' but it doesn't produce an email. (I have $wgEnableEmail enabled, and I assumed the terminal command installed PHPmailer (per composer update --no-dev inside the folder extensions/CIForms)

The /extensions/CIForms/vendor/phpmailer seems to have installed ok.

Many thanks for your help. I'm code illiterate and just want my wiki to function properly -- your extension will be a great asset for it. Here for my wiki https://school4schools.wiki School4schools (talk) 18:49, 30 October 2022 (UTC)Reply

no, it's in LocalSettings.php, as follows:
$wgCIFormsEmailTo = 'your email address'; Thomas-topway-it (talk) 19:03, 30 October 2022 (UTC)Reply
Tks for quick reply. That function didn't show in LocalSettings.php I added it manually on last line, but it still doesn't work. So I have now in LocalSettings.php :
wfLoadExtension( 'CIForms' );
define( 'CIFORMS_VALUE_IF_NULL', 0 );
define( 'CIFORMS_VALUE_OVERRIDE', 1 );
define( 'CIFORMS_VALUE_APPEND', 2 );
$wgCIFormsEmailTo = 'name@domain.com'; School4schools (talk) 21:29, 30 October 2022 (UTC)Reply
hello, yes, it is a parameter, it must be added in LocalSettings.php.
Can you also verify thatwgEnableEmail is set to true and the wiki has been already configured for sending emails ? Thomas-topway-it (talk) 08:15, 31 October 2022 (UTC)Reply
That setting is "true" but when I ran a test an email via the special page http://YOURWIKIURL/index.php?title=Special:EmailUser/ it returned a php error. I ran some Cpanel tests and reset DNS, so will see if that changes the behavior by tomorrow. Tks for your help. School4schools (talk) 20:55, 31 October 2022 (UTC)Reply
Thank you for your help. I had my host verify email functionality, and they ended up screwing up the DNS... ugh. Now a few weeks later, I fixed it myself w/ full site email functionality, but email still not working on the wiki. So I followed the email troubleshooting guide: Manual:$wgSMTP - MediaWiki to replace the default settings in LocalSettings.php $wgEmergencyContact = "apache@🌻.invalid"; and $wgPasswordSender = "apache@🌻.invalid"; w/ the admin email and it's all working now. Thank you! School4schools (talk) 16:42, 18 November 2022 (UTC)Reply
great ! you may also take a look to this extension to complete your website Extension:PageProperties Thomas-topway-it (talk) 17:36, 19 November 2022 (UTC)Reply

Sending Email to the form-sender

edit

Is there a way to also send the pdf-form to the user who filled the formula?


I shy away from editing the extention code directly but I think there is no other way?

Can you help me with that? Parzival1200 (talk) 09:41, 8 March 2023 (UTC)Reply

I solved it...
I added th the CIFormsSubmit.php on line 137 this:
if ($user->getEmail() !== '') {
        $mail->addAddress( $user->getEmail() );
        }
Now the Mail es sent to the user who filld the formula if he/she is loggend-in and has a email-adress in user. may be not the best solution but works Parzival1200 (talk) 10:33, 14 March 2023 (UTC)Reply
@Parzival1200 thank you, I will take it into account at the next release Thomas-topway-it (talk) 20:44, 15 March 2023 (UTC)Reply
@Parzival1200 added in the latest version (1.3.2) thank you! Thomas-topway-it (talk) 15:39, 28 July 2024 (UTC)Reply

uploading pictures and documents to the form

edit

May be it is possible to add a attach-button to add documents or pictures to the form. It would be great if a user can attach files. They can be safed may be in the DB or in the filesystem, I think DB would be much easier.

But I don't know if I can do that on my own... Parzival1200 (talk) 09:44, 8 March 2023 (UTC)Reply

hello @Parzival1200 I can do little improvements on my own like to send the attachment to the user as well, for more significant improvements can you use this form ? https://wikisphere.org/wiki/CIForms_feature_request
thank you Thomas-topway-it (talk) 15:13, 9 March 2023 (UTC)Reply

Error 504 when trying to submit CI Form data and no Email Notifications

edit

Hi,

Just to give you some context before I lay out the issues, our organisation has enabled the extension CIForms for users to submit feedback data as a feedback form. Composer updates are run on all folders within the extensions/ folder before the site is deployed. This MediaWiki site uses MySQL for its database. The composer.local.json file even contains the latest phpmailer version (^6.5) and a few other dependencies. The way I run composer is I download composer-2 in a shell script, self-update, update --no-dev -o, install --no-dev -o and then remove the composer instance. Every extension uses the REL1_39 package because this site's MediaWiki version is 1.39.2 and uses PhP 8.1. The site is even setup to send emails when users request accounts to the admin, and it works. It even sends back a temp password to the user to sign up, once the admin approves the user. So SMTP is setup properly as well.


#Issue 1

Currently, when testing out the feedback form as admin, I fill out the form and hit submit. The page takes a long time to load and then times out with a "504 Error".

When I check the Special:CIFormsManage page, I can see that the form has been submitted. I'm able to view and download the PDF as well. But I'm not sure why the page times out when Submit is clicked. I've done a Network inspect, but Special:CIFormsSubmit just seems to be in a pending state before throwing a 504 Gateway Timeout Nginx error.

I've checked the Nginx logs and the error on Timeout is as follows: [error] 35#35: *226301113 upstream timed out (110: Operation timed out) while reading response header from upstream, client: <Masked_IP_Address>, server: <Masked_DNS_Address>, request: "POST /index.php/Special:CIFormsSubmit HTTP/1.1".

#Issue 2

Although the feedback form data seems to be present on the Special:CIFormsManage page and can be downloaded, an email doesn't seem to be sent to the admin. As stated above, emails for account requests work, so SMTP is configured correctly in LocalSettings.php and $wgEnableEmail = true as well as $wgEnableUserEmail = true. Even under the wfLoadExtension( 'CIForms' ) line, $wgCIFormsSenderEmail is set to the admin's email as well as $wgCIFormsEmailTo. Even PhPMailer is set to its latest version.

Not sure why the admin nor I receive emails on submission of these feedback forms.

Any help will do please! Thanks in advance! Tarunjoseph93 (talk) 11:18, 13 March 2023 (UTC)Reply

@Tarunjoseph93 thanks for the detailed explanation. I've not much experience with the use of CIForms in conjunction with Nginx, however it could be an issue related to the PhpMailer and Nginx interaction. After googling quickly I've found the following:
https://stackoverflow.com/questions/27945676/phpmailer-is-causing-504-timeout-error-on-my-digital-ocean-server-using-nginx#:~:text=The%20504%20you're%20getting,you're%20getting%20no%20feedback.
https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Not sure if it does solve the issue but your description matches the workflow: the Special page SubmitForms first saves the submission data in the database and following sends the email, so it seems it just halts at this 2nd step.
Just keep me updated if playing with the troubleshooting fixes the issue.
(Thomas) Thomas-topway-it (talk) 20:42, 15 March 2023 (UTC)Reply

Problem with text formatting in Czech language

edit

Hi,

I want to inform you about an issue I encountered with the CIForms extension, specifically related to text formatting in the Czech language.

After viewing the source code, I discovered that a particular line was causing problems with text formatting in Czech. It is caused by this line in CIFormsSubmit.php:

$mail->CharSet = "text/html; charset=UTF-8;";

After changing it to $mail->CharSet = "UTF-8"; the text is formatted correctly for both subject and e-mail message.

Is it possible to fix it? Jachym16 (talk) 09:17, 17 July 2023 (UTC)Reply

hello @Jachym16, ok, I will do a commit as soon as possible with this patch and the request below. Thomas-topway-it (talk) 11:19, 18 July 2023 (UTC)Reply
That is great. Thank you for the quick reply. Jachym16 (talk) 17:01, 18 July 2023 (UTC)Reply

Added a second database table, changed mail body filled with form data

edit

I added a second databasetable defined in LocalSettings, because I needed to export a cleaner Json with only selected fields an less dataoverhead. it is checked whether the database exists, if not it is created, if that fails nothing is done.

I am not very familiar with coding in mediawiki extensions nor in php. May be you want to take a look https://github.com/marcwoge/mediawiki-extensions-JSonForms (I only edited CIFormsSubmit.php) Would appreciate any feedback.

Created some new functions:

- createJson

- updateDBsecondtable

- create_output

and made a few changes to function execute()


I will need to clean up the email-body as it looks not really nice (it's only the pdf html with all the missing css) .

My next steps are to add a new Inputtype (email to/cc/bcc). Making it possible to submit the form anonymously with a Inputfield and as a form setting. Parzival1200 (talk) 07:05, 8 August 2023 (UTC)Reply

Page status indicators after upgrading MediaWiki

edit

I had our MediaWiki software updated from 1.35 to 1.39. After the upgrade, the number "1" started appearing on all our wiki pages that use CIForms, in the top right corner of the page, in the title line.

<div class="mw-indicators">
<div id="mw-indicator-ciform" class="mw-indicator"><div class="mw-parser-output">1</div></div>
</div>

Apparently, this is a page status indicator. Any tips how to turn it off? I guess I could hide it via CSS. Cru121 (talk) 10:17, 24 October 2023 (UTC)Reply

You should locate the indicator in the page source (or template) and remove it from the page. Hiding it with CSS is just hiding the problem, not solving it. Ciencia Al Poder (talk) 10:23, 24 October 2023 (UTC)Reply
Neither the page source nor the template adds the indicator. Even a brand new page with the following code displays it.
{{#CI form: title = Hello world}}
Cru121 (talk) 10:59, 24 October 2023 (UTC)Reply
I don't know what's #CI form and what it does. Can you create a page with *only* Hello world?
Also, what extensions have you installed? Maybe one of the extensions is adding it Ciencia Al Poder (talk) 13:41, 24 October 2023 (UTC)Reply
@Cru121 and @Ciencia Al Poder I'm sorry for the delay, I plan to publish a version that solves the issue as soon as possible, with some new feature Thomas-topway-it (talk) 21:02, 20 November 2023 (UTC)Reply
@Cru121 it should be fixed with the latest version (1.3.2) ! Thomas-topway-it (talk) 15:38, 28 July 2024 (UTC)Reply

Specify multiple groups for Special:CIFormsManage

edit

I'm trying to set global access to the form management page via $wgCIFormsDataAccess. I see that the groups here are supposed to be comma separated, but I can't seem to figure out exactly how to get it to work. No matter what I specify in my LocalSettings.php, form visibility still defaults to sysop (which isn't even a valid group on my installation.)

EG:

$wgCIFormsDataAccess = array ( 'cubey', 'owner', 'admin', 'mod', 'support' );

BakiDance1 (talk) 23:33, 23 November 2023 (UTC)Reply

Problem with formatting Czech characters inside PDF

edit

Hi,  I have a problem with exporting the forms data into PDF. Not all Czech characters inside the PDF are formatted correctly. I found out that it is the text font that is causing this issue. I found a font that fixes the problem. The solution is to add the line of code from below into createPDF function, inside the $form_output_html variable, inside <style>. After that, all Czech characters are formatted correctly.

$form_output_html .= '* { font-family: DejaVu Sans, sans-serif; }'; Jachym16 (talk) 12:05, 4 December 2023 (UTC)Reply

@Jachym16 added in the latest version (1.3.2) thank you ! Thomas-topway-it (talk) 15:37, 28 July 2024 (UTC)Reply

CIForms support MW 1.39 ?

edit

When we click the Download lick, it only show the 1.40, 1.41 and Master (latest development version) .

Which one that I should choose for MW 1.39 ? Lotusccong (talk) 09:23, 5 February 2024 (UTC)Reply

I think always master, unfortunately the extension does not work on MW 1.41.0. I planned to do a general update of it but had other priorities meanwhile @Lotusccong Thomas-topway-it (talk) 10:06, 5 February 2024 (UTC)Reply
Will look forward to update to MW 1.4+ Great and much appreciated extension! School4schools (talk) 19:16, 14 February 2024 (UTC)Reply
hello @School4schools thanks for your feedback, if you have a public use-case I can post it on the extension's page Thomas-topway-it (talk) 05:44, 15 February 2024 (UTC)Reply
My site is www.school4schools.wiki I was interested in CIF forms for contact forms (I turned them off bc of spam) and quizzes for classes. I haven't implemented them yet, as this is a long-term, side-project. I do need to update to 1.41 for certain new features it brings, including for mobile viewing via MobileFrontend extension, which doesn't work w/ 1.39.
So I'm not a priority, but letting you know you have a great extension! School4schools (talk) 18:31, 18 February 2024 (UTC)Reply
@School4schools @Lotusccong the latest version (1.3.2, master) should work with recent versions of Mediawiki as well ! Thomas-topway-it (talk) 15:36, 28 July 2024 (UTC)Reply

dompdf/dompdf SSRF issue

edit

Hi. CIForms currently has a Composer dependency on dompdf/dompdf 1.x which is affected by CVE-2022-0085, CVE-2022-41343, CVE-2023-23924 and CVE-2023-50262. Please consider upgrading to dompdf 2.x. Taavi (talk!) 12:18, 6 February 2024 (UTC)Reply

thank you, I will do at the next update of the extension Thomas-topway-it (talk) 13:25, 24 February 2024 (UTC)Reply
@Taavi fixed in the latest version (1.3.2), thanks a lot! Thomas-topway-it (talk) 15:34, 28 July 2024 (UTC)Reply

Cannot load Special:CIFormsManage or Special:SpecialPages (500 error)

edit

I currently have the 1.39 package for CI Forms running on MediaWiki 1.41. I've had this issue even when MediaWiki was at version 1.39. Basically when I load the pages Special:CIFormsManage or Special:SpecialPages, I get the following errors:

[562694b55f00e86faf703aa2] /index.php/Special:CIFormsManage Error: Class "MediaWiki\Navigation\PrevNextNavigationRenderer" not found Backtrace: from /var/www/html/extensions/CIForms/includes/specials/PrevNextNavigationRendererCIForms.php(24)

  1. 0 /var/www/html/extensions/CIForms/includes/specials/CIFormsManage.php(24): include_once()
  2. 1 /var/www/html/includes/AutoLoader.php(221): require(string)
  3. 2 [internal function]: AutoLoader::autoload(string)
  4. 3 /var/www/html/vendor/wikimedia/object-factory/src/ObjectFactory.php(285): class_exists(string)
  5. 4 /var/www/html/vendor/wikimedia/object-factory/src/ObjectFactory.php(174): Wikimedia\ObjectFactory\ObjectFactory::validateSpec(string, array)
  6. 5 /var/www/html/vendor/wikimedia/object-factory/src/ObjectFactory.php(149): Wikimedia\ObjectFactory\ObjectFactory::getObjectFromSpec(string, array)
  7. 6 /var/www/html/includes/specialpage/SpecialPageFactory.php(1474): Wikimedia\ObjectFactory\ObjectFactory->createObject(string, array)
  8. 7 /var/www/html/includes/MediaWiki.php(304): MediaWiki\SpecialPage\SpecialPageFactory->getPage(string)
  9. 8 /var/www/html/includes/MediaWiki.php(960): MediaWiki->performRequest()
  10. 9 /var/www/html/includes/MediaWiki.php(613): MediaWiki->main()
  11. 10 /var/www/html/index.php(50): MediaWiki->run()
  12. 11 /var/www/html/index.php(46): wfIndexMain()
  13. 12 {main}

Not sure how to resolve this as no forums online seem to address this issue. Any help would be appreciated. Tarunjoseph93 (talk) 14:06, 15 February 2024 (UTC)Reply

@Tarunjoseph93 since MW 1.41 the class PrevNextNavigationRenderer has been removed, as a consequence CIForms is not currently compatible with MW 1.41. I have scheduled to do a general maintenance of the extension, but I don't have yet an ETA. If you need urgent support you can contact me by email Thomas-topway-it (talk) 17:55, 15 February 2024 (UTC)Reply
Does this mean I need to revert my MW version to 1.40 or 1.39? Tarunjoseph93 (talk) 09:31, 16 February 2024 (UTC)Reply
unless you can/want disable CIForms, yes Thomas-topway-it (talk) 10:07, 16 February 2024 (UTC)Reply
@Tarunjoseph93 it should be fixed with the latest version (1.3.2) ! Thomas-topway-it (talk) 15:37, 28 July 2024 (UTC)Reply

Just Installed on 1.41

edit

Hi, I just installed this on MW 1.41 without reading this discussion and I've just learned that it isn't compatible with 1.41 yet,

When I go to Tools -> Special Pages I get an error now and cannot view those pages'

[3ea6e9ec6c538d7cf9d141aa] 2024-03-01 14:01:37: Fatal exception of type "Error".

If I disable the plugin in LocalSettings.php I can then view the special pages again.

I'm not sure what I should do? I'm concerned it's permanently damaged my install in some way. What is the recommended course of action?

Also when I ran the maintainance/update.php It seemed to run ok but there was a warning that I should have executed maintainance/run.php instead. Could this be the problem?

Thanks. Findjam (talk) 14:08, 1 March 2024 (UTC)Reply

I've just looked in the error log:
[01-Mar-2024 14:16:40 Europe/London] PHP Deprecated:  Use of ParserOutput::getFlag was deprecated in MediaWiki 1.38. [Called from CIForms::onOutputPageParserOutput in <snipped>/extensions/CIForms/includes/CIForms.php at line 79] in <snipped>/includes/debug/MWDebug.php on line 386 Findjam (talk) 14:22, 1 March 2024 (UTC)Reply
hello @Findjam if you just comment it on LocalSettings there won't be any kind of damage to the MW installation. Just, currently it does not work on MW 1.41, I don't still have an ETA for this but you can contact me directly for specific support Thomas-topway-it (talk) 18:29, 1 March 2024 (UTC)Reply
Hi Thomas,
Thanks for the reply. No problem at all. I have done that and I just rolled back the DB a few hours just to be on the safe side. No harm done.
Look forward to the update as this really does seem to be the best and most feature rich Form extension, unless I've missed something. If I find some time I may roll my sleeves up and take a look, possibly create a PR on GitHub. Findjam (talk) 19:13, 1 March 2024 (UTC)Reply
there is also the following Extension:VisualData Thomas-topway-it (talk) 22:49, 1 March 2024 (UTC)Reply
@Findjam the latest version (1.3.2) should work with recent versions of Mediawiki as well ! Thomas-topway-it (talk) 15:33, 28 July 2024 (UTC)Reply

CIForms support reCAPTCHA V2/V3 ?

edit

I have the isnert the secret and site key in the $wgCIFormsGoogleRecaptchaSiteKey and $wgCIFormsGoogleRecaptchaSecret .

The form only show the text "form protected using Google recaptcha" without render the widget on the page. I used reCAPTCHA V2 and V3 both has the same issues.

Did I missed out anything steps to enable the form to support reCAPTCHA ? Lotusccong (talk) 05:43, 3 April 2024 (UTC)Reply

Hi, reCAPTCHA V3 works in the background. It checks the user's score and based on that decides whether to send the form or not. I believe the default score is set to 0.5. Jachym16 (talk) 11:39, 11 April 2024 (UTC)Reply

reCAPTCHA token timeout

edit

Hi, I use reCAPTCHA V3 in CIForms for users to fill out their requests. Recently, users started to complain about errors when sending the form. It turned out the error is timeout-or-duplicate. Since the token is generated once the page is loaded and its lifetime is just 2 minutes, it can take more time for users to fill out the form. So far, I fixed it by calling the function that generates the captcha token every 90 seconds. The change was made in resources/validation.js. The patch is below. Is there any chance to fix this?

--- validation.js 2024-04-10 08:33:50.225438151 +0200

+++ validation_new.js 2024-04-10 08:33:43.701502919 +0200

@@ -35,6 +35,34 @@

.replace( />/g, '\x3E' );

}

+  function executeRecaptchaValidation() {

+    var site_key = mw.config.get('ci_forms_google_recaptcha_site_key');

+

+    mw.loader.getScript('https://www.google.com/recaptcha/api.js?render=' + site_key)

+        .then(

+            function () {

+                if ($('input[name="g-recaptcha-response"]').length) {

+                    grecaptcha.ready(function () {

+                        grecaptcha.execute(site_key, { action: 'validate_captcha' })

+                            .then(function (token) {

+                                $('input[name="g-recaptcha-response"]').val(token);

+                            })

+                            .catch(function (error) {});

+                    });

+                }

+            },

+            function (e) {

+                mw.log.error(e.message);

+            }

+        );

+  }

+

+  executeRecaptchaValidation();

+  // Obnoveni recaptcha tokenu kazdych 90 vterin

+  setInterval(executeRecaptchaValidation, 90 * 1000);

+

+

+  /*

var site_key = mw.config.get( 'ci_forms_google_recaptcha_site_key' );

mw.loader

@@ -57,6 +85,8 @@

}

);

+  */

+

$( '.ci_form' ).each( function ( index ) {

var paging = $( this )

.find( 'input[type=hidden][name=form_paging]' ) Jachym16 (talk) 11:49, 11 April 2024 (UTC)Reply

@Jachym16 thanks a lot! added in latest version (1.3.2) Thomas-topway-it (talk) 15:30, 28 July 2024 (UTC)Reply
Hi,
Thank you for resolving that issue. However, it turned out to be a temporary solution for me. Since the form is placed on a landing page, it generated a large number of unwanted reCaptcha tokens. Recently, reCaptcha started to give everyone a score of about 0.1 (though I'm not sure if it's related).
I believe the best solution would be to request the token only when the Submit button is pressed. Please find the patch file below.
Thanks, Jáchym
--- validation.js	2024-07-08 10:54:01.464233524 +0200
+++ validation.js.new	2024-07-08 11:04:26.478076333 +0200
@@ -35,21 +35,29 @@
 			.replace( />/g, '\x3E' );
 	}
 
+
   function executeRecaptchaValidation() {
     var site_key = mw.config.get('ci_forms_google_recaptcha_site_key');
 
-    mw.loader.getScript('https://www.google.com/recaptcha/api.js?render=' + site_key)
+    return mw.loader.getScript('https://www.google.com/recaptcha/api.js?render=' + site_key)
         .then(
             function () {
-                if ($('input[name="g-recaptcha-response"]').length) {
-                    grecaptcha.ready(function () {
-                        grecaptcha.execute(site_key, { action: 'validate_captcha' })
-                            .then(function (token) {
-                                $('input[name="g-recaptcha-response"]').val(token);
-                            })
-                            .catch(function (error) {});
-                    });
-                }
+                return new Promise((resolve, reject) => {
+                    if ($('input[name="g-recaptcha-response"]').length) {
+                        grecaptcha.ready(function () {
+                            grecaptcha.execute(site_key, { action: 'validate_captcha' })
+                                .then(function (token) {
+                                    $('input[name="g-recaptcha-response"]').val(token);
+                                    resolve();
+                                })
+                                .catch(function (error) {
+                                    reject(error);
+                                });
+                        });
+                    } else {
+                        resolve();
+                    }
+                });
             },
             function (e) {
                 mw.log.error(e.message);
@@ -57,35 +65,6 @@
         );
   }
 
-  executeRecaptchaValidation();
-  // Obnoveni recaptcha tokenu kazdych 90 vterin
-  setInterval(executeRecaptchaValidation, 90 * 1000);
-
-
-  /*
-	var site_key = mw.config.get( 'ci_forms_google_recaptcha_site_key' );
-
-	mw.loader
-		.getScript( 'https://www.google.com/recaptcha/api.js?render=' + site_key )
-		.then(
-			function () {
-				if ( $( 'input[name="g-recaptcha-response"]' ).length ) {
-					grecaptcha.ready( function () {
-						grecaptcha
-							.execute( site_key, { action: 'validate_captcha' } )
-							.then( function ( token ) {
-								$( 'input[name="g-recaptcha-response"]' ).val( token );
-							} )
-							.catch( function ( error ) {} );
-					} );
-				}
-			},
-			function ( e ) {
-				mw.log.error( e.message );
-			}
-		);
-
-  */
 
 	$( '.ci_form' ).each( function ( index ) {
 		var paging = $( this )
@@ -425,5 +404,16 @@
 				return false;
 			}
 		}
+    
+    // zabrani odeslani formulare - provede se manualne po validaci recaptcha
+    evt.preventDefault();
+
+    executeRecaptchaValidation().then(() => {
+        this.submit(); // submit formulare
+    }).catch(() => {
+        alert('reCAPTCHA validation failed. Please try again.');
+    });
+
+
 	} );
 } );
Jachym16 (talk) 06:04, 30 July 2024 (UTC)Reply
@Jachym16 perhaps this is preferable https://gist.github.com/jonathanstark/dfb30bdfb522318fc819 -- I will check it later Thomas-topway-it (talk) 06:55, 30 July 2024 (UTC)Reply

PrevNextNavigationRenderer in 1.41

edit

Is there any update as to the PrevNextNavigationRenderer error on Special Pages showing up for 1.41 and greater? I can't really downgrade my wiki install but your extension looks great and does exactly what I need in many ways. 8.36.81.1 (talk) 09:16, 19 July 2024 (UTC)Reply

fixed in the latest version (1.3.2) Thomas-topway-it (talk) 15:29, 28 July 2024 (UTC)Reply

Form Submission Error with Google reCAPTCHA

edit

I'm running MediaWiki 1.39.8 LTS with CIForms versions 1.3.0 from the REL1_39 branch on your GitHub, I'm running into the following error trying to implement a mail-in form with Google reCAPTCHA, "Form submission Captcha challenge not found. Please try again or contact admin@mywiki.wiki to receive support", I am using a CSP with the $wgCSPHeader header, it contains the following CSP declarations:


$wgCSPHeader = [

"useNonces" => false,

"script-src" => [

'\'self'',

'https://www.gstatic.com/recaptcha/',

'https://www.google.com/recaptcha/'

],

"default-src" => [

'\'self'',

'https://api.flickr.com'

],

"style-src" => [ '\'self\'' ],

"object-src" => [ '\'none\'' ]

];


And I have the following CIForms Config:


$wgCIFormsSenderEmail = "admin@mywiki.wiki";

$wgCIFormsSenderName = "Admin - My Wiki";

$wgCIFormsMailer = "smtp";

$wgCIFormsSMTPHost = "smtp.company.email";

$wgCIFormsSMTPUsername = "admin@mywiki.wiki";

$wgCIFormsSMTPPassword = "password";

$wgCIFormsSMTPPort - 587;

$wgCIFormsDataAccess = [ "bureaucrat", "administrators", "content-moderators" ];

$wgCIFormsGoogleRecaptchaSiteKey = "key";

$wgCIFormsGoogleRecaptchaSecret = "secret";


The Google ReCAPTCHA secret and site key are valid and I've double checked that, and I'm not sure what could be causing the issue, there's no errors reported in my web console, by apache, by my CSP or anything. Help would very much be appreciated, thanks! Aeyeu (talk) 05:38, 31 July 2024 (UTC)Reply

@Aeyeu first of all can you try to install 1.3.2 ? thank you Thomas-topway-it (talk) 06:41, 31 July 2024 (UTC)Reply
I did that, and it still is giving the same error, however with 1.3.2 I'm getting a composer requirement failure, which you may want to resolve.
"Root composer.json requires dompdf/dompdf ^1.0, ^3.0, found dompdf/dompdf[dev-rtl_language_support_and_computed_css, dev-resource-validation-updates, dev-vertical-align, dev-master, dev-rtl, dev-v2-maintenance, dev-stylesheet-parsing-updates, dev-develop, dev-paging-updates, v0.6.0, ..., v0.8.6, v1.0.0, ..., v1.2.2, v2.0.0, ..., v2.0.8, v3.0.0] but it does not match the constraint." Aeyeu (talk) 07:34, 31 July 2024 (UTC)Reply
that seems strange, since composer requires dompdf/dompdf ^3.0 Thomas-topway-it (talk) 08:30, 31 July 2024 (UTC)Reply
also there is this typo in your settings
 $wgCIFormsSMTPPort - 587; 
Thomas-topway-it (talk) 09:06, 31 July 2024 (UTC)Reply
Yeah I fixed that mistake after searching for solutions, for some reason randomly when I refreshed the page I got a captcha in front of every wiki element and at the top of the page, completing this did nothing to fix the issue, even when disabling my CSP the reCaptcha had failed to generate. Aeyeu (talk) 21:04, 31 July 2024 (UTC)Reply
I think it would be good to support also reCaptcha v2, see here https://stevesohcot.medium.com/php-tutorial-how-to-implement-a-captcha-im-not-a-robot-checkbox-using-google-e8f110590141 and here https://www.mediawiki.org/wiki/Extension%20talk%3ACIForms#h-CIForms_support_reCAPTCHA_V2/V3_%3F-20240403054300 @Lotusccong Thomas-topway-it (talk) 07:51, 1 August 2024 (UTC)Reply
Okay, what does this mean for me? Also are we able to get Cloudflare's Turnstile supported by chance? Aeyeu (talk) 09:27, 1 August 2024 (UTC)Reply
I swapped to reCAPTCHA V3 and I get a different error now, "[972bca6f451455c90a42dbd1] /w/Special:CIFormsSubmit TypeError: htmlspecialchars(): Argument #1 ($string) must be of type string, array given" Aeyeu (talk) 09:33, 1 August 2024 (UTC)Reply

Having trouble with emailing forms (mediawiki REL1_42, CIForms 1.3.2, PHP-8.3)

edit

Hi having trouble with the email feature, for some reason no email is sent. The logs show no errors, but the warnings below are logged on form submission. Config included below:

Any tips on further steps/things to try would be great.

PHP Warning:  Undefined array key " --list_style_type " in /var/www/my.wiki/htdocs/mediawiki/extensions/CIForms/vendor/dompdf/dompdf/src/Css/Style.php on line 1964

PHP Warning:  Undefined array key " --list_style_type " in /var/www/my.wiki/htdocs/mediawiki/extensions/CIForms/vendor/dompdf/dompdf/src/Css/Style.php on line 1971

Config for extension:

#CI Forms setup
wfLoadExtension( 'CIForms' );
$wgCIFormsDataAccess = 'staff' ;
$wgCIFormsSuccessMessage = 'The form has been sent, thank you!';
$wgCIFormsErrorMessage = 'We couldn\'t send your form, please try again or contact the support at  $wgEmergencyContact.';
$wgCIFormsMailer = 'smtp';
$wgCIFormsSMTPHost = 'mail.sameserver.mediawik.uses';
$wgCIFormsSMTPUsername = 'the-user';
$wgCIFormsSMTPPassword = 'password-is-correct';
$wgCIFormsSMTPPort = 25;
$wgCIFormsEmailTo = 'account(at)mywiki';
$wgCIFormsSenderEmail = 'forms(at)mywiki';
$wgCIFormsSenderName = 'Form Submission';
#0 form overrides default, 1 default overrides form, 2 both email addresses
$wgCIFormsDataAccessGlobalMode = 0;
#0 form overrides default, 1 default overrides form, 2 both email addresses
$wgCIFormsEmailToGlobalMode = 0;

Richardpruen (talk) 10:14, 29 November 2024 (UTC)Reply

hello @Richardpruen could you try to combine CIForms with this extension Extension:EmailNotifications ? it offers a more robust UserMailer Thomas-topway-it (talk) 17:19, 29 November 2024 (UTC)Reply
Ok, I will look into that, thanks. Richardpruen (talk) 10:35, 30 November 2024 (UTC)Reply
That gives the following error trying to send email
/mediawiki/index.php/Special:EmailUser Symfony\Component\Mime\Exception\LogicException: The "Reply-To" header must be an instance of "Symfony\Component\Mime\Header\MailboxListHeader" (got "Symfony\Component\Mime\Header\UnstructuredHeader"). Richardpruen (talk) 13:01, 30 November 2024 (UTC)Reply
@Richardpruen can you please try to remove the reply-to clause and check again if it works ? Thomas-topway-it (talk) 15:13, 30 November 2024 (UTC)Reply
(I'm planning to do an update with support for re-captcha 3, which is more transparent, to I will fix those issues as well) Thomas-topway-it (talk) 15:14, 30 November 2024 (UTC)Reply
I tried removing the reply-to but then users cannot send email to each other, I will wait for the fix. Richardpruen (talk) 16:19, 30 November 2024 (UTC)Reply
helli @Richardpruen I've updated both CIForms and EmailNotifications -- the error above (Undefined array key " --list_style_type ") should be fixed, while $wgCIFormsMailer = 'EmailNotifications'; can now be used to send email using EmailNotifications (despite the CIForms mailer should work as well) Thomas-topway-it (talk) 07:40, 2 December 2024 (UTC)Reply
Thanks now I have the following trying to send email to users
/mediawiki/index.php/Special:EmailUser TypeError: Symfony\Component\Mime\Header\Headers::addMailboxListHeader(): Argument #2 ($addresses) must be of type array, string given, called in /var/www/safernicotine.wiki/htdocs/mediawiki/extensions/EmailNotifications/includes/EmailNotifications.php on line 124
Richardpruen (talk) 12:07, 3 December 2024 (UTC)Reply
I have checked but I'm not sure what is causing the error, here https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/CIForms/+/492ce91d2b440c994dfeddf7bcbbf0482a865ece/includes/specials/CIFormsSubmit.php at row 153 the value is an array, so the condition here https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/EmailNotifications/+/265d5dba4b1d287f497ec146760644549b21ad77/includes/EmailNotifications.php row 124 should be met Thomas-topway-it (talk) 19:57, 4 December 2024 (UTC)Reply
That is odd... I will do some digging there, time is limited so it may be a while Richardpruen (talk) 21:16, 4 December 2024 (UTC)Reply
@Richardpruen I have added a little workaround for this https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/EmailNotifications/+/ed33fb4731abe91bf6a23a8674c2263c3935c983%5E%21/ Thomas-topway-it (talk) 19:38, 13 January 2025 (UTC)Reply
Return to "CIForms" page.