| 1 |
<?php |
| 2 |
|
| 3 |
namespace Buddypress\CLI\Command; |
| 4 |
|
| 5 |
use WP_CLI; |
| 6 |
|
| 7 |
/** |
| 8 |
* Manage BuddyPress XProfile. |
| 9 |
* |
| 10 |
* ## EXAMPLES |
| 11 |
* |
| 12 |
* # Save a xprofile data to a user with its field and value. |
| 13 |
* $ wp bp xprofile data set --user-id=45 --field-id=120 --value=test |
| 14 |
* Success: Updated XProfile field "Field Name" (ID 120) with value "test" for user user_login (ID 45). |
| 15 |
* |
| 16 |
* # Create a xprofile group. |
| 17 |
* $ wp bp xprofile group create --name="Group Name" --description="Xprofile Group Description" |
| 18 |
* Success: Created XProfile field group "Group Name" (ID 123). |
| 19 |
* |
| 20 |
* # List xprofile fields. |
| 21 |
* $ wp bp xprofile field list |
| 22 |
* +----+------+-------------+---------+----------+-------------+ |
| 23 |
* | id | name | description | type | group_id | is_required | |
| 24 |
* +----+------+-------------+---------+----------+-------------+ |
| 25 |
* | 1 | Name | | textbox | 1 | 1 | |
| 26 |
* +----+------+-------------+---------+----------+-------------+ |
| 27 |
*/ |
| 28 |
class XProfile extends BuddyPressCommand { |
| 29 |
|
| 30 |
/** |
| 31 |
* Dependency check for this CLI command. |
| 32 |
*/ |
| 33 |
public static function check_dependencies() { |
| 34 |
parent::check_dependencies(); |
| 35 |
|
| 36 |
if ( ! bp_is_active( 'xprofile' ) ) { |
| 37 |
WP_CLI::error( 'The XProfile component is not active.' ); |
| 38 |
} |
| 39 |
} |
| 40 |
} |
| 41 |
|