Solved

Wordpress query usermeta with additional fields

Posted on 2013-06-26
6
521 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 82

Expert Comment

by:hielo
Comment Utility
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
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

In order to have all security and back ups taken care of, WordPress users can sign up for services with WP Engine.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

763 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now