Home › Forums › Legacy Support › Support queries › Update Issues › get user id from token in a main page
- This topic has 10 replies, 2 voices, and was last updated 4 years ago by Food-interactive.
Viewing 11 posts - 1 through 11 (of 11 total)
-
AuthorPosts
-
October 19, 2020 at 7:36 pm #319439Food-interactiveParticipanthi Alex, i have another question about the topic you already helped successfully: ‘query in the course of the database’. you gave us the code to get the user id in a course/unit. it worked perfect :) but... it won't work in a normal page (it will work only, if admin is logged in). can you please change your code snippet, so that we can get the user id also from there (outside the course)? that would be really great :) greetings from food-interactive teamOctober 21, 2020 at 4:22 am #319703Anshuman SahuKeymasterCan you please share exactly where do you want the user id , which page which module?October 21, 2020 at 5:44 am #319738Food-interactiveParticipantThis reply has been marked as private.October 22, 2020 at 2:22 pm #320161Anshuman SahuKeymasterWell im sorry for this you need to be logged into wordpress . Note that as we do not handle the page content therefore we do not have our system user id available there by any means in the content . For this you need the user to be logged into wordpress login system . Note here that for the units in courses you have to use the code we provided earlier on your another topic . But for the pages you will need the user to log into wordpress login system. .October 22, 2020 at 5:01 pm #320197Food-interactiveParticipantThis reply has been marked as private.October 23, 2020 at 2:48 pm #320405Anshuman SahuKeymasterIm sorry to say but that is not possible .You have to follow the other tip replacing the login popup with wpp-login.php on I suggested another topic . https://wplms.io/support/forums/topic/query-in-the-course-of-the-database/page/2/#post-317476October 23, 2020 at 5:24 pm #320438Food-interactiveParticipantThis reply has been marked as private.October 24, 2020 at 1:27 pm #320568Anshuman SahuKeymasterWell you need both code . this one to get user id in course in which data is shown using api : add_filter( 'bp_course_api_get_user_course_status_item',function($return, $request ){ in api we do not have any get_current_user_id even though the user is logged in to wordpress login system or in our system. Now second is this : jQuery(document).ready(function(){jQuery('a.vibebp-login').on('click',function(event){event.preventDefault();event.stopPropagation();window.location.href='https://food-interactive.de/wp-login.php'});}); which is used to remove our modern login and add wordpress login is needed to get the user logged in to wordpress so that you can get this value get_current_user_id() on other pages other than which runs on apiOctober 26, 2020 at 6:23 pm #320907Food-interactiveParticipantThis reply has been marked as private.October 27, 2020 at 2:51 pm #321130Anshuman SahuKeymasterbecause you are logged into wordpress when you login as admin . please forget the above since we have added a new setting in vibebp version 1.4.5 to sync the wp and vibebp logins : enable these both in wp-admin-> vibebp -> settings: https://prnt.sc/v7ziyc Just enable this and you will be fine .No need to change the login link and you will get the user_id.October 28, 2020 at 7:26 pm #321482Food-interactiveParticipantThis reply has been marked as private.
-
AuthorPosts
Viewing 11 posts - 1 through 11 (of 11 total)
- The topic ‘get user id from token in a main page’ is closed to new replies.