Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Log out issue when using JQuery DataTables

woftwoft
edited April 2014 in Vanilla 2.0 - 2.8

Hello Guys,

Back Again with another problem :sweat_smile:

Ok so let me start, @peregrine‌ you might want to chime in here, as I am kind of using this with your members list enhanced plugin.

So I have the Table generated by @peregrine's Members list Enhanced Plugin.

I wanted to add a search feature to this, so that when mod's are looking for members within the forums they can find them quickly.

To do this, after a little research, i found the JQuery DataTables Plugin (JQuery Plugin not VF plugin :wink: )

I reference and initiate the script on the page like so:

`<?php
echo "

<.script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js">


<.script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js">
";
echo "
$("table#Users").ready( function() {
$("#Users").dataTable( {
"bLengthChange": false

    } );
    } )
    </script>";  

?>`

After using this scipt, the page and the data on the page loads fine, and the dataTables works with the table as expected, however, it forces to vanilla to sign out. every. single. time. :neutral_face:

One issue that I thought could be causing this is the page load time.

The page has a larger than normal load time as I had to modify @peregrine‌ 's original code, so that all the information of all the members is displayed on the same page, which the JQuery datatables then breaks down into seperate pages.

$Options = array('10' => '10', '15' => '15', '20' => '20', '25' => '25', '30' => '30', '50' => '50', '100' => '100', '200' => '200', '500' => '500');

This is the code I modified by adding the '500' => '500'. The '200' => '200' was not suffcient a I have nearly 300 members.

So my question is, what do you gus, in your experienced opinion, think could be causing the log out? Expecially when it only happens on this page.

Comments

  • sorry for the issues pasting the code, can;t seem to get it to work. it doesnt like me putting html scripts in. I attached the code i wanted to share.

  • load time does not influence sessions, unless those cookies session expire very short which is unlikely.

    Anything deleting cookies can cause this issue. Another thing that would cause it, is accessing the site a different way, meaning your cookie is not compatible with the url scheme, therefore than session is invalidated. The difference in url scheme can be very subtle, but if you cookies range is not broad enough, it will not be valid.

    Normally this would not be an issue becuase the domain and path of the cookie would be site wide.

    grep is your friend.

  • woftwoft
    edited April 2014

    The url that the plugin directs to is http://www.mydomain.co.uk/vanilla2/members

    The reason it is vanilla2 rather than vanilla is because this is an alternate site that I working on, before general release.

    I have just noticed another issue that may be related, when I go to http://www.mydomain.co.uk/vanilla2/ where my vanilla homepage would normally be found I get a 404 Error, and the URL looks like this http://www.mydomain.co.uk/entry

    Tried deleting the .ini files from the cache, thta didn't work.

    Tried editing the config.php file as well changing the 'cookie''domain' to:

    $Configuration['Garden']['Cookie']['Domain'] = '.mydomain.co.uk/vanilla2/';

    Now I am very confused, as I can still access the sign in through the dashboard.

  • Including another version of jquery is a good way to break many things in vanilla.

    First check if you actually need another version of jquery, or if it will run with the core one.

    If you do check if you can use a compatibility layer instead, as this will be the prefered option, some feature have been removed from jquery can be added by a compatibility layer, or better still you can add one or two extra feature on the existing version, which is preferred as that the is the version the software is being tested on.

    if you are goign to use cdn make sure they are reliable and intended to be used (not private or just for examples). Most pluigns are available to download.

    Hard coding scripting, through echo is not the recommended way to add scripting in vanilla. use native methods. Like Head->AddScript, AddJsFile,Head->AddString, Head->AddTag

    grep is your friend.

Sign In or Register to comment.