Solved

Wordpress query usermeta with additional fields

Posted on 2013-06-26
6
537 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Get Database Help Now w/ Support & Database Audit

Keeping your database environment tuned, optimized and high-performance is key to achieving business goals. If your database goes down, so does your business. Percona experts have a long history of helping enterprises ensure their databases are running smoothly.

 
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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

751 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