Problem understanding how to pull a sql record into a url.

This one is easy for anyone who knows how to perform the task of pulling records with php and also php variables. I sadly know how to do neither lol

The basic idea of what I need is:

I have a gaming website/social network in live development. It runs on the wordpress/buddypress combo. I would like to be able to show members Xbox Live Gamercard on their profile. There is a simple url structure provided by Microsoft to do this,[insert gamertag here].card

It works well when you type the username into the url but I want it to automatically pull the gamercard username from a mysql database, request the gamercard from and show the result on the user profile page.

What I have done:

On buddypress you can create profile fields for the user to fill. I have created a “gamertag” profile field and it has been added to the database. Now is where my problems start. I have no idea how to pull individual records in relation to a specific user. I have looked at the database and have no problem locating information but I don’t really understand how the dataflow works. The information I want is stored in a different table to the basic profile information created by wordpress.

Once I get the “gamertag” profile field from the database I presume the best course of action would be to copy the record to a variable then insert the variable into the url and that would be me done.

thanks in advance for any help you can give. If you need any more information just let me know, I’ll be working at my linux box all day so I can provide any information you may need.


I am not familiar with buddypress plugin for Wordpress, but I assume there are some core functions that will let you query this custom field by member id. You’ll need to check this plugin’s code, particularly part of it where it display custom fields when you edit user profile.

Sponsor our Newsletter | Privacy Policy | Terms of Service