MyBB Community Forums

Full Version: Access custom profile fields without being logged in
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I'm working on a php script where i need to access custom profile fields.

<?php

$name = $_GET['name'];
$pass = $_GET['pass'];
$user = validate_password_from_username($name,  $pass);

$customval = $user['fid5'];
?>

This works perfectly once I'm logged in. But without being logged in I can only access variables like username, uid, usergroup etc...

after print_r'ing $user I realized it has more variables while being logged in.

Can anyone help me accessing the custom profile fields?
The guest user does not have custom profile fields because they are not registered. Therefore you will never be able to access custom profile fields for guests.
(2014-04-15, 02:49 AM)Wildcard Wrote: [ -> ]The guest user does not have custom profile fields because they are not registered. Therefore you will never be able to access custom profile fields for guests.

it is no guest account. the same user has less variables in its array when im logged out
So what you want is a page that outputs the custom userfields in some way? For viewing?
it is supposed to output the custom profile field value of a specific user after validating the username and password
whose username and password? The logged in user? In that case why does it need to work for guests?
I'm working on a client which sends forum user info to the php script and I want to receive the custom profile field value.. so basicly I'm working without any browser and cookies, that's why I need to access the value without being logged in.
sorry for bumping the thread, but I still didn't find any solution
(2014-04-16, 10:19 AM)peter-griffin Wrote: [ -> ]sorry for bumping the thread, but I still didn't find any solution
why not just send the uid of the user you want, to your script and query the database for that ?

example
$user= $_get['uid'];
select * from table where uid = $user

I know there are errors with the code but just a starter perhaps