LLMS_User_Certificate::merge_content( string $content = null, bool $load_reusable_blocks = false )
Merges the post content based on content from the template.
Parameters Parameters
- $content
-
(string) (Optional) y use the given content instead of
$this->content
.Default value: null
- $load_reusable_blocks
-
(bool) (Optional) y replace reusable blocks with their actual blocks.
Default value: false
Return Return
(string)
Source Source
File: includes/models/model.llms.user.certificate.php
public function merge_content( $content = null, $load_reusable_blocks = false ) { $content = parent::merge_content( $content, $load_reusable_blocks ); // Merge. $merge = $this->get_merge_data(); $content = str_replace( array_keys( $merge ), array_values( $merge ), $content ); // Do shortcodes. add_filter( 'llms_user_info_shortcode_user_id', array( $this, 'get_user_id' ) ); $content = do_shortcode( $content ); remove_filter( 'llms_user_info_shortcode_user_id', array( $this, 'get_user_id' ) ); // Preserve legacy functionality which wraps the post content in the HTML specified in the template file. $use_template = apply_filters_deprecated( 'llms_certificate_use_legacy_template', array( false, $this ), '6.0.0', '', // There is no direct replacement. __( 'Loading custom HTML from the certificate template is deprecated. All HTML should be added to the certificate directly via the editor or applied via post content filters.', 'lifterlms' ) ); if ( $use_template ) { ob_start(); llms_get_template( 'certificates/template.php', array( 'email_message' => $content, 'title' => $this->get( 'title' ), 'image' => $this->get( 'certificate_image' ), ) ); $content = ob_get_clean(); } return $content; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
6.4.0 | Added optional $content and $load_reusable_blocks parameters. Removed initialization of shortcodes now that they are registered earlier. |
6.0.0 | Introduced. |