I have been working lately on making a custom filed (" User Location") mandatory to fill up when registring with the endless and kind help of user Sama55 ( That i thank very very much for his great support).
Sama55 suggestion was
1) to create a plugin with function call : qa_register_plugin_module('filter', 'qa-profile-checker.php', 'qa_profile_checker', 'Profile Checker'); in qa-plugin.php.
2) then to use the following code under qa-profile-checker.php file.
<?php
require_once QA_INCLUDE_DIR.'qa-filter-basic.php';
class qa_profile_checker {
function filter_profile(&$profile, &$errors, $user, $oldprofile) {
$fb = new qa_filter_basic();
$userfields=qa_db_single_select(qa_db_userfields_selectspec());
foreach ($profile as $key => $value) {
// sanitize
$profile[$key] = qa_html($value);
foreach($userfields as $userfield) {
if ($userfield['fieldid']==$key) break;
}
switch ($userfield['title']) {
case 'location': // Location (Required)
$fb->validate_length($errors, $key, $value, 1, 100);
break;
}
}
}
}
The solution worked great no problem until i switched from localhost ( windows) to live server (linux), a strange error message pop up when hitting sign up button:
Parse error: syntax error, unexpected 'QA_INCLUDE_DIR' (T_STRING) in /home/picassau/public_html/qa-plugin/q2a-location-required/qa-profile-checker.php on line 1
How comes that in local it runs correctly but on server it does't not ? !!! Some one can help figuring out that mystery.
PS : Script Full credit to Sama55