Skip to content

Conversation

mwilliamson-red-gate
Copy link
Contributor

Adds the command wp user update_meta to allow meta fields on a user to be updated.

}

private function get_arg_or_error( $args, $index, $name ) {
$value = $args[$index];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will produce a notice. Should use isset().

@scribu
Copy link
Member

scribu commented May 31, 2012

How about instead of update_meta, we use meta set?

wp user meta set 123 key value

It would be more consistent with wp option set key value.

@mwilliamson-red-gate
Copy link
Contributor Author

wp user meta set sounds good to me, but is there a straightforward way to add a sub-sub-command? (Where user is the command, meta is the sub-command, and set is the sub-sub-command)

@scribu
Copy link
Member

scribu commented May 31, 2012

You can treat 'set' as just another parameter to the 'meta' sub-command.

The alternative would be to introduce a user-meta command:

wp user-meta set 123 key value

wp user-meta get 123 key

In this case, we could have a helper class which we could reuse for post-meta etc.

@mwilliamson-red-gate
Copy link
Contributor Author

You can treat 'set' as just another parameter to the 'meta' sub-command.

True, but then you don't get the nice error messages for free when you leave off the sub-sub-command, like you do when you leave off a sub-command. You'd have to implement those messages yourself, which doesn't seem like a great solution.

Adding a user-meta command feels slightly neater in terms of implementation, but not quite as nice when you're calling code. Might be the simplest solution though.

@scribu
Copy link
Member

scribu commented May 31, 2012

Even if we implemented sub-sub-commands, we'd still likely need them to be in a separate class, so it's worth having user-meta as a first step.

scribu added a commit that referenced this pull request Jun 1, 2012
scribu added a commit that referenced this pull request Jun 1, 2012
scribu added a commit that referenced this pull request Jun 1, 2012
* rename 'user-meta set' to 'user-meta update'
* add 'user-meta add' and 'user-meta delete'

See #117
@scribu
Copy link
Member

scribu commented Jun 1, 2012

I merged everything except the --url commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants