Support

Account

Home Forums General Issues XYZ PHP Snippet + ACF data into a form

Unread

XYZ PHP Snippet + ACF data into a form

  • Before I get far I am new to PHP and have a reasonable understanding of WordPress.. I have created a number of PHP snippets which successfully return ACF fields I have created as additional user profile fields.. I have added a new field which is a photo and set to URL as the return type (see attached).

    I have written the PHP code but cannot get the image to show… I would appreciate some help to let me know what the obvious issue is that I cannot spot..

    <?php /* User Photos */ ?>
    <?php get_header(); ?>
    <div class=”table-responsive”>
    <table class=”table”>
    <thead>
    <tr>
    <th>Callsign</th>
    <th>Photo</th>
    </tr>
    </thead>
    <tbody>
    <?php
    global $wpdb;
    $result = $wpdb->get_results( “SELECT
    u1.user_login,
    m1.meta_value AS photo
    FROM wpmr_users u1
    JOIN wpmr_usermeta m1 ON (m1.user_id = u1.id AND m1.meta_key = ‘photo’)
    order BY u1.user_login”);
    foreach ( $result as $print ) { ?>
    <tr>
    <td> <?php echo $print->user_login; ?> </td>
    <td> <?php if( get_field(‘image’) ): ?> ” /> <?php endif; ?> </td>
    </tr>
    <?php }
    ?>
    </tbody>
    </table>
    </div>
    <?php get_header();

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.