MyBB Community Forums

Full Version: mysql query on user profile
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, I'm after running a mysql query on eachs user profile page. Exactly the same as "Time spent online:". I have it on the member_profile template however I'm unsure how to go about querying it.

Thanks!
PHPmyadmin > databases > the database the mybb is installed on > sql > insert query number 1
query number 1 :
Quote:UPDATE mybb_users
SET timeonline='10'
WHERE username='yourusername'
this is how to update all the timeonline for all users
PHPmyadmin > databases > the database the mybb is installed on > sql > insert query number 2
query number 2 :
Quote:UPDATE mybb_users
SET timeonline='blahblah'
in this query we are editing the mybb_users table and the timeonline row
hope i helped
regards,
No you've understood me wrong.

I want a seperate one. I've added it onto the sql structure "jobs". But I need to display it on the member profile. Exactly how the time online one does it.
(2012-07-27, 01:15 PM)shadow396 Wrote: [ -> ]No you've understood me wrong.

I want a seperate one. I've added it onto the sql structure "jobs". But I need to display it on the member profile. Exactly how the time online one does it.
you mean like custom profile field ?
if yes then
ACP > configuration > Custom Profile Fields > add new
and fill in the info
regards,
Try using variable {$memprofile['jobs']} . You might need to replace jobs with your table name. Note, your column jobs (or w/e name it is) must be inside mybb_users table.
Thank you that worked perfectly. My second thing is how can I make it so it can be easily added. So if Jobs is 0, I could possibly have two buttons that display for admins. a Plus and a minus. I need a an sql query to add a job. So If I hit this button it will turn to 1.

Thanks for your help so far.
You will need some sort of plugin or modification to do that, it cannot be achieved via template.