Forum Replies Created
-
AuthorPosts
-
November 16, 2022 at 5:14 AM in reply to: ✅Insert Custom Post Type content into Category term-description #39159
Denise Field
ParticipantFor reference if anyone else wants to use that plugin the entire function to display the custom post is
add_action( 'woocommerce_after_main_content', 'add_alt_description', 10 ); function add_alt_description(){ $term_id = get_queried_object_id(); $value = rwmb_meta( 'alt_page_id', ['object_type' => 'term'], $term_id ); echo '<div class="container"><div class="alt-category"><div class="alt-category__page"><div class="alt-category__content"> ' ; echo do_shortcode("[insert page='$value' ]"); echo '</div></div></div></div>'; }*** The insert page shortcode does strip all the divs from the page you may have set up for styling so I just added them back in with this function ***
This was just perfect for large content to display in the product category pages, so much better than the tiny box woocommerce gives you!
November 16, 2022 at 2:58 AM in reply to: ✅Insert Custom Post Type content into Category term-description #39157Denise Field
ParticipantThank you, its now working!
Denise Field
Participantthank you that worked perfectly!
November 8, 2022 at 8:59 PM in reply to: ✅Passing a variable value to a hidden field in Frontend Form Submission #39001Denise Field
ParticipantI solved it myself thank you, here is how I did it , for anyone else wishing to do this that has some level of skill but not a developer.
1. Created the Custom Field Types using the Metabox interface. Set them up exactly as I want, without the default value.
2. ClickedGet PHP Codeand copied that code, minus the<?phptag into my functions.php
3. Added my PHP query to get the user details
`global $current_user;
get_currentuserinfo();
$user_name = $current_user->display_name;
$user_email = $current_user->user_email;
$user_first = $current_user->user_firstname;
$user_last = $current_user->user_lastname; `4. added the
'std' => $user_name,etc etc to each field to show the correct variable
5. output the shortcode of the form<?php echo do_shortcode("[mb_frontend_form id='request-membership-status' ]") ?>
Job Done!!!
Here is the complete function I created so if anyone else wants to follow it they can see how it has to be set up as a working function for theMB Frontend Submissionform.add_filter( 'rwmb_meta_boxes', 'request_membership_status' ); function request_membership_status( $meta_boxes ) { $prefix = ''; // your code to get the current user name here global $current_user; get_currentuserinfo(); $user_name = $current_user->display_name; $user_email = $current_user->user_email; $user_first = $current_user->user_firstname; $user_last = $current_user->user_lastname; $meta_boxes[] = [ 'title' => __( 'Request Membership Status', 'pinkequine-com' ), 'id' => 'request-membership-status', 'post_types' => ['membership-request'], 'fields' => [ [ 'name' => __( 'First Name', 'pinkequine-com' ), 'id' => $prefix . 'user_first', 'type' => 'text', 'admin_columns' => 'replace title', 'std' => $user_first, ], [ 'name' => __( 'Last Name', 'pinkequine-com' ), 'id' => $prefix . 'user_last', 'type' => 'text', 'admin_columns' => 'after user_first', 'std' => $user_last, ], [ 'name' => __( 'Username', 'pinkequine-com' ), 'id' => $prefix . 'user_name', 'type' => 'text', 'admin_columns' => 'after user_last', 'std' => $user_name, ], [ 'name' => __( 'Email', 'pinkequine-com' ), 'id' => $prefix . 'user_email', 'type' => 'text', 'admin_columns' => 'after user_name', 'std' => $user_email, ], [ 'name' => __( 'Membership', 'pinkequine-com' ), 'id' => $prefix . 'checkbox_membership', 'type' => 'checkbox', 'label_description' => __( 'Please add user Member to my profile', 'pinkequine-com' ), 'required' => true, 'admin_columns' => 'after user_email', ], ], 'validation' => [ 'rules' => [ $prefix . 'checkbox_membership' => [ 'required' => true, ], ], 'messages' => [ $prefix . 'checkbox_membership' => [ 'required' => 'Please check the box to confirm your request', ], ], ], ]; return $meta_boxes; }November 8, 2022 at 4:06 PM in reply to: ✅Passing a variable value to a hidden field in Frontend Form Submission #38999Denise Field
ParticipantMorning, can I just clarify, is there a way, using MB Builder and Frontend Form Submission, to set the
stdto a variable?November 8, 2022 at 5:55 AM in reply to: ✅Passing a variable value to a hidden field in Frontend Form Submission #38997Denise Field
ParticipantEDIT: I corrected a typo on the last 2 variables.
Here is how I am calling the form and that shows up exactly as expected
echo do_shortcode ("[mb_frontend_form id='request-membership-status' ]")And here is one of the form fields to be populated with the variables
ScreenshotNovember 8, 2022 at 4:57 AM in reply to: ✅Passing a variable value to a hidden field in Frontend Form Submission #38996Denise Field
ParticipantI think I must be doing something wrong? The code isnt populating the fields on the form, do I need to add something to the shortcode?
Here is the function I created
add_filter( 'rwmb_meta_boxes', function ( $meta_boxes ) { // your code to get the current user name here global $current_user; get_currentuserinfo(); $user_name = $current_user->display_name; $user_email = $current_user->user_email; $user_first = $current_user->user_firstname; $user_last = $current_user->user_lastname; $meta_boxes[] = [ 'fields' => [ [ 'name' => 'username', 'id' => 'user_name', 'type' => 'text', 'std' => $user_name ], [ 'name' => 'email', 'id' => 'user_email', 'type' => 'text', 'std' => $user_email ], [ 'name' => 'firstname', 'id' => 'user_firstname', 'type' => 'text', 'std' => $user_firstname ], [ 'name' => 'lastname', 'id' => 'user_lastname', 'type' => 'text', 'std' => $user_lastname ], ], ]; return $meta_boxes; } );Can you help?
November 8, 2022 at 3:13 AM in reply to: ✅Passing a variable value to a hidden field in Frontend Form Submission #38995Denise Field
ParticipantThanks I did see that on the docs, but thought it was more of a general setting and I wondered about conflicts - e.g all user name fields as user_name that it would cause an issue in the post_meta table.
However, if I am understanding what you are saying is that I could have several fields e.g.
user_name1,user_name2etc and then declare them each in here with the same variable name in this case$user_name.Thank you for this, I've literally read so much php/sass/jquery etc my eyes are going funny! Sometimes you can't see the wood, for the trees!
November 2, 2022 at 4:36 PM in reply to: User Profile update user role overwrites additional roles #38929Denise Field
ParticipantJust one more thing, if your Devs do include it, all they need to do is to ensure that the record is not completely overwritten
Other plugins have added user roles this is how the usermeta looks:
a:3:{s:8:"customer";b:1;s:14:"yith_affiliate";b:1;s:9:"um_member";b:1;}So, something like if the role to be added does not exist, then add it, not overwrite the original, especially as woocommerce adds
customeras the primary user and relegates all others.Hope that helps with the dev.
November 2, 2022 at 4:24 PM in reply to: User Profile update user role overwrites additional roles #38928Denise Field
ParticipantI see, I will probably have to make it a manual request for now then via email because I have am using the plugins USER ROLE EDITOR, YITH AFFILIATES and WOOCOMMERCE all of these add user roles to the main one.
Thank you for your consideration of this in future updates though.
October 13, 2022 at 11:24 PM in reply to: ✅How to get a Metabox to show up on custom post type which uses one page #38657Denise Field
ParticipantThank you that sorted it! It wasnt working at first because I'd changed the fieldname to something random after I had put the metabox entry on the configurator post, but I went into the postmeta and changed it to the renamed one and it works a dream!!!! Thank you
October 2, 2022 at 6:12 PM in reply to: ✅Custom Text Field with Shortcode not showing up correctly on frontend #38510Denise Field
ParticipantThank you that worked!
September 26, 2022 at 3:27 AM in reply to: ✅Meta box Group with tags showing up twice in output #38417Denise Field
ParticipantOk I solved it myself, I was using the wrong code snippet
I used this and it worked
<?php $values = rwmb_meta( 'my_field_id' ); ?> <ul> <?php foreach ( $values as $value ) : ?> <li><?= $value ?></li> <?php endforeach ?> </ul>September 26, 2022 at 1:38 AM in reply to: ✅Meta box Group with tags showing up twice in output #38416Denise Field
Participantif ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } global $post; $short_description = apply_filters( 'woocommerce_short_description', $post->post_excerpt ); if ( ! $short_description ) return; // Bullet Points $bullet_points = '<ul class="product__short-description--bullets">' . rwmb_the_value( "product_bullet_point" ) . '</ul>'; // The custom text $custom_text = '<ul class="product__short-description--bullets--red"> <li>Please see our <a href="https://www.pinkequine.com/buyers-guide/">Buyers Guide</a> for current delivery times on Bespoke Products</li> </ul>'; ?> <div class="product__short-description"> <?php echo $short_description . $bullet_points . $custom_text ; // WPCS: XSS ok. ?> </div>September 26, 2022 at 1:37 AM in reply to: ✅Meta box Group with tags showing up twice in output #38415Denise Field
ParticipantSorry am having trouble getting the images to show up
Here is the Browser Output -
AuthorPosts