9 – What is the design pattern for plugins (and their managers) called?

I am trying to figure out how to design (and subsequently implement) as plugin-like solution in Symfony.
I found this article https://drupalize.me/tutorial/what-are-plugins?p=2766 that says:

Plugins are a general reusable solution to a recurring problem within a given context… we call this a design pattern. This one just happens to be specific to Drupal.

Looking for a definition and/or links to similar design patterns.

plugins – How to capture hidden values with Gravity Forms

I will be using the following code from ActiveProspects and what it do is basically pass some hidden values (in this case basically a dynamic url) to the server along with the form fields which we need to capture and store in our DB. Now I am using Gravity Forms with my WordPress site but I am unable to capture that data.

 <script type="text/javascript">
  (function() {
      var field = 'xxTrustedFormCertUrl';
      var provideReferrer = false;
      var invertFieldSensitivity = false;
      var tf = document.createElement('script');
      tf.type = 'text/javascript'; tf.async = true;
      tf.src = "https://wordpress.stackexchange.com/http" + ('https:' == document.location.protocol ? 's' : '') +
        '://api.trustedform.com/trustedform.js?provide_referrer=' + escape(provideReferrer) + '&field=' + escape(field) + '&l='+new Date().getTime()+Math.random() + '&invert_field_sensitivity=' + invertFieldSensitivity;
      var s = document.getElementsByTagName('script')(0); s.parentNode.insertBefore(tf, s); }
  )();
</script>
<noscript>
    <img src="https://api.trustedform.com/ns.gif" />
</noscript>

The following image shows the hidden data and fields enter image description here

Now here’s a gravity forms help page https://docs.gravityforms.com/using-dynamic-population/ which says how to pass dynamic data but I am not into php much so any help will be well appreciated. As per this help I have added the following code in my theme functions.php but I think its hard coded. So can anybody let me know how to capture this hidden field value and store it.

add_filter( 'gform_field_value_xxTrustedFormCertUrl', 'my_custom_population_function' );
function my_custom_population_function( $value ) {
    return 'Boom';
}

plugins – Can we use multiple message fields in wp_mail() function?

I have a code that is not working for wp_mail() . I tried to debug it but was not successful.

Here is my full ode in PHP

    <?php
    /**
     * Template Name: Order Form Page
     *
     * @package Angle
     * @subpackage Frontend
     * @since 0.1
     *
     * @copyright (c) 2014 Oxygenna.com
     * @license http://wiki.envato.com/support/legal-terms/licensing-terms/
     * @version 1.15.1
     */
    get_header();
    ?>


<head>

    <script>
    // UTILITY FUNCTIONS 
    function calculate() {
        var myBox1 = document.getElementById('myBoxVal').value;
        var myBox2 = document.getElementById('sparkle-num-pallets').value;
        var result = document.getElementById('result');
        var myResult = myBox1 * myBox2;
        result.value = myResult;


    }
    </script>
    <style>
    table,
    th,
    td {
        border: 1px solid gray;
        text-align: center;
        font-size: 14px;
    }
    </style>


</head>

<?php
    
      //response generation function
    
      $response = "";
    
      //function to generate response
      function my_contact_form_generate_response($type, $message){
    
        global $response;
    
        if($type == "success") $response = "<div class='success'>{$message}</div>";
        else $response = "<div class='error'>{$message}</div>";
    
      }
    
      //response messages
      $not_human       = "Human verification incorrect.";
      $missing_content = "Please provide all information.";
      $email_invalid   = "Invalid Email Address .";
      $message_unsent  = "Message was not sent. Try Again.";
      $message_sent    = "Thanks! Your message has been sent.";
      
    
      //user posted variables
    
      if(isset($_POST('submit'))){
      $name = $_POST('name');
      $email = $_POST('email');
      $bill_to = $_POST('Bill-to');
      $ship_to = $_POST('Ship-to');
      $date = $_POST('date');
      $po = $_POST('PO');
      $phone = $_POST('Phone-number');

      $Amount_of_FC104 = $_POST('Amount-of-FC104');
      $pro_FC104 = $_POST('FC104-QTY');
    
      $Amount_of_H2020 = $_POST('Amount-of-H2020');
      $pro_H2020 = $_POST('H2020-QTY');
    
      $Amount_of_ST200 = $_POST('Amount-of-ST200');
      $pro_ST200 = $_POST('ST200-QTY');
    
      $Amount_of_UFO_1 = $_POST('Amount-of-UFO-1');
      $pro_UFO_1 = $_POST('UFO-1-QTY');
    
      $Amount_of_UFO_2 = $_POST('Amount-of-UFO-2');
      $pro_UFO_2 = $_POST('UFO-2-QTY');
    
      $Amount_of_LECB600 = $_POST('Amount-of-LECB600');
      $pro_LECB600 = $_POST('LECB600-QTY');
    
      $Amount_of_LEDB700 = $_POST('Amount-of-LEDB700');
      $pro_LEDB700 = $_POST('LEDB700-QTY');
    
      $Amount_of_LECB800 = $_POST('Amount-of-LECB800');
      $pro_LECB800 = $_POST('LECB800-QTY');
    
      $Amount_of_8089G = $_POST('Amount-of-8089G');
      $pro_8089G = $_POST('8089G-QTY');
    
      $Amount_of_LE1911 = $_POST('Amount-of-LE1911');
      $pro_LE1911 = $_POST('LE1911-QTY');
    
      $Amount_of_ME8342 = $_POST('Amount-of-ME8342');
      $pro_ME8342 = $_POST('ME8342-QTY');
    
      $Amount_of_ME8440 = $_POST('Amount-of-ME8440');
      $pro_ME8440 = $_POST('ME8440-QTY');
      
      $Amount_of_NV1455 = $_POST('Amount-of-NV1455');
      $pro_NV1455 = $_POST('NV1455-QTY');
    
      $Amount_of_LESM200 = $_POST('Amount-of-LESM200');
      $pro_LESM200 = $_POST('LESM200-QTY');
    
      $Amount_of_MAG_DOTZ = $_POST('Amount-of-MAG-DOTZ');
      $pro_MAG_DOTZ = $_POST('MAG-DOTZ-QTY');
    
      $Amount_of_MLB_01 = $_POST('Amount-of-MLB-01');
      $pro_MLB_01 = $_POST('MLB-01-QTY');
    
      $Amount_of_WW100 = $_POST('Amount-of-WW100');
      $pro_WW100 = $_POST('WW100-QTY');
    
      $Amount_of_WW200 = $_POST('Amount-of-WW200');
      $pro_WW200 = $_POST('WW200-QTY');
    
      $Amount_of_LEWS810_BLK = $_POST('Amount-of-LEWS810-BLK');
      $pro_LEWS810_BLK = $_POST('LEWS810-BLK-QTY');
    
      $Amount_of_73421 = $_POST('Amount-of-73421');
      $pro_73421 = $_POST('73421-QTY');
    
      $Amount_of_LPU900 = $_POST('Amount-of-LPU900');
      $pro_LPU900 = $_POST('LPU900-QTY');
    
      $Amount_of_LEF10 = $_POST('Amount-of-LEF10');
      $pro_LEF10 = $_POST('LEF10-QTY');
    
      $Amount_of_LEF1 = $_POST('Amount-of-LEF1');
      $pro_LEF1 = $_POST('LEF1-QTY');
    
      $Amount_of_LEF855 = $_POST('Amount-of-LEF855');
      $pro_LEF855 = $_POST('LEF855-QTY');
    
      $message .= "Name: " . $name . "n";
      $message .= "Email: " . $email . "n";
      $message .= "Ship To: " . $ship_to . "n";
      $message .= "Bill To: " . $bill_to . "n";
      $message .= "Phone Number: " . $phone . "n";
      $message .= "PO: " . $po . "n";
      $message .= "Date: " . $date . "n";

      $message .= "Amount-of-FC104: " . $$Amount_of_FC104 . "n";
      $message .= "FC104-QTY: " . $pro_FC104 . "n";
      $message .= "Amount-of-H2020: " . $$Amount_of_H2020 . "n";
      $message .= "H2020-QTY: " . $pro_H2020 . "n";
      $message .= "Amount-of-ST200: " . $$Amount_of_ST200 . "n";
      $message .= "ST200-QTY: " . $pro_ST200 . "n";
      $message .= "Amount-of-UFO-1: " . $$Amount_of_UFO_1 . "n";
      $message .= "UFO-1-QTY: " . $pro_UFO_1 . "n";
      $message .= "Amount-of-UFO-2: " . $$Amount_of_UFO_2 . "n";
      $message .= "UFO-2-QTY: " . $pro_UFO_2 . "n";
      $message .= "Amount-of-LECB600: " . $$Amount_of_LECB600 . "n";
      $message .= "LECB600-QTY: " . $pro_LECB600 . "n";
      $message .= "Amount-of-LEDB700: " . $$Amount_of_LEDB700 . "n";
      $message .= "LEDB700-QTY: " . $pro_LEDB700. "n";
      $message .= "Amount-of-LECB800: " . $$Amount_of_LECB800 . "n";
      $message .= "LECB800-QTY: " . $pro_LECB800 . "n";
      $message .= "Amount-of-8089G: " . $$Amount_of_8089G . "n";
      $message .= "8089G-QTY: " . $pro_8089G . "n";
      $message .= "Amount-of-LE1911: " . $$Amount_of_LE1911 . "n";
      $message .= "LE1911-QTY: " . $pro_LE1911 . "n";
      $message .= "Amount-of-ME8342: " . $$Amount_of_ME8342 . "n";
      $message .= "ME8342-QTY: " . $pro_ME8342 . "n";
      $message .= "Amount-of-ME8440: " . $$Amount_of_ME8440. "n";
      $message .= "ME8440-QTY: " . $pro_ME8440. "n";
      $message .= "Amount-of-NV1455: " . $$Amount_of_NV1455 . "n";
      $message .= "NV1455-QTY: " . $pro_NV1455 . "n";
      $message .= "Amount-of-LESM200: " . $$Amount_of_LESM200 . "n";
      $message .= "LESM200-QTY: " . $pro_LESM200 . "n";
      $message .= "Amount-of-MAG-DOTZ: " . $$Amount_of_MAG_DOTZ . "n";
      $message .= "MAG-DOTZ-QTY: " . $pro_MAG_DOTZ . "n";
      $message .= "Amount-of-MLB-01: " . $$Amount_of_MLB_01 . "n";
      $message .= "MLB-01-QTY: " . $pro_MLB_01 . "n";
      $message .= "Amount-of-WW100: " . $$Amount_of_WW100 . "n";
      $message .= "WW100-QTY: " . $pro_WW100 . "n";
      $message .= "Amount-of-WW200: " . $$Amount_of_WW200 . "n";
      $message .= "WW200-QTY: " . $pro_WW200 . "n";
      $message .= "Amount-of-LEWS810-BLK: " . $$Amount_of_LEWS810_BLK . "n";
      $message .= "LEWS810-BLK-QTY: " . $pro_LEWS810_BLK . "n";
      $message .= "Amount-of-73421: " . $$Amount_of_73421 . "n";
      $message .= "73421-QTY: " . $pro_73421 . "n";
      $message .= "Amount-of-LPU900: " . $$Amount_of_LPU900 . "n";
      $message .= "LPU900-QTY: " . $pro_LPU900 . "n";
      $message .= "Amount-of-LEF10: " . $$Amount_of_LEF10 . "n";
      $message .= "LEF10-QTY: " . $pro_LEF10 . "n";
      
      $message .= "Amount-of-LEF1: " . $$Amount_of_LEF1 . "n";
      $message .= "LEF1-QTY: " . $pro_LEF1 . "n";
      
      $message .= "Amount-of-LEF855: " . $$Amount_of_LEF855 . "n";
      $message .= "LEF855-QTY: " . $pro_LEF855 . "n";
      

    
    
      //php mailer variables
      $to = get_option('admin_email');
      $subject = "Someone sent a order form from ".get_bloginfo('name');
      $headers = 'From: '. $email . "rn" .
        'Reply-To: ' . $email . "rn";
    
    
     
    
          //validate email
          //if(!filter_var($email, FILTER_VALIDATE_EMAIL)){
           // my_contact_form_generate_response("error", $email_invalid);
        // } //email is valid
         //  else //ready to go!
          //  {
              $sent = wp_mail('shahid.wpexpert@gmail.com', $subject, strip_tags($message), $headers);
              if($sent) my_contact_form_generate_response("success", $message_sent); //message sent!
              else my_contact_form_generate_response("error", $message_unsent); //message wasn't sent
            }
            //else if ($_POST('submitted')) {my_contact_form_generate_response("error", $missing_content);
        // }
        
      
    
       // }
    
    
    ?>


<style type="text/css">
.error {
    padding: 5px 9px;
    border: 1px solid red;
    color: red;
    border-radius: 3px;
}

.success {
    padding: 5px 9px;
    border: 1px solid green;
    color: green;
    border-radius: 3px;
}

form span {
    color: red;
}
</style>
<div class="container">
<div id="respond">

    <?php echo $response; ?></div>
<div class="container">

    <form class="foxycart" action="<?php get_permalink(); ?>" method="post" id="foxycart-order-form">
        
<tr>
<td><input type="hidden" name="submitted" value="1">
<input type="submit" value="Submit Order" /></td>
</tr>

    </table>

    </div>

</div>

</form>
</div>
</div>
<?php get_footer(); ?>

I have more than 40 fields in the form.

plugins – WordPress + Elementor

Good day I created a custom theme and everything works fine. I installed a WP plugin called ‘Elementor but when I try to edit my home page using Elementor I get an error. I took a screen shot please see.. enter image description here

When I click, click here for preview debug blank, plain white page is shown…Please see the screen shot.enter image description here

Here is the code I have inside my front-page.php.

I also inserted a screen shot please see. enter image description here


<?php if(have_posts()) : while(have_posts()) : the_post();?>

    <?php the_content();?>

<?php endwhile; else: endif;?>

When I visit my site…It displays normally no problem at all…enter image description here

PLEASE HELP Thank you.

plugins – Image path in childs theme

I hope you can help me. How do I have to change the file path to get an specific image from my upload folder in my plugin/shortcode?
I have added the following lines to my childs theme – functions.php but it doesn’t work.

add_shortcode( 'webcamtime', 'webcamtime_timestamp' );
function webcamtime_init (){
    function webcamtime_timestamp() {
        $file = '/wp-content/uploads/webcam/webcamimage.jpg';
        $filename = basename($file);
        if (file_exists($filename)) {
            return "Last modified: " . date ("F d Y H:i:s.", filemtime($filename));
 }
}
}
add_action('init', 'webcamtime_init');

Thank you in advance!!

plugins – PHP Warning: A non-numeric value encountered in

I am currently getting the “PHP Warning: A non-numeric value encountered in” on two lines of a WordPress plugin I am using… Here is the code from the plugin that is causing the issue

                
-                               $pattern = '/.' . $ext . '/i';
+                               $pattern = '/.' . $ext . '$/i';
                if (preg_match($pattern, $file_link)) {
                    
                    $file_ext = $ext;
                    break;
                }
            }

I am assuming it is the “-” and the “+” that is causing the issue? Any help on this would be massively appreciated.

Many thanks in advance!

What are the best SEO framework / plugins for a WordPress Site: Genesis, Yoast Plugin, etc ?

What are the best SEO framework / plugins for a WordPress Site: Genesis, Yoast Plugin, etc ?

plugins – Add button gutenberg help

Hello I need to add a button to the toolbar gutenberg I found this https://developer.wordpress.org/block-editor/tutorials/format-api/2-toolbar-button/ but I do not get what is wrong for the button to appear

functions.php

enter image description here

my-custom-format.js

( function( wp ) {
    var MyCustomButton = function( props ) {
        return wp.element.createElement(
            wp.editor.RichTextToolbarButton, {
                icon: 'editor-code',
                title: 'Sample output',
                onClick: function() {
                    console.log( 'toggle format' );
                },
            }
        );
    }
    wp.richText.registerFormatType(
       'my-custom-format/sample-output', {
            title: 'Sample output',
            tagName: 'samp',
            className: null,
            edit: MyCustomButton,
        }
    );
} )( window.wp );

plugins – How do I allow a user to purchase an expiring passcode to access part of my website, from my online store, similar to pay-per-view?

I am trying to add functionality to a website I am starting to create, which is a bit like a pay-per-view video channel, where a user (without registering) would go onto my online store and purchase a product, which in this case would be an automatically-generated passcode.

The user would receive the passcode via email and then use it to gain access to a specific (hidden/private) part of the website. The passcode would automatically expire a certain amount of time after it is first used, such as a few days.

I have done a bit of research and come across various membership plugins, such as MemberPress and Restrict Content Pro. However, these do not do what I require. I don’t want the user to create an online account; I simply want a passcode to be generated when paid for through the online store.

Is this possible? Could someone point me in the right direction for a plugin, or even a tutorial that explains how to do this? Thanks!

plugins – How to Auto Generate Shortcode When Publishing a Product.?

What i’m trying to do is, When i Publish a Product, The field automatically displays a shortcode of the product, so it can easily be used anywhere.

Or is there plugin that already does this?

The person who is managing this website, its not very techy and is on his 70s, this will help him alot.

Thanks for your help in advance. :]

Exmaple #1
Example #2