{"__v":0,"_id":"56d8888ab159f10b00304649","category":{"__v":1,"_id":"56d88885b159f10b00304612","pages":["56d8888ab159f10b00304649","56d8888ab159f10b0030464a"],"project":"549a321bf876ae0b00f33623","version":"56d88884b159f10b00304609","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-12-31T23:22:56.157Z","from_sync":false,"order":8,"slug":"actions-reference","title":"Actions Reference"},"parentDoc":null,"project":"549a321bf876ae0b00f33623","user":"549a320d5b50c21400fae689","version":{"__v":3,"_id":"56d88884b159f10b00304609","project":"549a321bf876ae0b00f33623","createdAt":"2016-03-03T18:55:00.567Z","releaseDate":"2016-03-03T18:55:00.567Z","categories":["56d88885b159f10b0030460a","56d88885b159f10b0030460b","56d88885b159f10b0030460c","56d88885b159f10b0030460d","56d88885b159f10b0030460e","56d88885b159f10b0030460f","56d88885b159f10b00304610","56d88885b159f10b00304611","56d88885b159f10b00304612","56d88885b159f10b00304613","56d88885b159f10b00304614","56d89250b159f10b003046d4","56da13977222d50b0070167c"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.2.1","version":"2.2.1"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-12-31T23:35:44.745Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"llms_user_enrolled_in_course\"\n}\n[/block]\nRuns immediately after a LifterLMS student has been enrolled in a free or paid LifterLMS course.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Type\",\n    \"0-0\": \"$user_id\",\n    \"0-1\": \"int\",\n    \"h-2\": \"Description\",\n    \"0-2\": \"WordPress user id of the user\",\n    \"1-0\": \"$course_id\",\n    \"1-1\": \"int\",\n    \"1-2\": \"WordPress post id of the course the user was enrolled in\"\n  },\n  \"cols\": 3,\n  \"rows\": 2\n}\n[/block]\nAn example to get you started with this hook:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php\\n/**\\n * Do something incredible immediately after a LifterLMS\\n * \\t\\t student has been enrolled in a LifterLMS Course\\n * \\n * :::at:::param  int   $user_id    WordPress user id of the user being enrolled\\n * @param  int   $course_id  WordPress post id of the course the user was enrolled in\\n * \\n * @return null\\n */\\nfunction my_enrollment_handler( $user_id, $course_id )\\n{\\n\\n\\t// use the user id to get userdata, perhaps?\\n\\t$user = get_userdata( $user_id );\\n\\n\\t// use the course id to get course data, perhaps?\\n\\t$course = get_post( $course_id );\\n\\n\\t// do something incredible here\\n\\n}\\n\\n// add an action hook which will pass data into the the defined handler function\\nadd_action( 'llms_user_enrolled_in_course', 'my_enrollment_handler', 10, 2 );\\n?>\",\n      \"language\": \"php\",\n      \"name\": \"llms_user_enrolled_in_course.php\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"llms_user_added_to_membership_level\"\n}\n[/block]\nRuns immediately after a LifterLMS student has been enrolled in a free or paid LifterLMS course.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Type\",\n    \"0-0\": \"$user_id\",\n    \"0-1\": \"int\",\n    \"h-2\": \"Description\",\n    \"0-2\": \"WordPress user id of the user\",\n    \"1-0\": \"$membership_id\",\n    \"1-1\": \"int\",\n    \"1-2\": \"WordPress post id of the membership the user was added to\"\n  },\n  \"cols\": 3,\n  \"rows\": 2\n}\n[/block]\nAn example to get you started with this hook:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php\\n/**\\n * Do something incredible immediately after a LifterLMS\\n * \\t\\t member has been added to a LifterLMS Membership Level\\n * \\n * @param  int   $user_id        WordPress user id of the user being enrolled\\n * @param  int   $membership_id  WordPress post id of the membership the user was added to\\n * \\n * @return null\\n */\\nfunction my_membership_addition_handler( $user_id, $membership_id )\\n{\\n\\n\\t// use the user id to get userdata, perhaps?\\n\\t$user = get_userdata( $user_id );\\n\\n\\t// use the membership id to get membership data, perhaps?\\n\\t$membership = get_post( $membership_id );\\n\\n\\t// do something incredible here\\n\\n}\\n\\n// add an action hook which will pass data into the the defined handler function\\nadd_action( 'llms_user_added_to_membership', 'my_membership_level_addition_handler', 10, 2 );\\n?>\",\n      \"language\": \"php\",\n      \"name\": \"llms_user_added_to_membership_level.php\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"actions-user","type":"basic","title":"Actions: User"}
[block:api-header] { "type": "basic", "title": "llms_user_enrolled_in_course" } [/block] Runs immediately after a LifterLMS student has been enrolled in a free or paid LifterLMS course. [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Type", "0-0": "$user_id", "0-1": "int", "h-2": "Description", "0-2": "WordPress user id of the user", "1-0": "$course_id", "1-1": "int", "1-2": "WordPress post id of the course the user was enrolled in" }, "cols": 3, "rows": 2 } [/block] An example to get you started with this hook: [block:code] { "codes": [ { "code": "<?php\n/**\n * Do something incredible immediately after a LifterLMS\n * \t\t student has been enrolled in a LifterLMS Course\n * \n * @param int $user_id WordPress user id of the user being enrolled\n * @param int $course_id WordPress post id of the course the user was enrolled in\n * \n * @return null\n */\nfunction my_enrollment_handler( $user_id, $course_id )\n{\n\n\t// use the user id to get userdata, perhaps?\n\t$user = get_userdata( $user_id );\n\n\t// use the course id to get course data, perhaps?\n\t$course = get_post( $course_id );\n\n\t// do something incredible here\n\n}\n\n// add an action hook which will pass data into the the defined handler function\nadd_action( 'llms_user_enrolled_in_course', 'my_enrollment_handler', 10, 2 );\n?>", "language": "php", "name": "llms_user_enrolled_in_course.php" } ] } [/block] [block:api-header] { "type": "basic", "title": "llms_user_added_to_membership_level" } [/block] Runs immediately after a LifterLMS student has been enrolled in a free or paid LifterLMS course. [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Type", "0-0": "$user_id", "0-1": "int", "h-2": "Description", "0-2": "WordPress user id of the user", "1-0": "$membership_id", "1-1": "int", "1-2": "WordPress post id of the membership the user was added to" }, "cols": 3, "rows": 2 } [/block] An example to get you started with this hook: [block:code] { "codes": [ { "code": "<?php\n/**\n * Do something incredible immediately after a LifterLMS\n * \t\t member has been added to a LifterLMS Membership Level\n * \n * @param int $user_id WordPress user id of the user being enrolled\n * @param int $membership_id WordPress post id of the membership the user was added to\n * \n * @return null\n */\nfunction my_membership_addition_handler( $user_id, $membership_id )\n{\n\n\t// use the user id to get userdata, perhaps?\n\t$user = get_userdata( $user_id );\n\n\t// use the membership id to get membership data, perhaps?\n\t$membership = get_post( $membership_id );\n\n\t// do something incredible here\n\n}\n\n// add an action hook which will pass data into the the defined handler function\nadd_action( 'llms_user_added_to_membership', 'my_membership_level_addition_handler', 10, 2 );\n?>", "language": "php", "name": "llms_user_added_to_membership_level.php" } ] } [/block]