Skip to content

Commit

Permalink
Allow for multiple people with the same name (fixes #883)
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Abraham <[email protected]>
  • Loading branch information
cjyabraham committed Sep 12, 2024
1 parent 23e581b commit d198c46
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,18 +145,19 @@ function geocode_location( $id ) {
$params['meta_input']['lf_person_website'] = $p->website;
}

$pp = get_posts(
array(
'post_type' => 'lf_person',
'title' => $p->name,
'post_status' => 'publish',
'numberposts' => 1,
'update_post_term_cache' => false,
'update_post_meta_cache' => false,
'orderby' => 'post_date ID',
'order' => 'ASC',
)
$args = array(
'post_type' => 'lf_person',
'title' => $p->name,
'post_status' => 'publish',
'numberposts' => 1,
);

if ( $image_url ) {
$args['meta_value'] = $image_url;
}

$pp = get_posts( $args );

if ( ! empty( $pp ) ) {
$params['ID'] = $pp[0]->ID;
}
Expand Down Expand Up @@ -204,6 +205,7 @@ function geocode_location( $id ) {
array(
'post_type' => 'lf_person',
'post__not_in' => $synced_ids,
'posts_per_page' => -1,
)
);
while ( $query->have_posts() ) {
Expand All @@ -212,4 +214,6 @@ function geocode_location( $id ) {
}

// clear the site cache.
pantheon_wp_clear_edge_all();
if ( function_exists( 'pantheon_wp_clear_edge_all' ) ) {
pantheon_wp_clear_edge_all();
}
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ private function define_admin_hooks() {

// Example of how to run a sync locally on demand.
// $this->loader->add_action( 'init', $plugin_admin, 'sync_kcds' ); //phpcs:ignore.
// $this->loader->add_action( 'init', $plugin_admin, 'sync_projects' ); //phpcs:ignore.
// $this->loader->add_action( 'init', $plugin_admin, 'sync_people' ); //phpcs:ignore.

$this->loader->add_filter( 'dashboard_glance_items', $plugin_admin, 'custom_glance_items', 10, 1 );

Expand Down

0 comments on commit d198c46

Please sign in to comment.