User custom fields
Support › MB User Meta › User custom fields
- This topic has 6 replies, 3 voices, and was last updated 1 year, 5 months ago by
Gene Teigland.
-
AuthorPosts
-
July 21, 2021 at 10:46 PM #29622
[email protected]
ParticipantHi, I created a custom field for users. I have images, URL for social media like FB, Instagram, Linkedin. How can I put this into my page. I tried through MB view but nothing show.
I use oxygenbuilder. (Is the expected date for integration metabox with oxygen?)
July 22, 2021 at 10:30 AM #29630Long Nguyen
ModeratorHi Artur,
Can you please share the View code that you create to show field values? You can follow the documentation to create a shortcode with PHP code then insert the shortcode to the Oxygen Builder to show the user meta
https://docs.metabox.io/extensions/mb-user-meta/#getting-field-value
https://docs.metabox.io/extensions/meta-box-group/#outputing-group-with-page-buildersJuly 22, 2021 at 1:10 PM #29639[email protected]
ParticipantI use the simple code that was generated by the metabox. I choose insert field -> User -> field id. Then I added this shortcode to the oxygen template.
{% for item in user.zdjecie %} <img src="{{ item.thumbnail.url }}" width="{{ item.thumbnail.width }}" height="{{ item.thumbnail.height }}" alt="{{ item.thumbnail.alt }}" /> {% endfor %}
July 22, 2021 at 9:44 PM #29647Long Nguyen
ModeratorHi Artur,
I see the View shortcode works as well on my site. You can assign the Type to Shortcode and add the shortcode to the Oxygen Builder. Screenshot https://share.getcloudapp.com/Kou4PxRd
July 31, 2021 at 6:21 PM #29817[email protected]
ParticipantYes, I use shortcode but this doesn't work.
Look at this page: https://brandnewportal.stronazen.pl/reklama/reklama-na-facebooku-przewodnik-krok-po-kroku/
The first image is created followed your tutorial: https://metabox.io/create-custom-avatar/
The second image is from oxygenbuilder author pics and the builder shows the original avatar.
The third is Metabox view- shortcode and is invisible.August 1, 2021 at 3:35 PM #29828Long Nguyen
ModeratorHi,
I got the issue. The tab
user
in the View support getting the meta of logged-in user. If you want to get the user meta from a user, please use the helper functionrwmb_meta()
. Get more details on this documentation
https://docs.metabox.io/extensions/mb-user-meta/#getting-field-value
https://docs.metabox.io/extensions/mb-views/#running-php-functionsFor example
{% set user_image = mb.rwmb_meta( 'zdjecie', {object_type: 'user'}, 1 ) %} <img src="{{user_image.url}}" >
November 3, 2023 at 10:50 PM #43735Gene Teigland
ParticipantHi Support,
I have created a custom fields (Advance select ) with multiple select option into the user section.
Now I want to update this user meta fields through the custom hook.I am trying to update the meta through the core wordpress function
$new_user_groups = array(
'r2Clips',
'r2_NewsGossip',
'r2_Lifestyle'
);update_user_meta($user_id, 'user_groups', $new_user_groups );
But it is not working. Can you please suggest me how we can update the custom fields value for user ? -
AuthorPosts
- You must be logged in to reply to this topic.