Deny access if JS is disabled ?
-
Hello Tobias,
Bit by bit Tablepress is integrating and uncovering a pathway forward. Thanks!
In at attempts towards data privacy a Redirection has been added to redirect from the page without the GET filter.
ie:
https://example.com/?table_filter=filter-text = valid
https://example.com = redirects to another pageThis works well enough for some instances but not all.
Complimentary to this:
is it possible to deny access (or redirect) if JS is disabled?
-
Hi,
thanks for your post, and sorry for the trouble.
This is rather tricky, because if JS is disabled, it can (obviously) not be used for any logic for denial of access or redirection.
The only idea that I have right now would be to use a CSS approach to show an error message, instead of the actual content. This is also what WordPress does in the admin area. You could try extracting the relevant code from the HTML source of any wp-admin page.
TablePress itself is not involved with that though.
Regards,
TobiasThank you Tobias, that is something to think about! Options in that regard are currently being researched. As a non-coder it’s a bit of a patch and snap arrangement.
TablePress is perfect for a part of this project and discovering it has been exiting and promising in a variety of areas. I look forward to continuing its use and promotion to others.
Another part of the project requires a heavy data set that might work better with a unified database. Would you know of a database tool for a large (large) set of data that might lend itself well to someone not at all versed in coding?
Kind Regards,
CallardHi,
good to hear that TablePress is so helpful ??
Unfortunately, I’m not aware of easy-to-use database tools that don’t require much coding. The challenge for them always is that a lot of customization is needed, which is only really possible with coding.
Best wishes,
TobiasShucks, I was hoping your insider knowledge would come up with a hidden gem. But if you can code, why wouldn’t you?! ??
In regards to the GET function, is there a way to GET a short phrase? as in
?table_filter=more-than-one-word
If I’m understanding correctly this has to be alphanumeric; is there a way to allow it to include other characters? as in
?table_filter=symbol-for-pi
Sorry, if there are answers to these questions in the forums, I’ve looked but could very easily have missed them.
Kind Regards,
CallardHi,
yes, filtering for a sentence (or a word combination) should be possible. If it’s specifically about the
-
character, you would have to allow that first, though. For that, please change line 23 of the file tablepress-shortcode-filter-get-parameter.php from$filter_term = preg_replace( '#[^a-z0-9 ]#i', '', $filter_term );
to
$filter_term = preg_replace( '#[^a-z0-9 -]#i', '', $filter_term );
Regards,
TobiasHello Tobias,
Thank you! That tip is working well, various symbols have been added as a test (dash, comma, etc) and are working on their own.
Is there a trick to getting special characters to work? Such as an apostrophe, non-breaking space, or ampersand working? IE.
https://example.com/?table_filter=apostrophe&pos;s
Does not return results with “apostrophe’s” but rather returns results with, “apostrophe” and seems to ignore the “‘s”. IE.
https://example.com/?table_filter=&
Returns the whole table instead of the single entry with an & symbol. Same with specific symbols such as π or § ?
And is there a way to search a phrase in GET? IE. “another word” or “anther’s word” or “§ yet another π”
A variety of combinations have been attempted but nothing seems to be working.
Kind Regards,
Tiffany-
This reply was modified 4 years, 3 months ago by
callard.
Hi Tiffany,
these special characters are a bit more tricky, as they are part of a URL. Thus, they need to be “URL encoded”, see https://en.wikipedia.org/wiki/Percent-encoding
Most commonly, the space character has to be passed as%20
in the URL, for example. The&
would be%26
.Regards,
TobiasThat makes sense, thank you once more! Variables for PHP, CSS, HTML and other options had been tried but URL had been missed; the URL one is the most logical. Your extension codes are beautifully replete.
The added URL terms have been added as follows:
$filter_term = preg_replace( '#[^a-z0-9 %27 %22 %2D %26 %20 %2C]#i', '', $filter_term );
I’ve been playing around and there are a couple strange issues, I’m sure they are straight forward but currently outside my scope:
1.
=Cross
=Cross%2D
and=%2DReference
are working, however=cross%2Dreference
breaks the table.2. apostrophe
=word%27s
breaks the table and=%27s
returns everything as does ampersand=%26
?3. The GET filter is searching columnDefs false is there a way to make sure it does not search this column?
Kind Regards,
CallardHi,
you are getting closer ?? These
%20
and similar entities are only used in the URLs. In thatpreg_replace()
call in the PHP file, you would have to add the actual character.
For testing, it might be easier to comment out that line, by prepending//
.3. I’m not sure what you mean here. The GET filter has nothing to do with the
columnDefs
, as it applies server-side filtering (or did you modify it for the auto filtering of DataTables?).Regards,
TobiasThank you for your patience and guidance. This is exactly why I don’t code.
With:
$filter_term = preg_replace( '#[^a-z0-9 , -]#i', '', $filter_term );
or Line 23 // :Working w/ Line 23 & //:
Two Words
Word,
Word1, Word2
Working w/ Line 23 but breaks //:=%22word1%20word2%22
Works // Not-working w/ Line 23:cross%2Dreference
Not-Working Either is Anything with an apostrophe:Word's
3. The filter_table employs:
"columnDefs": [ { "searchable": false, "targets": [0, 2, 3 ] } ]
This is working when the data is searched from the Search box. If searching data only in these columns there are no results. Yay! ??
However, when employing a GET filter through a URL using text only used in columns 0, 2, 3 it returns results for data in columns 0, 2, 3. The purpose of the GET & the columnDefs is to only show data from column 1. Is the GET supposed to respect the “searchable”: false, “targets”: ?
Hi,
Working w/ Line 23 but breaks //:
=%22word1%20word2%22
This is kind of expected, as the TablePress Row Filter Extension does not interpret
"
but uses them literally.Is the GET supposed to respect the “searchable”: false, “targets”: ?
No, not at all ?? The GET parameter uses the filtering from https://tablepress.org/extensions/row-filter/ which is controlled by Shortcode parameters and not the
columnDefs
Custom Command.Regards,
TobiasTobias, Thank You.
When an apostrophe is inserted into Line 23 it returns the following error message:
Your PHP code changes were rolled back due to an error on line 23 of file wp-content/plugins/tablepress-shortcode-filter-get-parameter/tablepress-shortcode-filter-get-parameter.php. Please fix and try saving again.
syntax error, unexpected ‘]’, expecting ‘,’ or ‘)’This is understandable as it is reading it as code instead of as a term. It is important the Apostrophe GET commands are working as they occur frequently; Is there a workaround?
Kind Regards,
Callardre: 3. Shucks, I had hoped the GET parameter would respect variables applied to the tables themselves. Oh, well. ?? TablePress is still a powerful little extension!
Hi,
as for the
'
: It might be as easy as escaping it with a\
in that line 23, i.e.$filter_term = preg_replace( '#[^a-z0-9 ,\'-]#i', '', $filter_term );
Regards,
TobiasHello Tobias,
Thank you kindly for bearing with me on this – it worked (of course)!
Kind Regards,
CallardHi,
great! Thanks for the confirmation!
Best wishes,
Tobias -
This reply was modified 4 years, 3 months ago by
- The topic ‘Deny access if JS is disabled ?’ is closed to new replies.