Page 1 of 2

How to get back the user ID and object learning id

Posted: Thu Oct 25, 2018 3:17 pm
by gihel
Hi,
How to get back the user ID and object learning id in a page html
because I insert iframe and would like keep the information.

thank you

Re: How to get back the user ID and object learning id

Posted: Thu Oct 25, 2018 3:19 pm
by alfa24
please explain what you're trying to obtain... make an example

Re: How to get back the user ID and object learning id

Posted: Thu Oct 25, 2018 3:51 pm
by gihel
OK I try to explain.
I want an iframe with some dynamic object and The user must comment with a text .
I want to keep the information so that the teacher can analyze the answers.
I also want in the iframe page to print a summary of the work done as well as a graph.
I want to create an additional table in the database to keep the information so that at the end of the course (several learning objects) I can output a total synthesis.
To do this I need the user ID and LO ID.
I can get these information by JScript or parameters in the iframe but how to do it ?

Re: How to get back the user ID and object learning id

Posted: Thu Oct 25, 2018 4:46 pm
by alfa24
why iframe? and what kind of application will be in the iframe?

Re: How to get back the user ID and object learning id

Posted: Thu Oct 25, 2018 4:48 pm
by canelli
why you don't try to use a standard LO of type test ?

for your object you need to develop some php pages. chek how other php use library and internals .

I you need we can develop for you the enanchement . send me a PM

Re: How to get back the user ID and object learning id

Posted: Sat Oct 27, 2018 5:11 pm
by gihel
OK I found the solution, I can continue my work.

Re: How to get back the user ID and object learning id

Posted: Sat Nov 10, 2018 6:39 pm
by cao
Hello gihel
This is an open forum.
There will be other people with the same issues as you, as a result the proper thing to do is to share.
I found a solution does not help other people.
thank you

Re: How to get back the user ID and object learning id

Posted: Sat Nov 10, 2018 7:26 pm
by max
Thanks cao, this is an excellent point and I am glad it's a forum user that makes it

Re: How to get back the user ID and object learning id

Posted: Mon Nov 12, 2018 7:09 pm
by gihel
SORRY I don't think other people was interested.
I saw in the source of the page there was a field input "username"
I made a js script who find the field and pickup the val

Code: Select all

  "var nameUser=$('#username').val();"
after I call a script php with ajax and I pickup the id in the database

Code: Select all

   $utilisateur=$_POST['utilisateur'];
            //----------Recherche ID user ---------------------------
	$sql="select from core_user where userid='/$utilisateur';";
	
	$result=mysqli_query($bdd, $sql);
	$idst=0;
	if ($result){
		$ligne=mysqli_fetch_array($result);
		$cleUser=$ligne['idst'];
		echo "cleUser= ".$cleUser;
	}
I hope you like it (yes I know it's forbidden, but I am french and you are Italian, there is nothing forbidden for us)

Re: How to get back the user ID and object learning id

Posted: Mon Nov 12, 2018 7:14 pm
by alfa24
your solution is dangerous...