Home › Forums › Legacy Support › Support queries › Update Issues › query in the course of the database
- This topic has 35 replies, 2 voices, and was last updated 4 years, 1 month ago by Food-interactive.
-
AuthorPosts
-
August 25, 2020 at 10:24 pm #298183Food-interactiveParticipantHallo 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 thanksAugust 26, 2020 at 2:07 pm #298402Anshuman SahuKeymasterWell 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 .August 26, 2020 at 6:09 pm #298465Food-interactiveParticipantis 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?August 27, 2020 at 12:55 pm #298696Anshuman SahuKeymasterWell 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 .September 19, 2020 at 4:00 pm #312429Food-interactiveParticipantIn 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 youSeptember 21, 2020 at 1:08 pm #312800Anshuman SahuKeymasterWell 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 .September 21, 2020 at 7:10 pm #312880Food-interactiveParticipantThis reply has been marked as private.September 22, 2020 at 2:22 pm #313099Anshuman SahuKeymasterWell 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; }
September 22, 2020 at 6:34 pm #313173Food-interactiveParticipantThis reply has been marked as private.September 23, 2020 at 3:36 pm #313367Anshuman SahuKeymasterOfcourse 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 .October 1, 2020 at 8:42 pm #315500Food-interactiveParticipantHey 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 teamOctober 3, 2020 at 1:38 pm #315793Anshuman SahuKeymasterCan you please share the code tip where you are adding this .October 3, 2020 at 5:49 pm #315854Food-interactiveParticipantJes, 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();
October 5, 2020 at 2:42 pm #316122Anshuman SahuKeymasterplease 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);
October 5, 2020 at 7:35 pm #316178Food-interactiveParticipantThis reply has been marked as private. -
AuthorPosts
- The topic ‘query in the course of the database’ is closed to new replies.