{"_id":"56d88886b159f10b0030461c","__v":0,"parentDoc":null,"user":"549a320d5b50c21400fae689","version":{"_id":"56d88884b159f10b00304609","__v":3,"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"},"category":{"_id":"56d88885b159f10b00304613","pages":["56d88886b159f10b0030461c","56d88886b159f10b0030461d","56d88886b159f10b0030461e","56d88886b159f10b0030461f","56d88886b159f10b00304620","56d88886b159f10b00304621","56d88886b159f10b00304622","56d88886b159f10b00304623","56d88886b159f10b00304624","56d88886b159f10b00304625","56d88886b159f10b00304626","56d88886b159f10b00304627","56d88886b159f10b00304628","56d88886b159f10b00304629","56d88886b159f10b0030462a","56d88886b159f10b0030462b","56d88886b159f10b0030462c","56d88886b159f10b0030462d","56d88886b159f10b0030462e","56d88886b159f10b0030462f","56d88886b159f10b00304630","56d88886b159f10b00304631"],"project":"549a321bf876ae0b00f33623","__v":1,"version":"56d88884b159f10b00304609","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-05-20T00:49:50.639Z","from_sync":false,"order":10,"slug":"developer-api","title":"Filters Reference"},"project":"549a321bf876ae0b00f33623","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-05-20T04:09:21.227Z","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\": \"lifterlms_membership_restricted_message\"\n}\n[/block]\nFilter applied to restricted access message when user attempts to access page restricted by a membership level.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php // don't include this line in your functions.php file\\nadd_filter( 'lifterlms_membership_restricted_message', function( $msg ) {\\n\\t\\n\\treturn 'My custom membership restricted message';\\n\\n}, 10, 1 );\",\n      \"language\": \"php\",\n      \"name\": \"lifterlms_membership_restricted_message.php\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"lifterlms_lesson_enrollment_restricted_message\"\n}\n[/block]\nFilter applied to restricted access message when user attempts to access a page restricted by enrollment.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php // don't include this line in your functions.php file\\nadd_filter( 'lifterlms_lesson_enrollment_restricted_message', function( $msg ) {\\n\\t\\n\\treturn 'My custom lesson enrollment restricted message';\\n\\n}, 10, 1 );\",\n      \"language\": \"php\",\n      \"name\": \"lifterlms_lesson_enrollment_restricted_message.php\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"llms_page_restricted\"\n}\n[/block]\nApplied to results object when page is found to be restricted. Called before redirecting to restricted template.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php // don't include this line in your functions.php file\\nadd_filter( 'llms_page_restricted', function( $results ) {\\n\\n\\t/**\\n\\t * Example results array\\n\\t */\\n\\t// $results = array(\\n\\t// \\t'id' => $post_id, // WP Post ID\\n\\t// \\t'is_restricted' => $restricted, // boolean - true if restriced, false if not\\n\\t// \\t'reason' => $reason, // string explaining why page was restricted - eg: \\\"enrollment\\\"\\n\\t// );\\t\\n\\n\\t/**\\n\\t * I want to restrict post id 123 for an arbitrary reason\\n\\t */\\n\\t\\n\\tif ( $results['id'] == 123 ) {\\n\\n\\t\\t$results['is_restricted'] = true;\\n\\t\\t$results['reason'] = 'just_because';\\n\\n\\t}\\n\\n\\treturn $results;\\n\\n} );\",\n      \"language\": \"php\",\n      \"name\": \"llms_page_restricted.php\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"filters-access","type":"basic","title":"Filters: Access"}
[block:api-header] { "type": "basic", "title": "lifterlms_membership_restricted_message" } [/block] Filter applied to restricted access message when user attempts to access page restricted by a membership level. [block:code] { "codes": [ { "code": "<?php // don't include this line in your functions.php file\nadd_filter( 'lifterlms_membership_restricted_message', function( $msg ) {\n\t\n\treturn 'My custom membership restricted message';\n\n}, 10, 1 );", "language": "php", "name": "lifterlms_membership_restricted_message.php" } ] } [/block] [block:api-header] { "type": "basic", "title": "lifterlms_lesson_enrollment_restricted_message" } [/block] Filter applied to restricted access message when user attempts to access a page restricted by enrollment. [block:code] { "codes": [ { "code": "<?php // don't include this line in your functions.php file\nadd_filter( 'lifterlms_lesson_enrollment_restricted_message', function( $msg ) {\n\t\n\treturn 'My custom lesson enrollment restricted message';\n\n}, 10, 1 );", "language": "php", "name": "lifterlms_lesson_enrollment_restricted_message.php" } ] } [/block] [block:api-header] { "type": "basic", "title": "llms_page_restricted" } [/block] Applied to results object when page is found to be restricted. Called before redirecting to restricted template. [block:code] { "codes": [ { "code": "<?php // don't include this line in your functions.php file\nadd_filter( 'llms_page_restricted', function( $results ) {\n\n\t/**\n\t * Example results array\n\t */\n\t// $results = array(\n\t// \t'id' => $post_id, // WP Post ID\n\t// \t'is_restricted' => $restricted, // boolean - true if restriced, false if not\n\t// \t'reason' => $reason, // string explaining why page was restricted - eg: \"enrollment\"\n\t// );\t\n\n\t/**\n\t * I want to restrict post id 123 for an arbitrary reason\n\t */\n\t\n\tif ( $results['id'] == 123 ) {\n\n\t\t$results['is_restricted'] = true;\n\t\t$results['reason'] = 'just_because';\n\n\t}\n\n\treturn $results;\n\n} );", "language": "php", "name": "llms_page_restricted.php" } ] } [/block]