Navigation Menu

Skip to content
This repository has been archived by the owner on Oct 4, 2017. It is now read-only.

Commit

Permalink
prevent errors on save and section add
Browse files Browse the repository at this point in the history
  • Loading branch information
benbalter committed Feb 2, 2013
1 parent 7080150 commit 2997a9a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 5 additions & 2 deletions includes/admin.php
Expand Up @@ -494,8 +494,11 @@ function options_validate($data) {

//sanitize section order data
$order = array();
foreach ( (array) $data['order'] as $key=>$value)
$order[] = (int) $key ;

//if there are no positions, don't err out
if ( array_key_exists( 'order', (array) $data ) )
foreach ( (array) $data['order'] as $key => $value)
$order[] = (int) $key ;

$user_options['order'] = $order;

Expand Down
8 changes: 7 additions & 1 deletion wp-resume.php
Expand Up @@ -284,8 +284,14 @@ function section_order_filter( $terms, $taxonomies, $args ) {

$author = get_user_by( 'slug', $this->author );

if ( !$author && is_admin() )
if ( !$author && is_admin() ) {

if ( is_null( $post ) ) //if we don't have a post obj. kick to original
return $terms;

$author = get_user_by( 'id', $post->post_author );

}

$order = $this->options->get_user_option( 'order', $author->ID );

Expand Down

0 comments on commit 2997a9a

Please sign in to comment.