Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
LifterLMS Private Areas filter examples: https://lifterlms.com/docs/private-areas-filters/
<?php // don't copy this to your functions.php file
/**
* Customize the number of comments displayed on each page of a Private Area Post
* @param int $number default # of comments (50)
* @return int
*/
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 );
<?php // don't copy this to your functions.php file
/**
* customize PA commenting to Allow HTML quicktags for admins only
* @param boolean $bool default HTML status (true)
* @return boolean
*/
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' );
<?php // don't copy this to your functions.php file
/**
* Disable HTML quick tags for discussion (comments) on PA Posts
*/
add_filter( 'llms_pa_html_discussion', '__return_false' );
<?php // don't copy this to your functions.php file
/**
* 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 );
<?php // don't copy this to your functions.php file
/**
* 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 );
<?php // don't copy this to your functions.php file
/**
* 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 );
<?php // don't copy this to your functions.php file
/**
* Do not show the posted time for PA posts
*/
add_filter( 'llms_pa_post_show_time', '__return_false' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.