I have a class with this function to provide a user language based on $user_id
function provide_user_language($user_id) {
return apply_filters('get_user_language',$user_id);
}
So in my script, I can simply get the user language by doing this:
$user_language=$this->provide_user_language($user_id);
But I need to associate this $user_language to a "set_current_language". I can do this by doing an add filter hook, but add_filter does not accept parameters. This is the add_filter line with the function itself but I don't know how to pass the $user_id or the $user_language so that set_current_language will be set to $user_language:
add_filter('set_current_language', array(&$this,'provide_user_language'));
I tried following this one but it won't work:
Passing a parameter to filter and action functions
I appreciate any tips. Probably there is an easy way.