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
- Integrating WordPress to my website, while keeping my own authentication system
- Showing user ID on user main page from screen options
- Getting the Current User
- 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?
- Looping through WP_Post Object
- Using a javascript file to access a get posts array
- 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()
- Listing and displaying WooCommerce Shipping Zones in the frontend? [closed]
- List of posts by day of the week
- Check if term object is in array
- How to get a list of all possible values of a specific user meta key?
- Create shortcodes within foreach loop (using array)
- Using a variable in is_page(array())
- Remove duplicates – array_unique()
- Recent posts with featured image or fallback image with permalink
- Storing Array from returned database query and using the array in a new query
- 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
- How to use $query->set with post__in?
- user_profile_update_errors hook not executing
- How to split links generated into an xml sitemap to avoid exceeding 30 sec maximum execution time?
- Exclude posts based on meta value
- Advanced Custom Fields – display label and value only if value entered
- Change CSS based on is_user_logged_in
- How to show a users bio on a page
- wp_force_remove_style’ not found
- How can I access string value in an array?
- Filtering a function’ output for a new continued function
- Error while setting role
- How to say if meta_value is greater than 0 in an array?
- If Array Values Match Another Array’s Values, Then
- How can I get all values from my array in a loop in php? [closed]
- Get all posts as an array ID => Name
- I’m unable to call img path using single quotes in an array?
- Get the id of all images in a post
- Output category list inside array
- Separate array output into a
- php return username of currently viewed author profile
- Update value of a associative array with update_post_meta
- How To Pass Array To get_the_category_by_ID() and Get An Array Back?
- How to list users like an archive page 10 users on page and have navigations
- Redirect to current user page upon link click
- Fetching review value using wpdb class
- Use of antispambot with $curauth->email
- Add custom fields from different posts
- MySQL Query Returns Array () In Shortcode
- Generate a QR code when creating a new WordPress user
- Change wordpress’ database data using ajax – how to get current user id?
- Sort column in Users admin Tab
- Create an array with all the links of the years’ archive (of a custom post type)
- Redux option doensn’t seem when include from functions.php
- Admin Panel 404 Error after login
- in_array not working on dev server but works on localhost
- How to block specific user id in custom login form?
- Get current user id in function php
- how can I call a function when time expire
- Display one random image from Media Library
- How to display MySQL table data which is stored as an array?
- Store data from JavaScript object to custom table in user account
- Import Instagram post as WordPress post
- How to change the value of a variable using input field?
- Show the subcategory name based on current product
- How do I track which user clicked my button?
- get_category_parents to array
- Notice : Array to string conversion on array_intersect user meta
- wordpress more than one ajax request at the same time issue
- Adding users to another blog
- Display posts using post ID’s in an array
- How can i iterate through this shortcode array?
- Changing WordPress author name in database
- Display a single row from nested array of custom field data
- Loop 1 user randomly
- Reformat data within a nested array
- Create Customization Controls from Array
- Non-array argument in array_merge()-function [closed]
- How to ‘remember’ a site member’s last visited page?
- How to connect database table to each registered wordpress user.
- Display a list of users with avatar filterable with alphabets
- Showing all post from all post type in admin backstage
- Parse error: syntax error, unexpected ‘}’ in C:\wamp64\www\Proiect\aplicatie\user_check.php on line 18 [closed]
- Use php array outside his function
- how to iterate through xml data?
- Check if username doesn’t exists
- Retrieve Array from within Array [closed]
- WP query with variables gives no result for specific user
- save array of objects with update_option
- How to initialise WP_Query on the basis of a specific meta_value and continue iterating rest?
- Replace block content with an array
- How to create custom user role without plugin?
- PHP Works only for logged in users: [closed]
- Custom Admin Menu Report for Specific User ID