Hello. I want to make another condition after the user pressed login button.
On the user profile i added a custom field (checkbox).
I need to check if this checkbox is checked or not.
My problem : i can't make a correct querry and can't select id_member...
Here is my code, but i dont know where i need to place it on LoginOut.php
In function Login 2 () only ? after ?
$user_settings = $smcFunc['db_fetch_assoc']($request);
$smcFunc['db_free_result']($request);
$username = $_POST['user'];
$sql = $smcFunc['db_query']('','
SELECT
p.id_member, p.value, mem.id_member, mem.member_name
FROM {db_prefix}themes AS p
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = p.id_member)
WHERE p.variable = "cust_checkbox"
AND mem.id_member = "$username"'
);
while ($result = $smcFunc['db_fetch_assoc']($sql)) {
$smcFunc['db_free_result']($sql);
if ($result['value'] === 1) {
header('Location: login_condition.php');
}
}
i tested it and didn't work ...
$sql = $smcFunc['db_query']('', '
SELECT value
FROM {db_prefix}themes
WHERE id_member = {int:id_member}
AND variable = "cust_checkbox"',
array(
'id_member' => $user_info['id'],
)
);
if ($smcFunc['db_num_rows']($sql) == 1)
$context['cust_login'] = true;
return;
and i added in LoginTemplate.php in the template_login() function :
if (!empty($context['cust_login'])) {
echo "This is the test";
}
and this echo appears with the login form. i need it after, when the user has clicked on the login button.
any idea where i need to place my code ?