I’m trying to install a whitelist register in my site. So i’ve found this code :
function buddypress_inscrit_selon_domaine( $result ) {
$domainesOK = array(
'gmail.com',
'infopower.fr'
);
$error = 'Vous devez utiliser un domaine valide.';
$email = $result['user_email'];
$domaine = array_pop(explode('@', $email));
if ( ! in_array($domaine, $domainesOK))
{
$result['errors']->add('user_email', __($error, 'bp-restrict-email-domains' ) );
};
return $result;
}
add_filter( 'bp_core_validate_user_signup', 'buddypress_inscrit_selon_domaine' );
It works very well. But i’d like to use a custom post and custom field to get back the whitelist domain. Well, i want that the user can add a new domain in a custom field in a post. Well, for each domain a post. My problem is how to get back this custom field of all this post type in a array, and put the array on the place of this :
$domainesOK = array( 'gmail.com', 'infopower.fr' );
I’ve tried with this :
$domainesOK = $wpdb->get_col("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = 'urldudomaine'" );
But the program doesn’t filter the whitelist.
Well, thanks a lot for any help. And sorry for my bad english ;-)
Françoise
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire