OSDN Git Service

Listing each cap on a separate line
authormpeshev <mario@peshev.net>
Mon, 5 Aug 2013 23:22:10 +0000 (02:22 +0300)
committermpeshev <mario@peshev.net>
Mon, 5 Aug 2013 23:22:10 +0000 (02:22 +0300)
php/commands/user.php

index e1aca7a..8fcb031 100644 (file)
@@ -527,20 +527,14 @@ class User_Command extends \WP_CLI\CommandWithDBObject {
                
                $user_caps_list = $user->allcaps;
                $cap_table_titles = array( 'capability', 'status' );
-               
-               // Get all active caps (marked as true)
-               $active_user_caps = array();
+                               
+               WP_CLI::success( "User caps (role and individual) are: " );
                
                foreach( $user_caps_list as $cap => $active ) {
                        if( $active ) {
-                               $active_user_caps[] = $cap;
+                               \cli\line( $cap );
                        }
                }
-               
-               // Omit formatting from the Utils class due to the assoc array format
-               $user_caps = implode( ', ', $active_user_caps );
-
-               WP_CLI::success( sprintf( "User caps (role and individual) are: %s.", $user_caps ) );
        }
 
        private static function get_user( $id_or_login ) {