-
Author
-
July 11, 2016 at 18:52 #128819
kktong83
ParticipantHi Again,
I realise I have another problem after migrating from Salient Theme to Kleo, my code in bp-custom.php doesn’t seems to work. It is working fine if I switch back to Salient, do Kleo support bp-custom.php?
My following code fail in Kleo but works in Salient.
//Check either required fields are empty or not
function check_required_bp_fields(){
global $wpdb;
global $bp;
$group_id = ”;
$the_user_id = $bp->loggedin_user->id;
//echo $bp->groups->current_group->id;
$user_detail = get_userdata( $the_user_id );
//echo “<pre>”;
$role = $user_detail->roles[0] ;
$user_nicename = $user_detail->data->user_nicename ;
//print_r( $user_detail );
//echo “</pre>”;
if( $role == ‘author’ ){
$group_id = 2;
}elseif ( $role == ‘subscriber’ ) {
$group_id = 3;
}
$qry = ” SELECT field_id, user_id, name, value FROM `”.$wpdb->prefix.”bp_xprofile_data` d,
`”.$wpdb->prefix.”bp_xprofile_fields` f WHERE d.field_id = f.id AND user_id=$the_user_id AND f.group_id=$group_id AND f.is_required = 1″;
//$qry = ” SELECT name FROM `”.$wpdb->prefix.”bp_xprofile_fields` WHERE `group_id` = $role AND is_required = 1 “;
$results= $wpdb->get_results( $qry );
print_r($results);
foreach ($results as $key => $value) {
//echo $value->name.” : “.$value->value.”<br>”;
//$required = xprofile_get_field_data( $value->name , $the_user_id );
$required = $value->value;
if( !$required ){
$site_url = site_url().”\/members\/”.$user_nicename.”/profile/edit/group/”.$group_id;
echo “<script type=’text/javascript’>
alert(‘Firstly, You have to complete your profile.’);
window;location = ‘”.$site_url.”‘;
</script>”;
}
}
//echo $company_name = xprofile_get_field_data( ‘Company Name’ , $the_user_id );
//die(‘Good’);
exit();
}
-
AuthorPosts
The forum ‘Bugs & Issues’ is closed to new topics and replies.