Jump to content

TiagoSilva

New Members
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

0 Neutral

About TiagoSilva

  • Rank
    Newbie
  1. Hey Guys, Can someone give a little help? I found that it returns 2 arrays. For example Array ( [0] => 3 ) Array ( [0] => 1 ) ....thats why the substr() is not working. Because if I tried to get the first element it would give me "31". And the second element would be "empty". <?php $userlist = get_users_who_favorited_post($post_id = null, $site_id = null); foreach ($userlist as $user) { $int= "{$user->data->ID}"; // 31 (not a sequence like I thought) $arr1 = str_split($int); print_r($arr1); //Array ( [0] => 3 ) Array ( [0] => 1 ) } ?> I want to obtain the first element "3" .....and the second element "1" ....separately ...... how can i do this? Thanks,
  2. Hello, I tried with substr ...but no success until now.. <?php $userlist = get_users_who_favorited_post($post_id = null, $site_id = null); foreach ($userlist as $user) { $int="{$user->data->ID}"; //returns 1234 (Example) } echo substr($int, 1, 1); ?> its not working. is there an alternative to substr?? any sugestions? Thanks,
  3. Hello, You did it! =) <?php $userlist = get_users_who_favorited_post($post_id = null, $site_id = null); foreach ($userlist as $user) { echo "{$user->data->ID}"; } ?> Another question. I want to echo only the first ID number .....or only que second ID number ....how can I do that?
  4. Hello, Thanks for the help. So it starts like this: <?php $userlist = get_users_who_favorited_post($post_id = null, $site_id = null); <--- gives the array above what should I type here? print_r($userlist) ?> And I want a formula to get only ID´s .....and another formula to obtain only emails... Thanks
  5. Hey guys, Ive spent weeks trying to filter this array. Can someone help me? I want to filter and display only user ID´s or only emails. How do I do that? Array ( [2] => WP_User Object ( [data] => stdClass Object ( [iD] => 3 [user_login] => test [user_pass] => $P$FSBSFByN.kDA20C2B1HLYtossdD1 [user_nicename] => test [user_email] => noreply1@test.com [user_url] => [user_registered] => 2016-06-28 06:41:10 [user_activation_key] => [user_status] => 0 [display_name] => Albert Einstein ) [iD] => 3 [caps] => Array ( [subscriber] => 1 ) [cap_key] => wp_capabilities [roles] => Array ( [0] => subscriber ) [allcaps] => Array ( [read] => 1 [level_0] => 1 [subscriber] => 1 ) [filter] => ) [3] => WP_User Object ( [data] => stdClass Object ( [iD] => 1 [user_login] => Almert [user_pass] => $P$BXkFcAfewww771GjlUxmm.696EB0 [user_nicename] => Goof [user_email] => tiadgw3@hotmail.com [user_url] => [user_registered] => 2016-06-25 09:54:12 [user_activation_key] => [user_status] => 0 [display_name] => tiadgw3 ) [iD] => 1 [caps] => Array ( [administrator] => 1 ) [cap_key] => wp_capabilities [roles] => Array ( [0] => administrator ) [allcaps] => Array ( [switch_themes] => 1 [edit_themes] => 1 [activate_plugins] => 1 [edit_plugins] => 1 [edit_users] => 1 [edit_files] => 1 [manage_options] => 1 [moderate_comments] => 1 [manage_categories] => 1 [manage_links] => 1 [upload_files] => 1 [import] => 1 [unfiltered_html] => 1 [edit_posts] => 1 [edit_others_posts] => 1 [edit_published_posts] => 1 [publish_posts] => 1 [edit_pages] => 1 [read] => 1 [level_10] => 1 [level_9] => 1 [level_8] => 1 [level_7] => 1 [level_6] => 1 [level_5] => 1 [level_4] => 1 [level_3] => 1 [level_2] => 1 [level_1] => 1 [level_0] => 1 [edit_others_pages] => 1 [edit_published_pages] => 1 [publish_pages] => 1 [delete_pages] => 1 [delete_others_pages] => 1 [delete_published_pages] => 1 [delete_posts] => 1 [delete_others_posts] => 1 [delete_published_posts] => 1 [delete_private_posts] => 1 [edit_private_posts] => 1 [read_private_posts] => 1 [delete_private_pages] => 1 [edit_private_pages] => 1 [read_private_pages] => 1 [delete_users] => 1 [create_users] => 1 [unfiltered_upload] => 1 [edit_dashboard] => 1 [update_plugins] => 1 [delete_plugins] => 1 [install_plugins] => 1 [update_themes] => 1 [install_themes] => 1 [update_core] => 1 [list_users] => 1 [remove_users] => 1 [promote_users] => 1 [edit_theme_options] => 1 [delete_themes] => 1 [export] => 1 [edit_newsletters] => 1 [publish_newsletters] => 1 [delete_newsletters] => 1 [edit_others_newsletters] => 1 [delete_others_newsletters] => 1 [duplicate_newsletters] => 1 [duplicate_others_newsletters] => 1 [mymail_edit_autoresponders] => 1 [mymail_edit_others_autoresponders] => 1 [mymail_change_template] => 1 [mymail_save_template] => 1 [mymail_see_codeview] => 1 [mymail_change_plaintext] => 1 [mymail_edit_subscribers] => 1 [mymail_add_subscribers] => 1 [mymail_delete_subscribers] => 1 [mymail_edit_forms] => 1 [mymail_add_forms] => 1 [mymail_delete_forms] => 1 [mymail_manage_subscribers] => 1 [mymail_import_subscribers] => 1 [mymail_import_wordpress_users] => 1 [mymail_export_subscribers] => 1 [mymail_bulk_delete_subscribers] => 1 [mymail_add_lists] => 1 [mymail_edit_lists] => 1 [mymail_delete_lists] => 1 [mymail_manage_templates] => 1 [mymail_edit_templates] => 1 [mymail_delete_templates] => 1 [mymail_upload_templates] => 1 [mymail_update_templates] => 1 [mymail_dashboard_widget] => 1 [mymail_manage_capabilities] => 1 [manage_sws] => 1 [rcp_view_members] => 1 [rcp_manage_members] => 1 [rcp_view_levels] => 1 [rcp_manage_levels] => 1 [rcp_view_discounts] => 1 [rcp_manage_discounts] => 1 [rcp_view_payments] => 1 [rcp_manage_payments] => 1 [rcp_manage_settings] => 1 [rcp_export_data] => 1 [rcp_view_help] => 1 [modal_login_settings] => 1 [administrator] => 1 ) [filter] => ) )
  6. Hello, I need a little help, I would greatly appreciate if someone helped me with this. I have 3 functions, and I want to make them work the following way: Function 1: This function gives me a list of users who liked a blog post. It gives me an HTML list. I want a formula which filters the output giving me ONLY the first value of the list. Or only the second value. Or only the third value. the_users_who_favorited_post($post_id = null, $site_id = null, $separator = 'list', $include_anonymous = true, $anonymous_label = 'Anonymous Users', $anonymous_label_single = 'Anonymous User'); Example of output: John Albert Mary I want to filter the list and obtain only the first value: John. Or obtain only the second: Albert Function 2: This function gives me the ID of the user. And I need to bring the value from the Function 1 and insert in this functon 2: <?php $user = get_userdatabylogin('value from function 1 here'); if($user){ echo $user->ID; } ?> The output from function 1 goes "value from function 1 here". And it will give me the ID. Function 3: This code will give me the user avatar, from the ID i obtain from function 2. <?php echo get_avatar( ID goes here , '100' ); ?> The output from function 2 goes "ID goes here". And it will give me the profile avatar picture. I need to join these formulas together, and make them work. Does anyone know how to do this? Thanks.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.