Here is some code; you need to see that the $current_user variable is actually an object and not an array ( USE $current_user->user_login AND NOT $current_user['user_login'] ).
I also added a simple check to make sure the user is logged in.
// Set the Query POST parameters - array
$query_vals = array(
'api_username' => 'api-username-goes-here',
'api_password' => 'password-here',
'api_key' => 'api-key-here'
);
//if( is_user_logged_in() ):
global $current_user;
get_currentuserinfo();
$query_vals['username'] = $current_user->user_login;
$query_vals['password'] = $current_user->user_pass;
//else:
//wp_die('You must be logged in');
//endif;
Related Posts:
- How to properly loop through these external URLs to get them into the sitemap using this hook
- Foreach loop inside an array_merge
- Sorting list of sites from multisite network using wp_get_sites
- How to store the_title() into a variable to reutrn the value, not just echo it
- Create a global variable for use in all templates
- Add extra field to users
- Integrating WordPress to my website, while keeping my own authentication system
- Metabox repeating fields – radio buttons not saving correctly
- Display user’s total comment count outside The Loop
- How can merge two arrays values in one array and save in database
- Changing user_nicename
- How to auto login user again after change user_login
- What is the most efficient way to search users by their display name?
- How can I get an XML export of my 1K+ posts WordPress instance?
- Can i check if user is doing any ajax request?
- How do I create a WP user outside of WordPress and auto login?
- How to update single value in multi dimensional Post Meta?
- Network installation giving errors when viewing or adding a user
- Showing user ID on user main page from screen options
- Getting the Current User
- How do I hide specific user profile fields?
- Error in WP_update_post
- Authenticating to WordPress, using my own authentication two-factor system
- Compare two meta key values against each other inside the get_posts array?
- How to track a users progress through pages by inserting data into WordPress Database?
- Looping through WP_Post Object
- Need to get specific data from array
- Using a javascript file to access a get posts array
- Create an array from an array
- WP_User_Query order by meta_key that is an array
- automated tests as a user?
- How can I default to all WordPress roles when parameter is not included in shortcode?
- How can I export post data in xml format?
- there’s a way to include a minimal WP for check only the current user, its roles (caps?) and then release/free it?
- Generate an array of parent/child page IDs, based on parent page name
- How do I output a database option that is an array into a get_posts array?
- Delete option value from array using update_option()
- Can an array be used as a meta_query value?
- Listing and displaying WooCommerce Shipping Zones in the frontend? [closed]
- How do I dynamically generate args for wp_query?
- List of posts by day of the week
- Check if term object is in array
- get_users(…) only returns one user
- How to limit the content coming from wordpress shortcodes?
- List User order by ID in Descending order (Backend)
- Must Use Plugin Causing Query Error
- ‘orderby’ => ‘rand’ alternative for better performance?
- Warning: Use of undefined constant HTTP_USER_AGENT – assumed ‘HTTP_USER_AGENT’ (this will throw an Error in a future version of PHP)
- How to convert objects into arrays
- Parsing php string in jquery [closed]
- Admin Options page. Save as Array
- Get all user meta by meta key instead of ID
- PHP get the first post separately from array returned by wpdb->get_results()
- Working with query_posts ( arrays and query strings)
- How to get a list of all possible values of a specific user meta key?
- how can i show only the parents in owl-carousel?
- Create shortcodes within foreach loop (using array)
- Using a variable in is_page(array())
- Remove duplicates – array_unique()
- How can I add multiple ‘tax_query’ arrays via a loop?
- Recent posts with featured image or fallback image with permalink
- Call global variable array() in woocommerce child/template
- Storing Array from returned database query and using the array in a new query
- User’s total comment count excluding comments on their own posts
- get_the_tags() not iterating through for/while loop, but will with foreach
- get a simple array of all of the term names that exist in all taxonomies
- User management system similar to wordpress one?
- Populate dropdown with Child Pages based on Parent Page chosen
- Show all posts by author
- How to use $query->set with post__in?
- Custom user login page by creating a plugin
- Programmatic Login from 3rd Party site
- Reprinting tags with all attributes
- How to make a XML/PHP file returning custom field data from page
- Add New User, extra fields which are required?
- user_profile_update_errors hook not executing
- PHP Array Returning [object Object]. Tried existing answers results with no luck
- Modify user profile data through scripting?
- foreach loop still echoes array
- Get users that likes the post
- custom user role wordpress – grant guest access to edit.php without insert/update/delete
- How to split links generated into an xml sitemap to avoid exceeding 30 sec maximum execution time?
- Exclude posts based on meta value
- add_cap not working
- Do not execute If User is login as Administrator or any Specific Role
- Checking array against author id in loop
- wordpress archive a user
- Display image from an external rss feed on wordpress without plugins
- Best practice for show data to one specific user?
- Call to undefined function get_userdata() in plugin
- Alter required message using comment form api
- Advanced Custom Fields – display label and value only if value entered
- get_users meta_query: REGEXP not working for matching new lines
- Change CSS based on is_user_logged_in
- meaning of (array)function()
- Grouping posts by a custom meta value
- How to show a users bio on a page
- “operation successful” message
- wp_force_remove_style’ not found
- How to fix this warning:call_user_func_array() expects exactly 2 parameters, 1 given in D:\wamp\www\…….\wp-includes\class-wp-hook.php on line 286