Skip to content

Commit

Permalink
Merge branch 'dev' into fix/warning-for-protection-htaccess-file
Browse files Browse the repository at this point in the history
  • Loading branch information
brianhogg authored Aug 20, 2024
2 parents 5c87cac + 8394a89 commit 41ef0ec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
significance: patch
type: fixed
links:
- "#2724"
entry: Avoid outputting lifterlms_membership_link content if the membership is
not published.
8 changes: 6 additions & 2 deletions includes/shortcodes/class.llms.shortcode.membership.link.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ class LLMS_Shortcode_Membership_Link extends LLMS_Shortcode {
* @version 3.4.3
*/
protected function get_output() {
if ( 'publish' !== get_post_status( $this->get_attribute( 'id' ) ) ) {
return '';
}

return '<a href="' . get_permalink( $this->get_attribute( 'id' ) ) . '">' . $this->get_content() . '</a>';
}

Expand All @@ -65,9 +69,9 @@ protected function get_default_attributes() {
* @version 3.4.3
*/
protected function get_default_content( $atts = array() ) {
return apply_filters( 'lifterlms_membership_link_text', get_the_title( $this->get_attribute( 'id' ) ), $this->get_attribute( 'id' ) );
$default_content = 'publish' === get_post_status( $this->get_attribute( 'id' ) ) ? get_the_title( $this->get_attribute( 'id' ) ) : '';
return apply_filters( 'lifterlms_membership_link_text', $default_content, $this->get_attribute( 'id' ) );
}

}

return LLMS_Shortcode_Membership_Link::instance();

0 comments on commit 41ef0ec

Please sign in to comment.