This topic has 4 replies, 2 voices, and was last updated 9 years by Radu.

  • Author
  • #128819
     kktong83
    Participant

    Hi 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();

    }

    #128827
     Radu
    Moderator
    Not marked as solution
    #128833
     kktong83
    Participant
    Not marked as solution
    #128837
     kktong83
    Participant
    Not marked as solution
    #128841
     Radu
    Moderator
    Not marked as solution
Viewing 5 posts - 1 through 5 (of 5 total)

The forum ‘Bugs & Issues’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?