Solved

Wordpress query usermeta with additional fields

Posted on 2013-06-26
6
535 Views
Last Modified: 2013-06-27
Hey Experts!!

I have a query below that is working, however I need more information from different tables.

Can someone help or show me how to add additional tables to the query?

The fields I need are first and last names, along with 2 other fields in the s2member custom fields.  My end result would be to have only the users where the meta_value is equal to executive board and then list only those members out on the page. There are 3 total now and the query is showing those 3 in my for each, but I need additional data.

$users = $wpdb->get_results ("SELECT * FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_custom_fields' AND `meta_value` REGEXP '.*\"member\";s:[0-9]+:\"executive board\".*'");

Open in new window

0
Comment
Question by:LZ1
  • 3
  • 3
6 Comments
 
LVL 82

Expert Comment

by:hielo
ID: 39280875
Try:
$users = $wpdb->get_results ("SELECT U.display_name, U.user_nicename, U.user_email, U.user_status, M.* 
				FROM `" . $wpdb->usermeta . "` M INNER JOIN `" . $wpdb->users . "` U ON M.user_id=U.ID
				WHERE (`meta_key` = '" . $wpdb->prefix . "s2member_custom_fields') 
				AND `meta_value` REGEXP '.*\"member\";s:[0-9]+:\"executive board\".*'
				");

Open in new window


I did not see separate fields for 'firstName', 'lastName'.  I suspect that either display_name or user_name has what you are interested in.
0
 
LVL 30

Author Comment

by:LZ1
ID: 39281489
I'm not an SQL guy by any means. So I'm getting this as a response:
http://goo.gl/nOx1U 

Can you tell me why it's not returning only members with the "executive board" value?
0
 
LVL 30

Author Comment

by:LZ1
ID: 39281607
The fields I ultimately need would be in the wp_users and wp_usermeta tables. I need to only show people that have the executive board value in the wp_usermeta table. But I need the rest of the information as well to display on page.

I've printed out the 2 arrays I need on the page. I just need to know how to access things...
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 82

Expert Comment

by:hielo
ID: 39281683
I don't know what you are referring to.  The link you provided above requires me to register to some site using paypal.
0
 
LVL 30

Author Comment

by:LZ1
ID: 39282095
I forgot about that. Sorry.  

Here are the arrays:

Custom fields I need

        Array
(
    [0] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => first_name
            [label] => First Name
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [1] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => last_name
            [label] => Last Name
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [2] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => job_title
            [label] => Job Title
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [3] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => company
            [label] => Company
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [4] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => phone
            [label] => Phone
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [5] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => mobile
            [label] => Mobile
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [6] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => zip_code
            [label] => Zip/Postal Code
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [7] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => company_website
            [label] => Company Website
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => no
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [8] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => firm_type
            [label] => Firm Type
            [type] => radios
            [deflt] => 
            [options] => GP-buyout | GP: buyout
GP-venture | GP: venture
GP-mezzanine | GP: mezzanine
GP-distressed-credit | GP: distressed credit
GP-growth-equity | GP: growth equity 
---------- | ---------------------------------------------------------------
LP-Endowments-Foundations | LP:Endowments/Foundations
LP-Fund-of-Funds | LP:Fund of Funds
LP-Consultants | LP:Consultants
LP-Insurance-company | LP:Insurance company
LP-Public-Pension | LP:Public Pension
LP-Corporate-Pension | LP:Corporate Pension
LP-Family-Office-Wealth management | LP:Family Office/Wealth management
Placement Agent | Placement Agent
Attorney | Attorney
Other service provider | Other service provider
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [9] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => assets_under_management
            [label] => Assets Under Management
            [type] => select
            [deflt] => 
            [options] => N/A | N/A
<$150MM | <$150MM
$150-$250MM | $150-$250MM
$250-$500MM | $250-$500MM
$500-$1bn | $500-$1bn
$1-$2.5bn | $1-$2.5bn
$2.5-$5bn | $2.5-$5bn
$5bn+ | $5bn+
            [expected] => 
            [required] => no
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [10] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => firm_description
            [label] => Brief description of your firm and its approach to private equity investing
            [type] => textarea
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [11] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => describe_your_role
            [label] => Describe your role within the firm
            [type] => textarea
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [12] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => address
            [label] => Address
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [13] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => Address2
            [label] => Address 2
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => no
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [14] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => City
            [label] => City
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [15] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => State
            [label] => State
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [16] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => Country
            [label] => Country
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [17] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => geo_areas
            [label] => Geographical areas of interest
            [type] => checkboxes
            [deflt] => 
            [options] => Asia | Asia
US | US 
Europe | Europe
Emerging Markets | Emerging Markets
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [18] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => BIO
            [label] => BIO
            [type] => textarea
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [19] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => investment_areas
            [label] => Investment areas of interest
            [type] => checkboxes
            [deflt] => 
            [options] => Buyout | Buyout, 
Venture | Venture
Mezzanine | Mezzanine
Distressed Credit | Distressed Credit
Growth Equity | Growth Equity
Coinvest | Coinvest
Real Assets | Real Assets
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [20] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => member
            [label] => Member Of
            [type] => radios
            [deflt] => 
            [options] => executive board|Executive Board
steering committee|Steering Committee
            [expected] => 
            [required] => no
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [21] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => linkedin
            [label] => LinkedIn
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => url
            [required] => no
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [22] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => fb_url
            [label] => Facebook
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

)
My Member Of is executive board.     

Experts Exchange Array

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

Open in new window


I just need to know how to access the values inside of the arrays.
0
 
LVL 82

Accepted Solution

by:
hielo earned 500 total points
ID: 39282236
Let's say that you have a variable named $data which is initialized to the array that you have on lines 456-494.  This is how you get to the elements:
foreach($data as $i=>$item)
{
	//the 'meta_value' element in each $item is a serialized PHP array, so you need to unserialize it first
	$temp=(object)unserialize($item->meta_value);
	
	//THEN you can just echo the values.
	echo $temp->first_name.'<br>';
	echo $temp->last_name.'<br>';
	echo $temp->assets_under_management.'<br>';
	echo $temp->member.'<br>';
	
	//the other elements in $item - ex: display_name, user_nicename, etc. have literal values (number,string), NOT a PHP serialized array, so there is no need to unserialize anything from them.
	echo $item->display_name.'<br>';
	echo $item->user_nicename.'<br>';
	echo $item->user_email.'<br>';
	echo $item->user_status.'<br>';//etc
	
	
}

Open in new window

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
This article discusses four methods for overlaying images in a container on a web page
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question