awesomemotive / easy-digital-downloads

Sell digital downloads through WordPress
https://easydigitaldownloads.com
GNU General Public License v2.0
863 stars 474 forks source link

CLI command wp edd customers is incomplete and fails using the examples on the website #9732

Open arraypress opened 4 months ago

arraypress commented 4 months ago

Bug Report

Expected behavior

For testing purposes I wanted to create 100 customers using the WordPress CLI, which according to the documentation should be done like this:

wp edd customers --create=100

You can see this here: https://easydigitaldownloads.com/docs/wp-cli-commands/

Actual behavior

The operation "fails" because code is physically missing to create random names and emails in the CLI command.

Something like this fixes it (similar to the orders):

$fname  = $this->get_fname();
$lname  = $this->get_lname();
$domain = $this->get_domain();
$tld    = $this->get_tld();

$email = $fname . '.' . $lname . '@' . $domain . '.' . $tld;

$args = array(
    'email'   => $email,
    'name'    => $fname . ' ' . $lname,
);

$customer_id = edd_add_customer( $args );

Steps to reproduce the behavior

1) Goto CLI and type wp edd customers --create=100 2) You will see it errors out because it hits the 'else'. 3) No customers are created.

Information (if a specific version is affected):

PHP Version: 8.3

EDD Version (or branch): 3.2.12

WordPress Version: 6.5.3