query in the course of the database

Home Forums Legacy Support Support queries Update Issues query in the course of the database

Viewing 15 posts - 1 through 15 (of 36 total)
  • Author
    Posts
  • #298183
    Food-interactive
    Participant
    Hallo Team, why we can´t access on the ´current user´, or the ´current user id´ in the wplms course? We use our own plugin, wich accessed perfectly in the previous wplms version... many thanks
    #298402
    Anshuman Sahu
    Keymaster
    Well if you are using new wplms v4 version then you wont be able to access it anymore as v4 is cookieless login system which uses JWT token which is standard in webapps now . If you want the logged in user id then you have to log the user in to the website from wp-login.php or bbpress form or someother third party login form which logs user into wordpress . The new wplms does not logs user into wordpress which enhances speed .
    #298465
    Food-interactive
    Participant
    is there any workaround for us, or easyer solution? In which database the userdata (like email, user id or username) now is been saved? How can we have access to it?
    #298696
    Anshuman Sahu
    Keymaster
    Well we have a fallback for this . All you have to is to let user login with wordpress system and enable "Synchronise WP with VibeBP Login " from wp-admin -> vibebp -> settings to auto login user when she logs in with wordpress . This way you will be able to get the user_id and our system will also work as logged in .
    #312429
    Food-interactive
    Participant
    In the course unit we don´t get excess to the current wordpress user meta. Our plugin that we use in the unit needs the excess to it because we want users data that we stored in the wordpress datatbase before. Thank you
    #312800
    Anshuman Sahu
    Keymaster
    Well in V4 system we do not use the user_id but use the token to identify the user and its details including the id . Can you please share more details on exactly which plugin or customization you are using and what data is shows there ? We would recommend you to switch to old course status page by : 1. setting course status page in wp-admin -> wplms -> course manager . and 2 . and changing the course layout in wp-admin -> appearance -> layouts -> course , select any from 1st to 5th layouts .
    #312880
    Food-interactive
    Participant
    This reply has been marked as private.
    #313099
    Anshuman Sahu
    Keymaster
    Well all we have this filter : apply_filters( 'bp_course_api_get_user_course_status_item',$return, $request ); to use within the units . ITs the $retun['content'] in which property got set . You can get the user id by :
    
    $body = json_decode($request->get_body(),true);
            
    
                if(!empty($body['token']) && is_numeric($request['course'])){
                    
                    $this->user = apply_filters('vibebp_api_get_user_from_token','',$body['token']);
                    $user_id = $this->user->id;
                }
    
    #313173
    Food-interactive
    Participant
    This reply has been marked as private.
    #313367
    Anshuman Sahu
    Keymaster
    Ofcourse you have the user id , you can use the user functions . now its upto you and your team how you handle this in new system .
    #315500
    Food-interactive
    Participant
    Hey Alex, i tried your code, but i didn't get the user id. when i run it in the unit, the unit is trying to load, but nothing happend, it crushed... can you give me a better code example, that will give me the user id please? Greetings from food-interactive team
    #315793
    Anshuman Sahu
    Keymaster
    Can you please share the code tip where you are adding this .
    #315854
    Food-interactive
    Participant
    Jes, we need the user id in many points in our plugin. In the previous wplms-version it worked. Here is one example from our plugin, where we need the user id: function frühstück_shortcode() { ob_start();
    if ( is_user_logged_in() ) 
    {
        $userr  = get_current_user_id();
    
        $anam   = get_user_meta($userr,'anamnese',true);
    
        if ( $anam AND isset($anam) )  
        {
            frühstück_darstellung();
        }
        else
        {
            echo '<h3>Bitte Körperdaten eingeben und ABSCHICKEN-KNOPF nicht vergessen!</h3><p>Dann werden Dir auch Deine Rezepte richtig angezeigt ;)';
        }
    } 
    else
    {
        echo '<p><h3>Bitte einloggen...</h3>';
    }     
    
    return ob_get_clean();
    
    }
    #316122
    Anshuman Sahu
    Keymaster
    please try adding this given code in your wplms-customizer.php file in wplms customizer plugin :
    add_filter( 'bp_course_api_get_user_course_status_item',function($return, $request ){
        $body = json_decode($request->get_body(),true);
        if(!empty($body['token']) && is_numeric($request['course'])){
            
            $this->user = apply_filters('vibebp_api_get_user_from_token','',$body['token']);
            $user_id = $this->user->id;
        }
        if(!empty($user_id)){
            //do your thing here and add the content to :
    
            ob_start();
            $anam   = get_user_meta($user_id,'anamnese',true);
    
            if ( $anam AND isset($anam) )  
            {
                frühstück_darstellung();
            }
            else
            {
                echo '<h3>Bitte Körperdaten eingeben und ABSCHICKEN-KNOPF nicht vergessen!</h3><p>Dann werden Dir auch Deine Rezepte richtig angezeigt ;)';
            }
              
    
            $cont =  ob_get_clean();
    
            $return['content'] = $cont;
        }
        return $return;
    },10,2);
    #316178
    Food-interactive
    Participant
    This reply has been marked as private.
Viewing 15 posts - 1 through 15 (of 36 total)
  • The topic ‘query in the course of the database’ is closed to new replies.