Can We customize the Start Learning button

We would like to modify the behavior so that when an employee clicks the “Start Learning” button, it triggers a request for manager approval . Only after the manager approves the request should the employee be granted access to the course.

Can We Do this @Jannat_Patel mam

can you share the image of document you can do this by creating a workflow

even after creating the workflow also im getting this code

@frappe.whitelist()
def create_membership(
    course, batch=None, member=None, member_type="Student", role="Member"
):
    user = member or frappe.session.user

    enrollment = frappe.get_doc(
		{
			"doctype": "LMS Enrollment",
			"batch_old": batch,
			"course": course,
			"role": role,
			"member_type": member_type,
			"member": user,
			"status": "Pending Approval"
		}
	).save(ignore_permissions=True)

    enrollment.save(ignore_permissions=True)

    if member_type == "Student":
        employee = frappe.get_value("Employee", {"user_id": user}, ["name", "employee_name", "reports_to"])
        if employee:
            employee_name, reports_to = employee[1], employee[2]
            if reports_to:
                manager_email = frappe.get_value("Employee", reports_to, "user_id")
                if manager_email:
                    frappe.sendmail(
                        recipients=[manager_email],
                        subject=f"{employee_name} has requested to start course: {course}",
                        message=f"""
                            Dear Manager,<br><br>
                            {employee_name} has requested access to the course <b>{course}</b>.<br>
                            Please approve the enrollment by visiting the LMS Enrollment record:<br>
                            <a href="{frappe.utils.get_url()}/app/lms-enrollment/{enrollment.name}">
                                {enrollment.name}
                            </a><br><br>
                            Regards,<br>LMS Team
                        """
                    )

    return "OK"

before enroll

After enroll

Even it is in the Draft state also it is access the course

This is the Workflow