Flash module add-on: A required parameter (sesskey) was missing

Flash module add-on: A required parameter (sesskey) was missing

by Scott Barlow -
Number of replies: 5

Hi Jamie,

I have followed the development of this module since the first post with lots of excitement. There is true potential in this project. I recently went to the 1.5 version of Moodle Moodle 1.5 ALPHA (2005043000), to be specific. Now I receive this when trying to create an activity.

Any suggestions???

Average of ratings: -
In reply to Scott Barlow

Re: Flash module add-on: A required parameter (sesskey) was missing

by Jamie Pratt -
I'm downloading 1.5 now. I'll let you know when I have a fix for this. It is probably just a matter of adding sesskey to the hidden variables in the form in flash/mod.html
In reply to Jamie Pratt

Re: Flash module add-on: A required parameter (sesskey) was missing

by Jamie Pratt -
I fixed this problem.

You just need to add :


<INPUT type="hidden" name=sesskey      value="<?php  p($USER->sesskey)?>" >

into the list of hidden variables for every form for editing the activities.

So what I did is searched and replaced :

<INPUT type="hidden" name=mode          value="<?php  p($form->mode) ?>">

with :

<INPUT type="hidden" name=mode          value="<?php  p($form->mode) ?>">
<INPUT type="hidden" name=sesskey      value="<?php  p($USER->sesskey)?>" >

I just committed this to the CVS.

Jamie
In reply to Jamie Pratt

Re: Flash module add-on: A required parameter (sesskey) was missing

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
This will work, but the official way to do it is to use the sesskey() function:

<INPUT type="hidden" name=sesskey value="<?php sesskey() ?>" >
In reply to Martin Dougiamas

Re: Flash module add-on: A required parameter (sesskey) was missing

by Jamie Pratt -
Thanks Martin.

I'll change the code to that in my TUI and Flash modules.
In reply to Martin Dougiamas

Re: Flash module add-on: A required parameter (sesskey) was missing

by Jamie Pratt -
I've decided I'm going back to the p($USER->sesskey) way.

php sesskey() generates a fatal error on Moodle 1.4 whereas p($USER->sesskey) will just be ignored.

I'll stay with this for the time being because I want my code to be compatible with 1.4 and 1.5 without having to support 2 different versions.