Complicate question -> update fields ACF post object query with CPT accessible only for the user

Hope you are ready to start working on one hard problem of field objects update

Here is my problem

CPT_A has an ACF field that returns either 0 or 1
CPT_B has a post object value to select any of the CPT_A

CPT_C has a repeater field and one of the subfield is a post object field to select one of the CPT_B

The problem is :
I’d like to be able for the CPT_C to be able to select CPT_B only if ACF value from CPT_A is true.

I believe I would need to use the ACF function as follow

add_filter( 'acf/fields/post_object/query?name=contact_module_credential', 'my_acf_fields_post_object_query', 10, 3 );
function my_acf_fields_post_object_query( $args, $field, $post_id ) {

    $contactmodules_id = array();
    $argsm         = array(
        'post_type'  => 'modules',
        'meta_key'   => 'contact_or_keywords',
        'meta_value' => "contact",
    );

    /* Using WP_Query */
    $my_query = new WP_Query( $argsm );
    if ( $my_query->have_posts() ) :
        while ( $my_query->have_posts() ) : $my_query->the_post();
            array_push( $contactmodules_id, get_the_ID() );

        endwhile;
    endif;

    wp_reset_postdata(); /* Reset post data to original query */

    $args('meta_query') = array(
        array(
            'key'     => 'contact_module_credential',
            'value'   =>  $contactmodules_id,
            'compare' => 'IN'
        )
    );

    return $args;
}


any idea ?

certificates – Help understanding CSR fields

RFC2986: PKCS #10: Certification Request Syntax Specification describes CSRs in detail. The overview answers most of your questions:

The process by which a certification request is constructed involves the following steps:

        1. A CertificationRequestInfo value containing a subject
           distinguished name, a subject public key, and optionally a
           set of attributes is constructed by an entity requesting
           certification.

        2. The CertificationRequestInfo value is signed with the subject
           entity's private key.  (See Section 4.2.)

        3. The CertificationRequestInfo value, a signature algorithm
           identifier, and the entity's signature are collected together
           into a CertificationRequest value, defined below.

So to take your questions one by one:

How are the bytes after the “Signature Algorithm” field calculated?

This is the signature itself, computed over the CSR data (in ASN.1 format, not the friendly text version shown by openssl) using the specified Signature Algorithm and the private key of the requester (here: Subject).

Which key is used?

The private key of the Subject is used to compute the signature. It can be verified using the public key (as found in the Subject Public Key Info field)

Which fields of ca.csr are signed?

All data in the CSR is signed. The data of course does not include the signature itself (that would be tricky).

Is it possible to extract the signature and decode it (e.g. using openssl)?

Yes, you can run the following:

$ openssl req -verify -in ca.csr -noout
verify OK

If I modify a single character in the CSR, the output becomes:

$ openssl req -verify -in ca.csr -noout
verify failure
140678320674112:error:0407008A:rsa routines:RSA_padding_check_PKCS1_type_1:invalid padding:../crypto/rsa/rsa_pk1.c:66:
140678320674112:error:04067072:rsa routines:rsa_ossl_public_decrypt:padding check failed:../crypto/rsa/rsa_ossl.c:588:
140678320674112:error:0D0C5006:asn1 encoding routines:ASN1_item_verify:EVP lib:../crypto/asn1/a_verify.c:170:

And for your final question about the certificate itself:

why is the signature different from the one in the CSR?

The certificate is signed the private key of the Issuer, not the Subject. The fields are also different. So both the data and the key change (the signature algorithm can also change), resulting in a completely different signature.

Creating new project with mandatory custom lookup fields via CSOM

I have to create new project with required custom lookup fields via CSOM and I have got the CustomFieldRequiredValueNotProvided exception. Here is my code. What am I doing wrong?


using (ProjectContext projectContext = new ProjectContext(url))
{

        projectContext.Credentials = manager.GetNetworkCredential();
        projectContext.Load(projectContext.EnterpriseProjectTypes);
        projectContext.ExecuteQuery();

        projectContext.Load(projectContext.LookupTables);
        projectContext.ExecuteQuery();
        var lookupTables = projectContext.LookupTables.ToList();

        projectContext.Load(projectContext.CustomFields);
        projectContext.ExecuteQuery();
        var customFields = projectContext.CustomFields.ToList();

        var customFieldDepartment = customFields.Where(x => x.Name == "cfName1").First();
        var customFieldCustomer = customFields.Where(x => x.Name == "cfName2").First();

        LookupTable lookupTableDepartments = projectContext.LookupTables.First(x => x.Name == "ltName1");
        projectContext.Load(lookupTableDepartments.Entries);
        projectContext.ExecuteQuery();

        LookupTable lookupTableCustomers = projectContext.LookupTables.First(x => x.Name == "ltName2");
        projectContext.Load(lookupTableCustomers.Entries);
        projectContext.ExecuteQuery();

        var department = lookupTableDepartments.Entries.ToList().First();
        var customer = lookupTableCustomers.Entries.ToList().First();

        var enterpriseProjectType = projectContext.EnterpriseProjectTypes.Where(x => x.Name == "eptName").First();

        var project = projectContext.Projects.Add(new ProjectCreationInformation
        {
                Id = Guid.NewGuid(),
                Name = "CSOM Project name",
                EnterpriseProjectTypeId = enterpriseProjectType.Id,
                Start = DateTime.Now
        });

        string departmentInternalName = customFieldDepartment.InternalName;
        string customerInternalName = customFieldCustomer.InternalName;
        string departmentInternalValue = department.InternalName;
        string customerInternalValue = customer.InternalName;

        project(departmentInternalName) = new string() { departmentInternalName };
        project(customerInternalName) = new string() { customerInternalValue };

        var job = projectContext.Projects.Update();
        var jobState = projectContext.WaitForQueue(job, 60);
}

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.

8 – Display the fields of the current taxonomy with an exposed form

I’m using the Taxonomy term view.

I expose the “Has taxonomy term” filter to my users.

I want to display the title and the fields of the current taxonomy even when a term has been typed in the exposed form.

However, apparently, when the view is filtered, views no longer finds the argument in the url since the url contains an all?tid=.

Do you know how to do it ?

magento2 – How do I prevent empty checkout fields from being validated on page load?

I am using Magento 2.3.5 and Amasty’s “One Step Checkout” module. Amazon Pay is also present.

When viewing the checkout page, it seems something is trying to validate the <input> fields even though the user hasn’t entered anything:

enter image description here

Is this something anyone has encountered before?

7 – Display the fields of the current taxonomy with views and an exposed form

I’m using the Taxonomy term view.

I expose the “Has taxonomy term” filter to my users.

I want to display the title and the fields of the current taxonomy even when a term has been typed in the exposed form.

However, apparently, when the view is filtered, views no longer finds the argument in the url since the url contains an all?tid=.

Do you know how to do it ?

linear algebra – Simultaneous similarity of matrices over finite fields

Suppose $A,Bin SL(3,F_q)$, where $F_q$ is the finite field of order $q$ and $SL(3,F_q)$, the group of matrices with determinant one and entries from $F_q$ , are such that $A$ has eigenvalues in $F_q$ and $B$ has eigenvalues in $overline{F_q}setminus F_q$. Also, $A$ is diagonalizable over $F_q$ and $B$ is diagonalizable over $overline{F_q}$, the closure of $F_q$. I am trying to show that $A$ and $B$ are not simultaneously diagonalizable by a matrix $Pin SL(3,overline{F_q})$ (i.e., $nexists Pin SL(3,overline{F_q})$ such that $(PAP^{-1},PBP^{-1})$ are diagonal). I am considering the approach of looking at the $F_q$ algebra generated by $A$ and $B$ and trying to show it is not isomorphic to the algebra generated by $F_q(PAP^{-1},PBP^{-1})$. I am looking for some reference which might be helpful in proving the above. Most of the results I saw had been about irreducible representations which is not helpful for my case. I would appreciate it if you could suggest some reference that could be helpful.
Thanks in advance for your time.