Hey Guy,
Would certainly appreciate more info on the solution you found please, if you wouldn’t mind?
Thanks in advance.
Sorry, testing code up there ^.
With SQL injection protection on… last line reads…
return $wpdb->get_var($wpdb->prepare(“SELECT field FROM table WHERE field = ‘$current_user->user_login'”));
OK, so all I apparently needed was another half a day.
I used the plugin: Shortcode Exec PHP, then created a shortcode for the below code:
global $wpdb;
global $current_user;
$current_user = wp_get_current_user();
return $wpdb->get_var(“SELECT field FROM table WHERE field = ‘$current_user->user_login'”);
… with “output echoed” unticked.
The shortcode then easily placed in a page.
I believe I was close on a number of occasions way back, but had the quotes mixed up on the $current_user->user_login variable.
Glad that’s over. Next challenge now. Hope that might help someone else.