I make an unary call from PHP code like that: Sometimes I get the LogicException with message “start_batch was called incorrectly”. Any thoughts how to deal with that exception and what is the root cause? Answer After some investigation I found out that the problem occurs because of reusing the in…
Tag: php
Telegram bot – sendMessage text
I have 2 problems with programming telegram bot by PHP. problem: please, When I try send text with more lines by using API of telegram. By this code: <?php $update = file_get_contents('php://…
Is there a possibility to store device unique ‘identifier’ in my database? (PHP)
I am doing a poll voting system and I want each device to have only one chance to vote. How can I do that using PHP? Answer this will get value from the environment variable use of cookies //if user vote first time and successfully then set $vote = “success” then set cookie variable for that devic…
WooCommerce Price Filter – trigger on change instead of submit
Does anyone know how I can customize the WooCommerce price filter widget to filter on a ‘change’ trigger instead of having the submit button? It is located in templates/content-widget-price-filter.php – but since it is made as a form, does that mean I HAVE to use a submit button to trigger t…
Add an email attachment to WooCommerce notifications based on product category
For some of my product I need to send an additional pdf (not an invoice) to my customers. With the help of this post: https://wordpress.org/support/topic/attach-pdf-to-confirmation-email-for-specific-product/ I was able to attach an attachment to every order confirmation email. Then I tried to change the code…
How to Setup and use FirePHP with FireFox Developer
I am an old school programmer so I am having issues trying to install and use some of the newer programming tools. I am building a website using php but need some suggestions on the best debugging …
Automatically generate username based on user ID in WooCommerce
I’m working on a WooCommerce project where each user have an ID number. I would like to use the default WooCommerce username field for this user ID. When creating an account, can I automatically generate an account username for the customer based on their user ID? Example: User ID = 101, Auto generated …
Laravel create if statement when img missing in array in blade
How to create if statement in laravel blade when my email with image missing in array ? When email is not defined in array, laravel show error. My goal is when email with image are defined in array show the image, if email isnt defined show custom jpg. my array blade Answer You could use the null coalesce ope…
How do I get the site id in the same function that created the site?
I’m writing some php functions to work off of endpoints, specficially one that takes the input of a form to create a site within a wp multi-site. In terms of progress, the code below will take the input and create a site with the correct path and domain, but none of the meta information is being added. …
How to use two forms in the Ajax request?
var getLoginpasssystem = function(getPassForgotSystem,getLoginCheckSystem){ $(document).ready(function() { $(‘#login’ || ‘#lostpasswordform’).submit(function(e) { e.preventDefault(); …