tt4ever
Forum Replies Created
-
Yes.
Production URL with plugin version 4.4.3 (includes story_description) –
https://charlestonpickleball.com/news-page/#facebookfeedExample: Search for ‘PERFORMERS’ on production page and compare the production feed post to the development feed post.
Development URL with plugin version 5.2.7 (without story_description) –
https://dev.charlestonpickleball.com/news-page/#facebookfeedNote: Had to modify the feed background color in skin to make the likes count and comments count and shared count (along with their icons) visible. Need to configure a different feed background color before going into production. Other plugin users may benifit from this tidbit of information.
Thanks for your plugin and anything you can do to remedy this situation.
Tom
Forum: Plugins
In reply to: [Send PDF for Contact Form 7] PHP 7.1 with plugin version 0.6.9.Florent,
I was able to successfully upgrade mpdf within version 0.6.9 of
plugin ‘Send PDF for Contact Form 7’.Will you make an official version upgrade of ‘Send PDF for Contact Form 7’
that includes the latest mpdf? If so, I will be able to switch from
PHP 7.0.33 to PHP 7.1.25.Thanks,
Tom——————–
Look at all of #6 below to see the 5 lines of required coding changes to
utilize version 7.1.x of mpdf.Otherwise, here are the high level steps I performed.
1) Create an Xampp test environment (in Windows 10)
2) Clone my production site with the Duplicator plugin
3) Test version 0.6.9 of plugin ‘Send PDF for Contact Form 7’ on PHP version 7.0.33
to confirm the environment is working.
version 4.9.1 of ‘Contact Form 7’
version 4.2.1 of ‘Contact Form 7 Signature Addon’
version 0.6.9 of ‘Send PDF for Contact Form 7’
version 6.1 of mpdf within ‘Send PDF for Contact Form 7’
version 7.0.33 of PHP
4) Install composer
References: https://www.thecodedeveloper.com/install-composer-windows-xampp/
https://www.hostinger.com/tutorials/how-to-install-composer
5) Upgrade mpdf within plugin ‘Send PDF for Contact Form 7’.
Version 7.1.9 of mpdf was installed.
Version 6.1 of mpdf was removed.
The before and after directory structures are as follows.
Before (with version 6.1 of mpdf):
C:.
├───classes
├───css
├───images
├───includes
├───js
│ └───lib
│ ├───addon
│ │ ├───hint
│ │ └───selection
│ └───theme
├───languages
├───mpdf
│ ├───classes
│ ├───collations
│ ├───font
│ ├───graph_cache
│ ├───iccprofiles
│ ├───includes
│ ├───patterns
│ ├───qrcode
│ │ └───data
│ ├───tests
│ │ └───data
│ │ └───pdfs
│ ├───tmp
│ ├───ttfontdata
│ ├───ttfonts
│ ├───utils
│ └───vendor
│ ├───composer
│ └───setasign
│ └───fpdi
│ └───filters
└───viewsAfter (with version 7.1.9 of mpdf):
C:.
├───classes
├───css
├───images
├───includes
├───js
│ └───lib
│ ├───addon
│ │ ├───hint
│ │ └───selection
│ └───theme
├───languages
├───vendor
│ ├───composer
│ ├───mpdf
│ │ └───mpdf
│ │ ├───.github
│ │ ├───data
│ │ │ ├───collations
│ │ │ ├───font
│ │ │ ├───iccprofiles
│ │ │ └───patterns
│ │ ├───src
│ │ │ ├───Barcode
│ │ │ ├───Color
│ │ │ ├───Config
│ │ │ ├───Conversion
│ │ │ ├───Css
│ │ │ ├───Exception
│ │ │ ├───Fonts
│ │ │ ├───Gif
│ │ │ ├───Image
│ │ │ ├───Language
│ │ │ ├───Log
│ │ │ ├───Output
│ │ │ ├───Pdf
│ │ │ │ └───Protection
│ │ │ ├───QrCode
│ │ │ │ └───data
│ │ │ ├───Shaper
│ │ │ ├───Tag
│ │ │ ├───Utils
│ │ │ └───Writer
│ │ ├───tmp
│ │ │ └───ttfontdata
│ │ └───ttfonts
│ ├───myclabs
│ │ └───deep-copy
│ │ ├───doc
│ │ ├───fixtures
│ │ │ ├───f001
│ │ │ ├───f002
│ │ │ ├───f003
│ │ │ ├───f004
│ │ │ ├───f005
│ │ │ ├───f006
│ │ │ ├───f007
│ │ │ └───f008
│ │ └───src
│ │ └───DeepCopy
│ │ ├───Exception
│ │ ├───Filter
│ │ │ └───Doctrine
│ │ ├───Matcher
│ │ │ └───Doctrine
│ │ ├───Reflection
│ │ ├───TypeFilter
│ │ │ ├───Date
│ │ │ └───Spl
│ │ └───TypeMatcher
│ ├───paragonie
│ │ └───random_compat
│ │ ├───dist
│ │ ├───lib
│ │ └───other
│ ├───psr
│ │ └───log
│ │ └───Psr
│ │ └───Log
│ │ └───Test
│ └───setasign
│ └───fpdi
│ └───filters
└───views6) Work through the ‘Send PDF for Contact Form 7’ required
changes based on https://packagist.org/packages/mpdf/mpdf
and the mpdf CHANGELOG.md.
A) Identify the plugin require_once commands for autoload.php
B) Identify the plugin object creation (new) statements involving mpdf.
C) Identify the plugin config parameters used during mpdf object creation.
6A)
findstr /S /N /I “autoload.php” *.php
classes\send-pdf.php:573: require WPCF7PDF_DIR . ‘/mpdf/vendor/autoload.php’;
views\send-pdf-admin.php:188: require WPCF7PDF_DIR . ‘/mpdf/vendor/autoload.php’;
So…
o modify classes\send-pdf.php:573: from ‘/mpdf/vendor/autoload.php’ to ‘/vendor/autoload.php’
o modify views\send-pdf-admin.pdf:188: from ‘/mpdf/vendor/autoload.php’ to ‘/vendor/autoload.php’
6B)
findstr /S /N /I /C:”new ” *.php | findstr “mpdf” | findstr /V /B “vendor”
classes\send-pdf.php:577: $mpdf=new mPDF(‘utf-8’, $formatPdf);
classes\send-pdf.php:579: $mpdf=new mPDF();
views\send-pdf-admin.php:189: $mpdf=new mPDF(‘utf-8’, $formatPdf);
So…
o modify classes\send-pdf.php:577: from $mpdf=new mPDF( to $mpdf=new \Mpdf\Mpdf(
o modify classes\send-pdf.php:579: from $mpdf=new mPDF( to $mpdf=new \Mpdf\Mpdf(
o modify views\send-pdf-admin.php:189: from $mpdf=new mPDF( to $mpdf=new \Mpdf\Mpdf(
6C)
o modify classes\send-pdf.php:577: $mpdf=new \Mpdf\Mpdf([ mode => ‘utf-8’, format => $formatPdf ]);
o modify views\send-pdf-admin.php:189: $mpdf=new \Mpdf\Mpdf([ mode => ‘utf-8’, format => $formatPdf ]);
7) Successfully test a Contact Form 7 with the following combination of software –
version 4.9.1 of ‘Contact Form 7’
version 4.2.1 of ‘Contact Form 7 Signature Addon’
version 0.6.9 of ‘Send PDF for Contact Form 7’
version 7.1.9 of mpdf within ‘Send PDF for Contact Form 7’
version 7.0.33 of PHP
NOTE: version 6.1 of mpdf created footers in my PDF files that
were positioned on the page too low to print.
version 7.1.9 of mpdf creates footers that print correctly.
8) Successfully test a Contact Form 7 with the following combination of software –
version 4.9.1 of ‘Contact Form 7’
version 4.2.1 of ‘Contact Form 7 Signature Addon’
version 0.6.9 of ‘Send PDF for Contact Form 7’
version 7.1.9 of mpdf within ‘Send PDF for Contact Form 7’
version 7.1.25 of PHPForum: Plugins
In reply to: [Send PDF for Contact Form 7] PHP 7.1 with plugin version 0.6.9.The version of mPDF within ‘Send PDF for Contact Form 7’ version 0.6.9 is 6.1.0 dated 26/04/2016. Version 7.0.0 of mPDF is dated 19/10/2017 and it looks like mPDF is up to at least version 7.1.8.
In searching for resolution, found https://github.com/mpdf/mpdf/issues/889 stating “Upgrade to mPDF 7. mPDF 6 will not have PHP 7.2 support.”. Since PHP 7.2 and 7.3 are currently the only versions in ‘Active Support’, it seems the only course of action is to get the latest mPDF into ‘Send PDF for Contact Form 7’.
Thanks for your continued support of the plugin. If I can’t get up to at least PHP version 7.1, my hosting company will automatically start charging for PHP security support beginning February 1, 2019. I’m a volunteer supporting a web site for a non-profit, so we really don’t have the extra support money.
Thanks,
TomI decided to write s2hacks_EOT_Email_Notify.php after a lot of reading on the subject of EOT notifications and not being able to find an existing implementation that suits my needs. I hope I haven’t duplicated anything that already exists…
I prefer a scheduled ‘job’ to run each day to check all users instead of code that runs for each user at some point during their logged in session. I run a table tennis club site with mainly public content, so it is rare for the members to actually log in. In my case, s2Member is mainly used to track memberships not control content access, so notifications are extremely important.
Below is the approach I’m using as of tonight. The comments explain the entire approach for 3 pre-expiration notifications. A wave of 1st Notification e-mail messages went out from my site upon landing the .php file in the mu-plugins folder.
<?php // // s2hacks_EOT_Email_Notify.php // // Create user_meta s2hacks_eot_notify_state to track upcoming // EOT expirations. Send e-mail to user and admin as EOT crosses // specific thresholds of remaining days. // // s2hacks_eot_notify_state values // 0: EOT is far into the future // 1: EOT crossed 1st threshold and 1st Notification has been sent // 2: EOT crossed 2nd threshold and 2nd Notification has been sent // 3: EOT crossed 3rd threshold and 3rd Notification has been sent // // NOTES // 1) Place this .php file in your mu-plugins folder to schedule // the initial (immediate) run of s2hacks_eot_notify_event and // the subsequent daily recurring s2hacks_eot_notify_event. // Suggestion: Use plugin "WP Crontrol" or similar to see the // WP-cron events. // 2) If this mu-plugin is removed... // A) You must manually // clean up the WP-cron schedule residue. The "WP Crontrol" // plugin can be used to remove the scheduled // s2hacks_eot_notify_event. // B) Also, any instances of the meta_key named // s2hacks_eot_notify_state will be your responsibility // to remove from the wp_usermeta table. // Suggestion: Use phpMyAdmin or equivalent to locate and // delete the residue rows. // 3) Put the word 'Development' into your Site Title (Dashboard, // Settings, General, Site Title) to suppress the user e-mail // while you are testing. // 4) Set a user's first name to 'Test' to receive user e-mail even // when running with a 'Development' Site Title. // // // Change History // ========================================================================= // 2014/05/11 - 1) TPK: Initial hack - v1.0.0 // 2014/05/12 - 1) TPK: v1.0.1 // A) Fixed detection of existing s2hacks_eot_notify_state // to prevent multiple instances (rows) for the same user // ID. // B) Added additional documentation. // // // Part 1 - Schedule Processing // add_action('wp', 's2hacks_eot_notify_schedule'); /**/ function s2hacks_eot_notify_schedule() { if ( ! wp_next_scheduled( 's2hacks_eot_notify_event' ) ) { wp_schedule_single_event( time() + 15, 's2hacks_eot_notify_event' ); // First One ~now wp_schedule_event( time(), 'daily', 's2hacks_eot_notify_event' ); // Two through n on daily basis } } // // Part 2 - Create user meta when it doesn't already exist // Act on user meta // add_action('s2hacks_eot_notify_event', 's2hacks_eot_notify_state'); /**/ function s2hacks_eot_notify_state() { /**/ if(!$GLOBALS['WS_PLUGIN__']['s2member']['o']['auto_eot_system_enabled']) # If the Automatic EOT system is disabled... return; # ...we don't need to do anything /* Otherwise... */ $users_query = new WP_User_Query( array( 'fields' => 'all_with_meta', 'orderby' => 'display_name', ) ); if ( !empty( $users_query->results)) { foreach ( $users_query->results as $user ) { $this_ID = $user->ID; $this_role = $user->roles[0]; switch ( substr(strtolower($this_role),-1) ) { case "1": // s2member_level1 case "2": // s2member_level2 case "3": // s2member_level3 case "4": // s2member_level4 unset($this_eot_notify_state); $this_eot_notify_state = get_user_field('s2hacks_eot_notify_state', $this_ID); if ( false === $this_eot_notify_state ) { // Insert initial value add_user_meta($this_ID, 's2hacks_eot_notify_state', '0', false); $this_eot_notify_state = get_user_field('s2hacks_eot_notify_state', $this_ID); } $this_EOT = get_user_field('s2member_auto_eot_time', $this_ID); if (!empty($this_EOT)) { $this_EOT_readable = date('m-d-y', $this_EOT); $this_EOT_sortfriendly = date('Y-m-d', $this_EOT); $dateNow = date_create(date('Y-m-d')); $dateEOT = date_create(date('Y-m-d', $this_EOT)); $idaysremaining = (int) date_diff($dateNow, $dateEOT)->format("%a"); if ( ( $idaysremaining > 31 ) && ( $this_eot_notify_state != "0" ) ) { // Renewal has taken place after a previous notification update_user_meta($this_ID, 's2hacks_eot_notify_state', '0'); $this_eot_notify_state = get_user_field('s2hacks_eot_notify_state', $this_ID); } $bSendEmail = false; switch ( $this_eot_notify_state ) { case "0": // 1st Notification if ( $idaysremaining < 31 ) { $bSendEmail = true; update_user_meta($this_ID, 's2hacks_eot_notify_state', '1'); $subject = '1st Notification'; } break; case "1": // 2nd Notification if ( $idaysremaining < 8 ) { $bSendEmail = true; update_user_meta($this_ID, 's2hacks_eot_notify_state', '2'); $subject = '2nd Notification'; } break; case "2": // 3rd Notification if ( $idaysremaining < 2 ) { $bSendEmail = true; update_user_meta($this_ID, 's2hacks_eot_notify_state', '3'); $subject = '3rd Notification'; } break; default: // break; } if ( $bSendEmail ) { // Send email $this_email = $user->user_email; $admin_email = get_bloginfo('admin_email'); $subject = $subject . ' of Impending Membership Expiration'; $usermessage = 'Reminder: Your membership will expire in ' . $idaysremaining . ' days. Please renew now.'; $adminmessage = 'Notice: ' . $this_email . ' will expire in ' . $idaysremaining . ' days.'; $bSendUserEmail = true; if ( strpos(get_bloginfo('name'), 'Development') !== false ) { // On Development Site $bSendUserEmail = false; if ( 'Test' === $user->first_name ) { // Test account - OK to send $bSendUserEmail = true; } } if ( $bSendUserEmail ) { wp_mail( $this_email, $subject, $usermessage ); } // Always send to admin wp_mail( $admin_email, $subject, $adminmessage ); } } break; default: // Every other role break; } } } else { //echo "$users is empty"; } } ?>