Quantcast
Channel: General developer forum
Viewing all articles
Browse latest Browse all 37675

$DB->insert_record([table], $obj) not inserting all data from $obj?

$
0
0
by Eric Ellis.  

Firstly, I apologize if I've missed some piece of documentation that addresses this, but I haven't found it.

I'm working on modifying the wonderful LTIProvider module that Juan Leyva has authored to make it a bit more functional for my needs.  In one of the files within the module, there is this: 

<code>

$userlog = new stdClass();
        $userlog->userid = $user->id;
        $userlog->toolid = $tool->id;
        // TODO Improve these checks
        $userlog->serviceurl = $serviceurl;
        $userlog->sourceid = $sourceid;
        $userlog->consumerkey = optional_param('oauth_consumer_key', '', PARAM_RAW);
        // TODO Do not store secret here
        $userlog->consumersecret = $tool->secret;
        $userlog->lastsync = 0;
        $userlog->lastgrade = 0;
        $userlog->lastaccess = time();
        $DB->insert_record('local_ltiprovider_user', $userlog);

</code>

Which works as expected. 

I've modified the table this is inserting to by adding a column 'returnurl' with a datatype of longtext that is nullable. 

I've added the following to the above code, just above the insert_record call:

<code>
        if ($_POST['launch_presentation_return_url']) {
            $userlog->returnurl = $_POST['launch_presentation_return_url'];
        }

</code>

The code still fires, and works, but the column for returnurl is not being populated. 

I have verified that the object does have a value for returnurl.  It's currently "[url/to/server/path/to/file/]?section_id=36&cp=my_course-6"

I'm confused as to why this is behaving as it appears to be. 


Viewing all articles
Browse latest Browse all 37675

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>