Thanks for the info that put me on the right path! I was able to get the whole process to work, and will document it here as an exercise for others it might help.
We call it a Passport as a promotional name because people are getting off a cruise ship, scan a QR code and get info about a members company, like a restaurant that offers discounts.
A visitor scans a QR Code (each one similar but differing with a code. That code I use is the WP ID of a member company). The display will show information about that company.
I have 1 page (passportpage) which displays the optional S2 data fields for the company and am using (for convenience) an XYZ PHP Code snippet to grab the ID parameter from the URL, then pull the S2 record and display the fields.
I opted to use the WP User ID rather than an S2 field I could create for a code. I think the WP lookup of ID will be faster and it reduces the need for me to fill in another field. The WP ID is created automatically with Wordpress. It can be displayed in the Admin User listing if you use a plugin like SHOW USER ID.
Now I just create a QR code which equates to the URL as follows a https://mysite.com/passportpage?ID=123 and member with ID=123 has his S2 fields displayed.
The snippet below is called PASSPORT and the passportpage uses the shortcode [xyz-ips snippet=“passport”] to display the data.
If a member is demoted, he is no longer level 1 OR if he decides to go to his Profile Page and check NO for ACTIVE, then his passport no longer shows up. The q fields listed are the optional S2 fields I created for this project.
<?php
$s2member_access_role = get_user_field ("s2member_access_role", (int) $_GET['id']);
$passport = get_user_option('s2member_custom_fields', (int) $_GET['id']);
// To display the Passport Info the member must allow it AND the must be a Full Member (level 1) or 4
if (($s2member_access_role == "s2member_level1" || $s2member_access_role == "s2member_level4") & $passport[q_active] == "Y")
{
echo "Company<br>" . $passport[q_company];
echo "<p>Location<br>" . $passport[q_location];
echo "<p>Directions<br>" . $passport[q_directions];
echo "<p>Distance From Pier<br>" . $passport[q_distance];
echo "<p>Map ID<br>" . $passport[q_mapid];
echo "<p>Special Offered<br>" . $passport[q_special];
echo "<p>Telephone<br>" . $passport[q_telephone];
}
else
{
echo "<p>Sorry, This Passport Is Not Active at this time!";
}
?>
Because some users might be using cellphones, I also used a plugin to ensure that the data will fit on their screens and I don’t have to add code on the original passport page to accommodate special screen sizes.