Forum Replies Created
-
AuthorPosts
-
Yasmine
ParticipantI tried with the
print_rbut did not fix it.I also found that if I use the shortcode directly on the template, it will show the first value. But using it via the meta box group widget shows nothing
Yasmine
ParticipantHi Peter,
Yes of course:
$prefix = ''; 'name' => __( 'Archived Users', 'your-text-domain' ), 'id' => $prefix . 'archived_team_users_group', 'type' => 'group', 'fields' => [ [ 'name' => __( 'Former team members', 'your-text-domain' ), 'id' => $prefix . 'former_team_member', 'type' => 'user', 'field_type' => 'checkbox_list', 'select_all_none' => true, 'query_args' => [ 'role' => 'archive_team', ], ],Yasmine
ParticipantOh thats a clever idea. I have been able to output when users are attached to a post before. To give context on what I am trying to do: I am trying to show members of my team and the community. Before, I used a CPT to show team members and wider community, but was too much admin. So I wanted to dynamically populate and keep updated. Can I add a
get_users($args)as the posts value with this method?I tried with the
get_users, was fine for text but I struggled with their image. I use a custom field for my avatar, and so when I triedget_avatar_url()/get_avatar(), it returned the default avatar and not the users avatar. And when I tried$image =rwmb_meta( 'custom_avatar', ['size' => 'thumbnail'], $user_id); src=$imageit returned nothing.So still unsure which direction to go. If I can fix the second issue, then I think it might make more sense for my usecase.
Many thanks,
YasmineYasmine
ParticipantHi Peter,
I am just trying to query a term from a post. And so dependent on if a taxonomy term was selected to do X
So I guess its your last snippet - thank you!Yasmine
ParticipantHi Peter, thank you for your reply. Actually - it was my fault again. I was using WS Forms, and it wasn't saving the value in the database. But it did when I tried through metabox frontend. They now found that your admin save compared to your rwmb_set_meta function is different, and so they are updating their integration. Thanks anyway
Yasmine
ParticipantYou can delete this. It was not the shortcode..
Yasmine
ParticipantHi Long, I don't know how to share screenshots with this form, so will email
Yasmine
ParticipantOh I think I worked it out - the above was my first attempt using the label, not the value - and I think that is what was wrong!
Yasmine
ParticipantSorry in above it just shows the different filters I tried. Also tried:
$checked_box = rwmb_meta('hidden_published_already', '', $post->ID ); if (( $new_status == 'publish') && ($old_status != 'publish') && (get_post_type( $post ) == 'research') && ($checked_box == 0)){Yasmine
Participant$checked_box = rwmb_get_value('hidden_published_already', '', $post->ID ); if (( $new_status == 'publish') && ($old_status != 'publish') && (get_post_type( $post ) == 'research') && (($checked_box == 'Not published') || ($checked_box == 0))){ ..}// 0 is the value of unpublishedThis is what I have. It either works, or it doesn't work. It doesn't work if I use === 0, but it does work if I use ==0. The issue is, using == 0 also means it fires when the value is 1
Yasmine
ParticipantHey long, the field I am actually having issues with is a radio field with the values 0 and 1.
I was trying with
rwmb_metain exactly the format you share, however I thought maybe I should be using a different filterYasmine
ParticipantThanks Long, that clarifies.
But if I use the post field, how do I update the relationship field too? I use the relationship to query both ways on other parts of the site, so important this is also updated
Yasmine
ParticipantOk, worked out how to hide:
'hidden' => 1But still keen to learn how to get rid of the second password. Do I perhaps need to hide it too and create an attribute for
stdto equal the value of the first password?Yasmine
ParticipantOk Long, thank you for the clarification.
And my second question - how do you add custom fields to if statements?
Can I do it like:
$co_author_email = rwmb_meta( 'academicadd_co_author', '', $post->ID ) If ($co_author_email == 'y')This is for something else, and the code works perfectly if no custom field conditions in the if statement, but then adding custom field conditions into if statements stops it from executing, even though the value is definitely there
Yasmine
ParticipantA follow up question - in my IF statement, where I want to check a custom fields value is equal to 'y'. Have I done this correctly? I have another piece of code and it works when I don't query against the value of a custom field, but when I try to query that it equals a custom field value it returns and does not execute my code (even though I checked and the value is definitely correct)
-
AuthorPosts