App directory search – small update to show the household photo if it exists.

About Support App App directory search – small update to show the household photo if it exists.

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #9835
    Avatar for Richard HughesRichard Hughes
    Participant

    Andy, you are awesome. The church loves the app. So this is a huge leap forward for us.

    For our church, we do not have individual images. Only household images. And people are always searching the directory so they can see a picture. (These women want to see photos).

    Would you please update directory search in the next version, so that on search the household image would show if the individual photo does not exist.

    1. Update the SQL to also get the household attachment id.

    change this line

    $sql=’SELECT a.*,b.address,b.lat,b.lng FROM ‘.CA_PEO_TBL.’ a, ‘.CA_HOU_TBL.’ b WHERE ‘.$sql_safe_search.’ a.household_id=b.household_id AND a.show_me=1 AND a.active=1 ‘.$sql_safe_membSQL.’ ‘.$peopleTypeSQL.’ ORDER BY a.last_name,a.first_name ASC ‘;

    to

    $sql=’SELECT a.*,b.address,b.lat,b.lng,b.attachment_id as household_attachment_id FROM ‘.CA_PEO_TBL.’ a, ‘.CA_HOU_TBL.’ b WHERE ‘.$sql_safe_search.’ a.household_id=b.household_id AND a.show_me=1 AND a.active=1 ‘.$sql_safe_membSQL.’ ‘.$peopleTypeSQL.’ ORDER BY a.last_name,a.first_
    name ASC ‘;

    Then show the household image. At least include the household image if the individual image does not exist.

    And add this 1 line inside the foreach( $results AS $row) loop

    if(!empty( $row->household_attachment_id) )$person.='<p>’.wp_get_attachment_image( $row->household_attachment_id,’medium’,”,array(‘class’=>’household-image’,’loading’=>’lazy’) ).'</p>’;

    #9844
    Avatar for Andy MoyleAndy Moyle
    Keymaster

    Thanks for posting code – helps a lot! Apart from the fact that single quotes get changed to wonky ones by the forum software!!

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.