Skip to content

Commit

Permalink
Merge branch 'release-2.10.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikola committed Dec 19, 2017
2 parents 3e0c8e2 + 182293f commit a0691d3
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 21 deletions.
59 changes: 41 additions & 18 deletions includes/admin/import/class-sm-import-se.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,27 +233,43 @@ private function _import_messages() {

// start the import
foreach ( $messages as $message ) {
$the_post = get_post( $message->wp_post_id );

if ( ! isset( $imported[ $message->wp_post_id ] ) ) {
$id = wp_insert_post( apply_filters( 'sm_import_se_message', array(
'post_author' => $the_post->post_author,
'post_date' => $the_post->post_date,
'post_date_gmt' => $the_post->post_date_gmt,
'post_content' => '%todo_render%',
'post_title' => $message->title,
'post_status' => $the_post->post_status,
'post_type' => 'wpfc_sermon',
'post_modified' => $the_post->post_modified,
'post_modified_gmt' => $the_post->post_modified_gmt,
) ) );
$post_id = $message->wp_post_id;
$the_post = null;
if ( $post_id !== null ) {
$the_post = get_post( $message->wp_post_id );
} else {
$post_id = $message->message_id;
}

if ( ! isset( $imported[ $post_id ] ) ) {
if ( $the_post === null ) {
$id = wp_insert_post( apply_filters( 'sm_import_se_message', array(
'post_date' => $message->date . ' 12:00:00',
'post_content' => '%todo_render%',
'post_title' => $message->title,
'post_type' => 'wpfc_sermon',
'post_status' => 'publish',
) ) );
} else {
$id = wp_insert_post( apply_filters( 'sm_import_se_message', array(
'post_author' => $the_post->post_author,
'post_date' => $the_post->post_date,
'post_date_gmt' => $the_post->post_date_gmt,
'post_content' => '%todo_render%',
'post_title' => $message->title,
'post_status' => $the_post->post_status,
'post_type' => 'wpfc_sermon',
'post_modified' => $the_post->post_modified,
'post_modified_gmt' => $the_post->post_modified_gmt,
) ) );
}

if ( $id === 0 ) {
// silently skip if error
continue;
}

$imported[ $message->wp_post_id ] = array(
$imported[ $post_id ] = array(
'new_id' => $id
);

Expand All @@ -263,7 +279,7 @@ private function _import_messages() {
*/
update_option( '_sm_import_se_messages', $imported );
} else {
$id = $imported[ $message->wp_post_id ]['new_id'];
$id = $imported[ $post_id ]['new_id'];
}

// set speakers
Expand Down Expand Up @@ -336,7 +352,12 @@ private function _import_messages() {
if ( ! empty( $message->date ) && $message->date !== '0000-00-00' ) {
update_post_meta( $id, 'sermon_date', strtotime( $message->date ) );
} else {
update_post_meta( $id, 'sermon_date', strtotime( $the_post->post_date ) );
if ( $the_post !== null ) {
update_post_meta( $id, 'sermon_date', strtotime( $the_post->post_date ) );
} else {
update_post_meta( $id, 'sermon_date', strtotime( $message->date ) );
}

update_post_meta( $id, 'sermon_date_auto', '1' );
}

Expand Down Expand Up @@ -390,7 +411,9 @@ private function _import_messages() {
) {
$terms = array();

if ( empty( $this->{$terms_array} ) ) {
if ( empty( $this->{
$terms_array
} ) ) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion includes/podcast-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function wpfc_podcast_render() {
* @return void
*/
function wpfc_podcast_add_namespace() {
echo 'xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0"';
echo 'xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"';
}

/**
Expand Down
19 changes: 19 additions & 0 deletions includes/sm-core-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -539,3 +539,22 @@ function sm_import_and_set_post_thumbnail( $image_url, $post_id = 0 ) {

return $data;
} );

/**
* Gets sermon series image url
*
* @param int $series_id ID of the series
*
* @return string|null Image URL; null if image not set or invalid/not set series id
*
* @since 2.11
*/
function get_sermon_series_image_url( $series_id = 0 ) {
if ( ! ( is_int( $series_id ) && $series_id !== 0 ) ) {
return null;
}

$associations = sermon_image_plugin_get_associations();

return ! empty( $associations[ $series_id ] ) ? wp_get_attachment_image_url( $associations[ $series_id ] ) : null;
}
10 changes: 10 additions & 0 deletions includes/template-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,16 @@ function wpfc_sermon_excerpt( $return = false ) {

$output = ob_get_clean();

/**
* Allows you to modify the sermon HTML on archive pages
*
* @param string $output The HTML that will be outputted
* @param WP_Post $post The sermon
*
* @since 2.10.1
*/
$output = apply_filters( 'wpfc_sermon_excerpt', $output, $post );

if ( ! $return ) {
echo $output;
}
Expand Down
6 changes: 5 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.9.1
Requires PHP: 5.3
Stable tag: 2.10
Stable tag: 2.10.1
License: GPLv2
License URI: https://www.gnu.org/licenses/gpl-2.0.html

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

## Changelog ##
### 2.10.1 ###
* Fix: Invalid podcast XML
* Fix: Sermons from old Series Engine installations not importing

### 2.10 ###
* New: Added option in filtering shortcode to filter only in a specific series
* New: Added option to pick more players for playing sermons
Expand Down
2 changes: 1 addition & 1 deletion 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.10
* Version: 2.10.1
* Author: WP for Church
* Author URI: https://www.wpforchurch.com/
* Requires at least: 4.5
Expand Down

0 comments on commit a0691d3

Please sign in to comment.