This code works fine if I use is_front_page as current page/url, because it gets my homepage and redirects user by role to a specific path, but it doesn’t work if I try to get a specific current url of wp admin dashboard, I tried with get_home_url(path), but it doesn’t work: Thank you in advance. …
Why i cannot use word, byte on struct in PHP FFI? But char, int, short works?
My code: dummy.h: Error: PHP Fatal error: Uncaught FFIParserException: Undefined C type “byte” at line 4 Why can I not use word or byte in this struct in PHP FFI? char, int, and short work as expected. Answer There is no such thing as a byte data type in standard C. Since char is already defined a…
Guzzle fails to authenticate with shopware5
I am trying to port the following working HTTP_Request2 code which query shopware5 API to Guzzle 7 I have tried the following, but it fails with the message “Invalid or missing auth” Answer You need to change your code As Digest has md5, so verify as false does not make it insecure, but I have not…
How to use UUID instead of a slug for ticket
I am currently navigating to a ticket using the slug set by the title example blah-blah-blah and want to use uuid instead of 336c64de-5dcb-34bc-9511-a48242b9zzzb. What is the best approach to take for Laravel 8? I am using Laravel Jetstream with Livewire stack. Current model code Ticket Migration Answer add u…
Make directory and upload multiple file into created directory PHP
I have been digging for an answer for many days. how do i upload multiple file to the newly created directory. If you look into file_upload.php you will find two $upload_dir variable. So, let’s call first $upload_dir as direct folder and Second, $upload_dir as make dir. Simple So, When I select first $u…
CakePHP 4 – how to validate forms that need to save data to multiple tables
Apologies if this has been asked before. All of the examples I can find are old or apply to legacy versions of CakePHP, e.g. cakephp: saving to multiple models using one form is 7 years old. I have an application in CakePHP 4.1.6. Two of the tables in the database are called tbl_users and tbl_orgs (“org…
PhpWord output doesn’t work in LibreOffice but works fine in MS Word
This relates to a semi-known issue listed on the GitHub page [link], where the way PhpWord generates tables causes it to set the cell width to “”, which isn’t valid in LibreOffice, but is fine in Word. The issue on GitHub lists html-to-word conversion specifically, but I’m getting this…
Sanitize an external xml file with php
Here’s my problem: Essentially I need to use an XML file from an external source and loop it through to display nicely some data. I created a function that gets content from the external URL (file_get_contents), then I turn the string of XML into an object (I use LIBXML_NOCDATA as a parameter because it…
Failed while installing a package using composer
iam tryin to use a cart package by using this command composer require jason-napolitano/codeigniter4-cart-module and it’s failed. this is what it said is it because my minimum-stability in composer.json is set to “stable”? Answer I presume you created your project by using composer create-pr…
Connecting Database Codeigniter 4 With Custom Ports
So, I’m trying to connect to my database container from my webserver container. I currently use Codeignter 4 for my PHP framework. Everything goes well in terms of communicating between different containers because that container is inside the same networks. Inside webserver container, I’ve tried …