sliontos
Forum Replies Created
-
[UPDATED] @wesley1066 & @xezormarkv
Because the {date} is the generated date of certification and that is not the real date of course completion I have added the following code…
….To work right is IMPORTANT to replace the following code in /wp-content/plugins/masterstudy-lms-learning-management-system/stm-lms-templates/stm-lms-certificates-generator.php
$_option_name = '_cert_date_' . str_replace ( '', '_',$username) . '_' . str_replace ( '', '_', get_the_title ( $course_id ) );….With this….
$_option_name = '_cert_date_' . str_replace ( chr(32), '_',$username) . '_' . str_replace ( chr(32), '_', get_the_title ( $course_id ) );…then, add the following code in the file /wp-content/plugins/masterstudy-lms-learning-management-system/stm-lms-templates/lesson/navigation.php
At line 63~ replace the:
<?php endif; ?>…with the following code….
<?php endif; $user = STM_LMS_User::get_current_user('', false, true); $username = $user['login']; $_option_name = '_cert_date_' . str_replace (chr(32), '_',$username) . '_' . str_replace (chr(32), '_', get_the_title( $post_id ) ); $_date = get_option( $_option_name ); if ( empty( $_date ) ) add_option ( $_option_name, date( 'Y-m-d' ), '', 'no' ); else update_option ( $_option_name, date( 'Y-m-d' ) ); ?>…this addition will save the last date of course completion to database. This is the real date of course completion.
Try it and let me know.
😉@wesley1066 & @xezormarkv Thank you very much guys!
@wesley1066…you welcome!
you can change the date format at this line ‘$_date = date( “l j F, Y”, strtotime ( $_date ) );’ as you like. Just follow the link.
- This reply was modified 6 years, 1 month ago by sliontos.
…[UPDATED]….added the Author name….
Also right after ‘$username = $user[‘login’];’ at line 14 add the code:
$get_course_data = stm_lms_get_user_course($user[“id”], $course_id, array(), “”);
$post_author_id = get_post_field( “post_author”, $get_course_data[0][“course_id”] );
$instructor = get_the_author_meta( “display_name” , $post_author_id );…and replace now the following:
OLD:
$shortcodes = array(“{username}”, “{date}”, “{course}”, “{user_first_name}”,
“{user_last_name}”);
$shortcode_values = array($username, $_date, get_the_title($course_id), $first_name,
$last_name);NEW:
$shortcodes = array(“{username}”, “{date}”, “{course}”, “{user_first_name}”, ”
{user_last_name}”,”{instructor}”);
$shortcode_values = array($username, $_date, get_the_title($course_id), $first_name,
$last_name, $instructor);…that’s it….now you can use the shortcode {instructor} also….
- This reply was modified 6 years, 2 months ago by sliontos.
Hi, wesley1066.
Try this to add the date of certificate when generated…
- Go to ‘/wp-content/plugins/masterstudy-lms-learning-management-system/stm-lms-templates’ and open with text editor the file ‘stm-lms-certificates-generator.php’.
- After that add the following code after ‘$username = $user[‘login’];’ after line 14:
$_option_name = “_cert_date_” . $username . “_” . str_replace (“”, “-“, get_the_title ( $course_id ) );
$_date = get_option( $_option_name );
if ( empty( $_date ) ) {
$_date = date( “l j F, Y” );
add_option ( $_option_name, date( “Y-m-d” ), “”, “no” );
} else
$_date = date( “l j F, Y”, strtotime ( $_date ) ); - Now find and replace the following code:
Before:
$shortcodes = array(“{username}”, “{date}”, “{course}”, “{user_first_name}”,
“{user_last_name}”);
$shortcode_values = array($username, “date”, get_the_title($course_id), $first_name,
$last_name);After:
$shortcodes = array(“{username}”, “{date}”, “{course}”, “{user_first_name}”,
“{user_last_name}”);
$shortcode_values = array($username, $_date, get_the_title($course_id), $first_name,
$last_name);
…that’s all…
Now you can add the shortcode {date} where ever you want at certificate settings.
Let me know if that works.- This reply was modified 6 years, 2 months ago by sliontos.
- This reply was modified 6 years, 2 months ago by sliontos.
- This reply was modified 6 years, 2 months ago by sliontos.
- This reply was modified 6 years, 2 months ago by sliontos.
- This reply was modified 6 years, 2 months ago by sliontos.
- This reply was modified 6 years, 2 months ago by sliontos.
- This reply was modified 6 years, 2 months ago by sliontos.
- This reply was modified 6 years, 2 months ago by sliontos.
- This reply was modified 6 years, 2 months ago by sliontos.
- This reply was modified 6 years, 2 months ago by sliontos.
- This reply was modified 6 years, 2 months ago by sliontos.
- This reply was modified 6 years, 2 months ago by sliontos.
- This reply was modified 6 years, 2 months ago by sliontos.