How can I display profile info on certain pages by ID? I am wanting to create a publicly visible page for each of my users so that customers can get their information easier.
I figured out how to pull in the data from the custom user meta fields by ID. Here’s an example on how I pulled in a new meta field for Company Name.
// set this to whatever user's info you want to display on the page or remove it and send this value through the URL instead
$user_id = '1';
// set single argument to true
$single = true;
// get the company name and assign to a variable
$jam_get_company_name = get_user_meta( $user_id, 'company-name', $single );
This reply was modified 11 years, 5 months ago by visualharmony.
I tried using the type=”public” shortcode, but it was still showing an editable form for some reason. I didn’t want random visitors to the site to be able to edit profiles, only view them. I am able to do this now using code similar to the example code I posted above to pull the data and a custom template I am building to display that data.
When you use type=”public”, then “Update” button suppose to disappear, so random use won’t edit the information. BTW, you can add html field and write your own html to populate user public profile. and you can use placeholder(e.g %user_login%) for retrieving user data into html fields.
Thanks.
Author
Posts
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic.
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.AcceptRead More
Privacy & Cookies Policy
Privacy Overview
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.