Including avatar url into Postgres sql query
-
Trying to insert buddypress avatar url into postgres table when user upload new avatar.
Function bp_loggedin_user_avatar( ‘html=false’ ) gives proper URL but it just echoes it to screen.Not able to assigned value to variable $user_avatar_url and include it into query.
Is there way to have url properly inserted into sql query?if ( ! bp_core_avatar_handle_crop( $args ) ) { bp_core_add_message( __( 'There was a problem cropping your avatar.', 'buddypress' ), 'error' ); } else { bp_core_add_message( __( 'Your new avatar was uploaded successfully.', 'buddypress' ) ); do_action( 'xprofile_avatar_uploaded' ); // save avatar to postgres $logged_email= bp_core_get_user_email(get_current_user_id()); $user_avatar_url= bp_loggedin_user_avatar( 'html=false' ); $query = "UPDATE table_name SET avatar = '$user_avatar_url' WHERE user_email = '$logged_email'"; echo $query; pg_exec($query); } }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Including avatar url into Postgres sql query’ is closed to new replies.