Getting a value from one of the users xprofile fields
-
Hi,
Long time lurker first time poster – i’ve got a bit of a problem that I just can’t figure out;I’m trying to get the value of the ‘radius’ field for the displayed user into a piece of PHP code to be used later on, but I keep getting errors;
Here is the code that i’m using:
(it’s a function that gets the radius value for the user and returns it:function gmw_get_radius($user_id) { global $wpdb; $info = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM <code>wp_uotu_bp_xprofile_data</code> WHERE user_id = $user_id AND field_id =1255" )); return ( isset($info) ) ? $info : false; }
The error that I receive via WP debug is :
Warning: Missing argument 2 for wpdb::prepare(), called in /home3/housepa7/public_html/wp-content/plugins/geo-my-wp/plugins/friends/includes/gmw-fl-functions.php on line 35 and defined in /home3/housepa7/public_html/wp-includes/wp-db.php on line 1147 Notice: wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder. Please see Debugging in WordPress for more information. (This message was added in version 3.9.) in /home3/housepa7/public_html/wp-includes/functions.php on line 3245
Any help towards this would be very much appreciated and I can provide any more info if needed, thanks!
NOTE: I just checked the post and it added code tags around some of the php – this is not intended and they should be apostrophes!
- The topic ‘Getting a value from one of the users xprofile fields’ is closed to new replies.