Home › Forums › Legacy Support › Support queries › How-to & Troubleshooting › Include last name on certificate
Tagged: certificate, last name
- This topic has 10 replies, 5 voices, and was last updated 8 years, 8 months ago by info2grow.
Viewing 11 posts - 1 through 11 (of 11 total)
-
AuthorPosts
-
March 15, 2016 at 12:14 pm #36487bjorn_bewebParticipantHello...how do I include the last name for a student on their certificate? When a new student registers via my check-out process, they enter both their first and last name as part of the billing details, but for some reason only the first name makes it to the 'Profile name' which seems to be used for the certificate. I saw another post where it was suggested to use something like this on the certificate: [certificate_student_field field="Last name"] or possibly <span style="line-height: 1.5;">[certificate_student_field field="billing_last_name"] </span><span style="line-height: 1.5;">but I can't get that to work.</span> Is there another way to make this work? I'm happy to use a filter or a hook if that can solve the problem. Thanks, BjornMarch 15, 2016 at 1:09 pm #36521H.K. LatiyanParticipantFor this you can ask your users to fill the full name in name field.March 16, 2016 at 11:41 am #36749bjorn_bewebParticipantWell, the user accounts are created during the checkout process, and the user registration fields are (amongst others) first name and last name, so your suggestion is not really going to work for me. I have tried adding a hook called 'user_register' where I have tried to set the 'display_name' for the wordpress user, but it's not updating the display name or the 'Name' that is used on the 'Extended Profile' tab when editing a user. I've noticed that whatever is entered for 'Name' is used on the certificate. I've also noticed that if I change the Display name in the normal WP user edit page, the 'Name' is also updated. So, my question is this. How can I update the 'Name' field after registering a user. I'm thinking I should be able to use a code such as the one below, but that's not working, so I'm hoping you can tell me how I can update the 'Name' field using a post-registration hook.
Btw, I've tried to format my code example above a bit better, but it doesn't seem like your editor treats my apostrophies and ambersands very well, but you can probably make out what I'm trying to do.add_action('user_register', 'wplms_registration_save', 10, 1); function wplms_registration_save($user_id) { if (isset($_POST['billing_first_name']) && isset($_POST['billing_last_name'])) { $display_name = sanitize_text_field($_POST['billing_first_name']) . ' ' . sanitize_text_field($_POST['billing_last_name']); update_user_meta($user_id, 'display_name', $display_name); } }
March 17, 2016 at 12:46 pm #37095Anshuman SahuKeymasterWell for this you need to match the buddypress profile fields that appears in buddypress register page and woocommerce checkout fields which you can do with the help of a third party plugin . One of which is : https://wordpress.org/plugins/woocommerce-buddypress-integration-xprofile-checkout-manager/ Note : we have not used this plugin so we cannot say anything that it will fulfill your purpose . Also wordpress automatically fills the display_name field in the database of the user with the first name field that user provide at check out .March 17, 2016 at 6:39 pm #37159RMASpectator@ Bjorn - did you get any resolution for this issue? We have the same problem, and they only way to fix it is to go to each user and change in "display publicly as" the first name with full name. It looks like the name on certificate is picked from here, so whatever name shows on "display publicly as", that is what shows on the certificates.March 18, 2016 at 2:44 pm #37412H.K. LatiyanParticipantI am not sure if this is an issue. You already have a short code for this. For example : You have created two custom fields : First name and Last name. So you can simply use the shortcode twice : [certificate_student_field field="First Name"] [certificate_student_field field="Last Name"] --------------- Otherwise whatever is filled by the student in display name appears with the shortcode [vibe_certificate_student_name] SO as you can see these are two ways to print the name in the certificate. Let me know if I missed something.March 18, 2016 at 10:01 pm #37458bjorn_bewebParticipant@Latiyan that sounds great in theory, but as I said in my original post, these shortcodes does not appear to be working. Have you actually tried this to check that it works? I've tried with both the label names and the actual fields names (billing_first_name, billing_last_name). Even if that worked, another issue would appear as I would need to find a way to make it possible for the students to update those details as at the moment, these details are not available to be updated when logging in as a student. I would much prefer a solution where the 'display publicly as' field defaults to both first name and last name, instead of just first name. It seems a lot more logical to have a student's full name printed on their certificate as opposed to just the first name.March 19, 2016 at 12:11 pm #37618Anshuman SahuKeymasterthis is the only solution available as of now. Unfortunetely there is no option to match the woocommerce checkout fields and buddypress profile fields available as of now . You can search for third party plugins for this .April 25, 2016 at 12:41 am #44651info2growSpectatorAdd this to functions.php or your own plugin add_shortcode( 'get_user_fullname', 'get_user_fullname' ); function get_user_fullname(){ global $current_user; get_currentuserinfo(); return $current_user->first_name . ' ' . $current_user->last_name; } Then use the shortcode [<span style="line-height: 1.5;">get_user_fullname]</span>April 25, 2016 at 10:45 am #44738H.K. LatiyanParticipant@info2grow: Thanks for sharing the information/code.April 25, 2016 at 3:11 pm #44787info2growSpectatorno problem, the shortcode should be [get_user_fullname] -
AuthorPosts
Viewing 11 posts - 1 through 11 (of 11 total)
- The topic ‘Include last name on certificate’ is closed to new replies.