Private Areas Filters
If you’re not sure what a filter is and want to get started, take a look at the WordPress Codex reference on filters and the core function, add_filter().
Filters can be added to your theme’s or child theme’s functions.php file or to a site-specific plugin. We’ve created a very basic site-specific plugin for this purpose, you can get it for free here.
If you’re a developer and you’re looking to filter something, you probably can. If it’s not listed here please check the codebase first and then submit a support ticket if you need help locating a filter.
Customize the number of comments shown per page with LifterLMS Private Areas.
/** * Customize the number of comments shown per page with LifterLMS Private Areas. * * Learn more at: https://lifterlms.com/docs/private-areas-filters/ * * You can add this recipe to your site by creating a custom plugin * or using the Code Snippets plugin available for free in the WordPress repository. * Read this companion documentation for step-by-step directions on either method. * https://lifterlms.com/docs/adding-custom-code/ */ function my_llms_pa_comments_per_page( $number ) { return 100; } add_filter( 'llms_pa_comments_per_page', 'my_llms_pa_comments_per_page', 10, 1 );
Disable HTML quick tags for discussion (commenting) on Private Area posts.
/** * Disable HTML quick tags for discussion (comments) on PA Posts * * Learn more at: https://lifterlms.com/docs/private-areas-filters/ * * You can add this recipe to your site by creating a custom plugin * or using the Code Snippets plugin available for free in the WordPress repository. * Read this companion documentation for step-by-step directions on either method. * https://lifterlms.com/docs/adding-custom-code/ */ add_filter( 'llms_pa_html_discussion', '__return_false' );
Same as above, but allows admins to use HTML quicktags on the admin panel (disables for students on frontend only):
/** * Customize the Privaate Areas commenting to allow HTML quicktags for admins only. * * Learn more at: https://lifterlms.com/docs/private-areas-filters/ * * You can add this recipe to your site by creating a custom plugin * or using the Code Snippets plugin available for free in the WordPress repository. * Read this companion documentation for step-by-step directions on either method. * https://lifterlms.com/docs/adding-custom-code/ */ function my_llms_pa_html_discussion( $bool ) { if ( ! is_admin() ) { return false; } return $bool; } add_filter( 'llms_pa_html_discussion', 'my_llms_pa_html_discussion' );
Customize the default status of a Private Area post when duplicating a Private Area post.
NOTE: if you set to publish, notifications will be sent IMMEDIATELY possilby resulting in a student getting a duplicate notification!
// Don't copy this line! /** * LifterLMS Private Areas filter examples: https://lifterlms.com/docs/private-areas-filters/ * * @since 2017-08-11 */ /** * Customize the default status of a Private Area post when duplicating a PA post * NOTE: if you set to publish, notifications will be sent IMMEDIATELY possilby resulting in a student getting a duplicate notification! * @param string $status default status (draft) * @return string */ function my_llms_pa_post_clone_status( $status ) { return 'publish;' // set this to be any valid WP Post Status } add_filter( 'llms_pa_post_clone_status', 'my_llms_pa_post_clone_status', 10, 1 );
Customize the length (in words) of Private Area post excerpts.
// Don't copy this line! /** * LifterLMS Private Areas filter examples: https://lifterlms.com/docs/private-areas-filters/ * * @since 2017-08-11 */ /** * Customize the length (in words) of Private Area post excerps * @param int $length default word count (55) * @return int */ function my_llms_pa_post_excerpt_length( $length ) { return 85; } add_filter( 'llms_pa_post_excerpt_length', 'my_llms_pa_post_excerpt_length', 10, 1 );
Allow additional roles to discuss a Private Area post from the admin panel.
// Don't copy this line! /** * LifterLMS Private Areas filter examples: https://lifterlms.com/docs/private-areas-filters/ * * @since 2017-08-11 */ /** * Allow additional roles to discuss a PA post from the admin panel * @param array $roles array of WP_Role names * @return array */ function my_llms_pa_post_roles_can_discuss( $roles ) { $roles[] = 'editor'; return $roles; } add_filter( 'llms_pa_post_roles_can_discuss', 'my_llms_pa_post_roles_can_discuss', 10, 1 );
Prevent the posted time from displaying for Private Area posts.
// Don't copy this line! /** * LifterLMS Private Areas filter examples: https://lifterlms.com/docs/private-areas-filters/ * * @since 2017-08-11 */ /** * Do not show the posted time for PA posts */ add_filter( 'llms_pa_post_show_time', '__return_false' );