WeBWorK Main Forum

Setting Section/Recitation for LTI users

Re: Setting Section/Recitation for LTI users

by Andras Balogh -
Number of replies: 2

I don't understand why this does not work in 2.19 anymore.

I modified it to 

$LTI{v1p1}{modify_user} = sub {
  my $self = shift;
  my $user = shift;

  my $r = $self->{r}; 
  my @course_id = split /-/, $r->param("context_title");
  $user->{"section"} = $course_id[2];

};

The error message is 

Can't call method "param" on an undefined value at (eval 1302) line 40.

The debug info shows context_title => MATH-4390-05-Fall2023
The configuration file suggests to use context_id without parameter:   my @course_id = split /-/, $self->{context_id}; but that is just a long string in my case without section number in it. 
It does work: $user->{"section"} = $self->{context_id}; but it is useless in my case.

If I try to use $user->{"section"} = $self->{context_title};  I get empty string.

Aren't both  context_id and context_title just parameters? 

How is it that context_title shows up in the parameters but I cannot get its value?




In reply to Andras Balogh

Re: Setting Section/Recitation for LTI users

by Glenn Rice -

The "r" key of the $self object no longer exists.  That was the modPerl Apache::Request object.  WeBWorK 2.18 and 2.19 do not use modPerl anymore.  Now there is a Mojolicious::Controller object.  You can access that in the "c" key of the $self object.  So use $self->{c} instead.  The Mojolicious::Controller object has a "param" method that works the same as before.  So the rest of your code should work.