最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugins - Help to create function that changes name in the certificate of the sensei lms

programmeradmin1浏览0评论

I would like to remove the concatenation of the first and last name of the student certificates through the "Sensei LMS Certificates" plug-in. I would like to show only the first name, make an edit in the files * class-woothemes-sensei-certificate.php * and in * class-woothemes-sensei-certificate-tempates *, the file comes with the concatenation like this:

// Get Student Data
            $user_id      = get_post_meta( $certificate_id, 'learner_id', true );
            $student      = get_userdata( $user_id );
            $student_name = $student->display_name;
            $fname        = $student->first_name;
            $lname        = $student->last_name;

            if ( '' != $fname && '' != $lname ) {
                $student_name = $fname . ' ' . $lname;
            }

and I changed it to:

// Get Student Data
        $user_id      = get_post_meta( $certificate_id, 'learner_id', true );
        $student      = get_userdata( $user_id );
        $student_name = $student->display_name;
        $fname        = $student->first_name;
        $lname        = $student->last_name;

        if ( '' != $fname && '' != $lname ) {
            $student_name = $fname;
        }

However, if there is an update to the plug-in, I will lose those settings. I would like to include a function in functions so that certificates are kept only the first name. Could someone help me create this function for my child theme's functions.php file? How can I insert a function in the file that changes this?

发布评论

评论列表(0)

  1. 暂无评论