use a foreach loop or two to get at the data you need. if you don't
want to do there there are some nice array handling methods in the
Core Set utility.
http://book.cakephp.org/view/640/Set

On Aug 5, 1:52 pm, Sami <[email protected]> wrote:
> So I'm building a new site for an existing site and one of the things
> I can't change is the database tables (because that would make my life
> easier).
>
> The user table is set up how cakephp likes its. The user_meta table is
> set up as such:
>
> meta_id, user_id, key, value
>
> So I have some users with 40-50 entries in the meta table while others
> only have 3 or 4.
>
> Then I do pr($user) I get this:
>
> Array
> (
>     [User] => Array
>         (
>             [ID] => 5
>             [user_login] => testwriter
>             [user_pass] => $P$Bq.
>             [user_nicename] => testwriter
>             [user_email] => [email protected]
>             [user_url] =>
>             [user_registered] => 2009-07-14 19:34:39
>             [user_activation_key] =>
>             [user_status] => 0
>             [display_name] => testwriter
>         )
>
>     [Metax] => Array
>         (
>             [0] => Array
>                 (
>                     [umeta_id] => 48
>                     [user_id] => 5
>                     [meta_key] => comment_shortcuts
>                     [meta_value] => false
>                 )
>
>             [1] => Array
>                 (
>                     [umeta_id] => 49
>                     [user_id] => 5
>                     [meta_key] => admin_color
>                     [meta_value] => fresh
>                 )
>
>             [2] => Array
>                 (
>                     [umeta_id] => 50
>                     [user_id] => 5
>                     [meta_key] => wp_capabilities
>                     [meta_value] => a:1:{s:6:"author";b:1;}
>                 )
>         )
> )
>
> I omited a lot of the metas just cause they would take forever to
> list. My question is what is a good way to access this data in a view?
> I can see user ID's by doing:
>
> echo $user['User']['ID']
>
> but how would I get a specific metadata? (the order is not the same
> for each user so I can't just use an array index)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to