Skip to content

Commit

Permalink
Merge pull request #126 from WP-for-Church/dev
Browse files Browse the repository at this point in the history
Release 2.8.3
  • Loading branch information
Nikola Miljković authored Oct 6, 2017
2 parents ece984a + a16ff72 commit 3553701
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 12 deletions.
2 changes: 1 addition & 1 deletion assets/css/sermon.css
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@

/* Styles for additional files */
#wpfc-attachments a {
display: block;
display: table;
}

#wpfc-attachments a[href$='.ppt'], #wpfc-attachments a[href$='.pptx'] {
Expand Down
3 changes: 3 additions & 0 deletions includes/class-sm-install.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ class SM_Install {
'sm_update_28_fill_out_series_dates',
'sm_update_28_save_sermon_render_into_post_content',
'sm_update_28_reset_recovery',
),
'2.8.3' => array(
'sm_update_283_resave_sermons'
)
);

Expand Down
12 changes: 11 additions & 1 deletion includes/sm-update-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ function sm_update_28_fill_out_series_dates() {
SM_Dates_WP::update_series_date();
}

/**
* Renders sermon HTML and saves as "post_content", for better search compatibility
*/
function sm_update_28_save_sermon_render_into_post_content() {
global $wpdb;

Expand All @@ -89,10 +92,17 @@ function sm_update_28_save_sermon_render_into_post_content() {
foreach ( $sermons as $sermon ) {
wp_update_post( array(
'ID' => $sermon->ID,
'post_content' => wp_filter_post_kses( wpfc_sermon_single( true, $sermon ) )
'post_content' => wpfc_sermon_single( true, $sermon )
) );
}

// clear all cached data
wp_cache_flush();
}

/**
* <source> element was not included in 2.8 save. We allowed it and it will work now
*/
function sm_update_283_resave_sermons(){
sm_update_28_save_sermon_render_into_post_content();
}
13 changes: 10 additions & 3 deletions includes/template-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,13 @@ function wpfc_sermon_audio() {
// render additional files
function wpfc_sermon_attachments() {
global $post;

if ( ! get_wpfc_sermon_meta( 'sermon_audio' ) &&
! get_wpfc_sermon_meta( 'sermon_notes' ) &&
! get_wpfc_sermon_meta( 'sermon_bulletin' ) ) {
return '';
}

$html = '<div id="wpfc-attachments" class="cf">';
$html .= '<p><strong>' . __( 'Download Files', 'sermon-manager-for-wordpress' ) . '</strong>';
if ( get_wpfc_sermon_meta( 'sermon_audio' ) ) {
Expand All @@ -381,9 +388,9 @@ function render_wpfc_sermon_single() {

// single sermon action
function wpfc_sermon_single( $return = false, $post = '' ) {
if ( $post === '' ){
global $post;
}
if ( $post === '' ) {
global $post;
}

ob_start();
?>
Expand Down
8 changes: 7 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: church, sermon, sermons, preaching, podcasting, manage, managing, podcasts
Requires at least: 4.5
Tested up to: 4.8.2
Requires PHP: 5.3
Stable tag: 2.8.2
Stable tag: 2.8.3
License: GPLv2
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -93,6 +93,12 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man
2. Sermon Files

## Changelog ##
### 2.8.3 ###
* Fix sermon audio not showing up
* Fix sermon not updating on first save
* Fix sermon video embed not saving
* Fix styling of attachment links

### 2.8.2 ###
* Disable error recovery since it's causing too many issues
* Couple bugfixes for PHP 5.3
Expand Down
17 changes: 11 additions & 6 deletions sermons.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Sermon Manager for WordPress
* Plugin URI: https://www.wpforchurch.com/products/sermon-manager-for-wordpress/
* Description: Add audio and video sermons, manage speakers, series, and more.
* Version: 2.8.2
* Version: 2.8.3
* Author: WP for Church
* Author URI: https://www.wpforchurch.com/
* Requires at least: 4.5
Expand Down Expand Up @@ -98,7 +98,7 @@ public function __construct() {
// Attach to fix WP dates
SM_Dates_WP::hook();
// Render sermon HTML for search compatibility
add_action( 'save_post_wpfc_sermon', array( $this, 'render_sermon_into_content' ), 10 );
add_action( 'wp_insert_post', array( $this, 'render_sermon_into_content' ), 10, 2 );

if ( is_admin() ) {
add_action( 'admin_enqueue_scripts', function () {
Expand All @@ -121,7 +121,7 @@ private function _includes() {
'includes/class-sm-dates-wp.php', // Attach to WP filters
'includes/class-sm-api.php', // API
'includes/class-sm-post-types.php', // Register post type, taxonomies, etc
'includes/class-sm-install.php', // Install and update functions
'includes/class-sm-install.php', // Install and update functions
'includes/sm-deprecated-functions.php', // Deprecated SM functions
'includes/sm-core-functions.php', // Deprecated SM functions
'includes/sm-legacy-php-functions.php', // Old PHP compatibility fixes
Expand Down Expand Up @@ -369,11 +369,16 @@ public static function render_php_version_warning() {
/**
* Saves whole Sermon HTML markup into post content for better search compatibility
*
* @param int $post_ID
* @param int $post_ID
* @param WP_Post $post Post object
*
* @since 2.8
*/
public function render_sermon_into_content( $post_ID ) {
public function render_sermon_into_content( $post_ID, $post ) {
if ( $post->post_type !== 'wpfc_sermon' ) {
return;
}

if ( defined( 'SM_SAVING_POST' ) ) {
return;
} else {
Expand All @@ -382,7 +387,7 @@ public function render_sermon_into_content( $post_ID ) {

wp_update_post( array(
'ID' => $post_ID,
'post_content' => wp_filter_post_kses( wpfc_sermon_single( true ) )
'post_content' => wpfc_sermon_single( true )
) );
}

Expand Down

0 comments on commit 3553701

Please sign in to comment.