WordPress doesn’t send a notification email when submitting a comment using REST API

When I submit a comment on the WordPress website, it sends me a notification email.
but when I submit a comment through REST API, WordPress doesn’t send me a notification email.
What should I do to make WordPress send a notification email when I submit a comment with REST API?

How to pass POST data from Contact Form 7 to another subpage after submitting the form

I would like to pass data from Contact Form 7 to another subpage after submitting the form. I would like to use the POST method for this

  • I can get to this data with the wpcf7_before_send_mail filter as follows:
function cf7_data() {     $  submission = WPCF7_Submission::get_instance();     $  data = $  submission->get_posted_data();      // Here I have a variable containing a field from the contact form     $  subject = $  data['your-name'];      // I don't know what to do next } add_action('wpcf7_before_send_mail', 'cf7_data'); 
  • I can make redirect after submit form as follows:
document.addEventListener( 'wpcf7mailsent', function( event ) {     location = 'https://samewebsite/subpage'; }, false ); 

but I can’t figure out how I can pass and read the $ subject variable on the subpage after the redirection

Error in jQuery.ajax while submitting a form: Internal Server Error – UserPro

So I am using the plugin UserPro to make a register form. I have made a register field where users can choose their role. I did that the following way:

enter image description here

In my register setttings (the settings for the registration form) in UserPro I have the following:

enter image description here

As you can see, my standard roles for logging in are Dj and Radiostation. Yet for some reason I get the error: Error in jQuery.ajax while submitting a form: Internal Server Error when I try to register one of the two.

The problem does get solved when I make a default role for registering, but that will not work. Since the users will then only register as one role.

My question: How can I solve the Internal Server Error when I try to register one of the two. when registering?

What must be included in a good report writeup when submitting it to whoever (eg. paper skeleton)? [closed]

For some reasons this question is not about vulnerability reporting as many question I read, but rather about the writeup of a good, professional paper that states all details about hole.

I can think of some:

  • PoC
  • Date of writing
  • What else?

Thanks in advance.

400 Bad request while submitting form using AJAX

I am poor in AJAX and trying to submit the form and insert the record to the custom table since a couple of days but not getting it to work.

I am getting 400 Bad request error on console. Please have a look at the code.

In fact, I have tried multiple ways to submit data but none of them works.

HTML

<form class="addtocartform" id="gsAddToCart" method="POST">     <label class="gs-label" for="options">Options</label>     <select class="gs-select-box" id="product_option" name="product_option">         <option value="0">Somnath</option>         <option value="1">Dwarka</option>         <option value="2">Rameshwaram</option>     </select>     <label class="gs-label" for="qty">Qty.</label>     <input class="gs-number" id="qty" min="1" name="qty" step="1" type="number" value="1">          <button class="gs-button order-button add-to-cart-button">             <i class="fa fa-cart-plus"></i>             <span class="gs-button-label">Add to Cart</span>         </button>          <input id="product" name="product" type="hidden" value="160"/>         <input id="group_id" name="group_id" type="hidden" value="194"/>     </input> </form> 

WordPress Hooks – Enqueue scripts

function gs_enqueue_ajax_scripts() {      wp_register_script('gs-ajax', GROUP_SHOP_ROOT . 'public/js/add-to-cart-ajax.js', ['jquery'], 1.0, TRUE);     wp_localize_script('gs-ajax', 'ajax_vars', [         'ajax_url' => admin_url('admin-ajax.php'),         'nonce'    => wp_create_nonce('gs_nonce'),     ]);     wp_enqueue_script('gs-ajax');  }  add_action('wp_enqueue_scripts', 'gs_enqueue_ajax_scripts'); 

WordPress Hooks – Process and Insert Data

function gs_add_to_cart_ajax() {      check_ajax_referer('gs_nonce', $  _POST[ 'nonce' ], FALSE);      // validating stuffs ..      $  cart = new Group_Shop_Cart();     $  cart->add_to_cart($  _POST[ 'group_id' ], $  _POST[ 'product' ], $  _POST[ 'qty' ], $  _POST[ 'product_option' ]);      wp_die(); }  add_action('wp_ajax_gs_add_to_cart_ajax', 'gs_add_to_cart_ajax'); add_action('wp_ajax_nopriv_gs_add_to_cart_ajax', 'gs_add_to_cart_ajax'); 

Javascript

(function ($  ) {      $  (document).on("click", ".add-to-cart-button", function () {          let data = JSON.stringify({             action: 'gs_add_to_cart_ajax',             group_id: $  ('#group_id').val(),             product: $  ('#product').val(),             qty: $  ('#qty').val(),             product_option: $  ('#product_option').val(),         });          $  ('form.addtocartform').on('submit', function (e) {             e.preventDefault();              $  .ajax({                  method: 'POST',                 dataType: 'json',                 nonce: ajax_vars.nonce,                 url: ajax_vars.ajax_url,                 data: data,                 success: function (response) {                     alert("Success");                 }              });         });      });  })(jQuery); 

I have no idea what is wrong in this code that not submitting.

Modified Code

$  .ajax({      method: 'POST',     dataType: 'json',     nonce: ajax_vars.nonce,     url: ajax_vars.ajax_url,     data: {         action: 'gs_add_to_cart_ajax',         group_id: $  ('#group_id').val(),         product: $  ('#product').val(),         qty: $  ('#qty').val(),         product_option: $  ('#product_option').val(),     },     success: function (response) {         alert("Success");     }  });  

Conversion comparison between users who navigate from autocomplete vs. submitting from the search form

Recently I came across the way Instagram does their search. Basically they give you results in the autocomplete but disable the ability to actually submit the form and be navigated to your traditional search results page. I found this interesting for the fact with millions of possible users or posts, they are confident the user will find what they’re looking for in no more than a dozen results. Is there any evidence that supports that whether users choose more from autocomplete over navigating to a results page?

Approaches to prevent submitting a modern create/edit forms if a status = close while a date field is missing

I am working on a sharepoint online custom list, and the list contain these 2 main fields:-

  1. Status. drop-down with options; new,open,closed
  2. Publish Date.

now i want to prevent users from creating/editing an item and change its “Status” to “Closed” unless they specify a value for the “Publish Date”.

now i want to use the modern experience, as if in classic mode i can simply add a script editor web part and do the validation using javascript. but what are the options i have to do this validation in modern experience ? and can i benefit from list or field validation to do such a validation (as list/field validation will work on modern UI)..