Skip to main content
9 votes
Accepted

How can I grab the user's IP address?

Please check this code - $jinput = JFactory::getApplication()->input; $ip = $jinput->server->get('REMOTE_ADDR', '', ''); //Here default value and filter are null, so you can write $ip = $...
Joomler's user avatar
  • 1,811
6 votes

Equivalent of unset using jinput

TL;DR: there is no equivalent, because it's not needed. JInput data is by default a reference to $_REQUEST, so it dosen't have own unset method, because it is not needed. Although it would be nice ...
Rene Korss's user avatar
  • 3,208
5 votes
Accepted

How to retrieve values of all the fields with JInput but without jform[]

Yes, you can get the form values without jform. Following is the approach: $data = $jinput->post : returns all post data $something = $jinput->post->get('something', 'default_value', '...
Liz.'s user avatar
  • 1,385
5 votes
Accepted

How to use HTMLHelper to add to the document head

1) JHtml is an alias for Joomla\CMS\HTML\HTMLHelper class. You'll have to start using the real class sooner or later because the alias will not exist in Joomla! 5.0. To use the real class you have to ...
Sharky's user avatar
  • 11.5k
4 votes

Is the following everything one should do to prevent SQL injection?

First, when reading user input you should make sure it's the correct type. The Input/Filter APIs don't handle array/string conversion. So if you're expecting STRING filter to return a string be aware ...
Sharky's user avatar
  • 11.5k
3 votes
Accepted

Input JSON strips HTML

There is no json filter which causes default filter to be applied, stripping away HTML. Use a different filter. This answer shows some examples. Using array filter should work: $input = $this->...
Sharky's user avatar
  • 11.5k
2 votes

How to create filters for Jinput?

this is quite simple In first of it create an custom Jinput class such as class JinputTelephone // what ever you want. perhaps, have a look in existing inputfilter classes under /libraries/joomla/...
JProof's user avatar
  • 196
2 votes

How can I grab the user's IP address?

I put a one-liner - and it works similar to your answer, because I do not use the object $jinput more than once; again thank you Joomler +1: $ip = JFactory::getApplication()->input->server->...
Tom Kuschel's user avatar
2 votes
Accepted

Can't decode form data as json after jinput->post->getArray() if some file is chosen

You can get file input data with this: $files = $input->files->get('inputName'); You don't have to use JRegistry and then json_decode it. You will get array from $jinput->post->getArray()...
Rene Korss's user avatar
  • 3,208
2 votes
Accepted

Filter an IP address

For the time being, I've used PHP native filter_var with the FILTER_VALIDATE_IP filter, like so: return filter_var($ip, FILTER_VALIDATE_IP); I'm still of course open to other suggestions
Lodder's user avatar
  • 26.9k
2 votes
Accepted

JRequest::get('post', JREQUEST_ALLOWRAW) has been deprecated, what is the working code now?

You are doing a small mistake here. Have a look below: What you tried: $post = JFactory::getApplication()->input->get('post', '','raw'); Here, 'post' must be the name parameter of the input ...
Liz.'s user avatar
  • 1,385
1 vote

Factory::getApplication()->input->getFloat('name') returns 5 for ".5"

Your question would appear to be better suited to being raised on the Joomla Issue Tracker, https://issues.joomla.org/, where people likely involved in making the original decision or writing the code ...
Irata's user avatar
  • 4,001
1 vote

Identify Joomla 4 API access

The most common way is to use Joomla\CMS\Application\CMSApplicationInterface::isClient() to identify current application by name. use Joomla\CMS\Plugin\CMSPlugin; class PlgSystemExample extends ...
Sharky's user avatar
  • 11.5k
1 vote

Upload single or multiple files replacing deprecated JRequest::getVar('file', '', 'files', 'array');

Use this: $this->input->files->get('file', [], 'array'); Note that returned data is formatted differently to allow iterating over files: array(2) { [0]=> array(5) { ["name&...
Sharky's user avatar
  • 11.5k
1 vote

get value of hidden field via Jinput

The $_POST array structure is determined by the name attribute of each field which exists inside of the <form></form> tags. All of the basics are here: https://docs.joomla.org/...
mickmackusa's user avatar
  • 4,826
1 vote
Accepted

Get template params from the input

If you want to access the parameters of a specific template inside the Helper, you could write a small database query, like so: use Joomla\CMS\Factory; use Joomla\Registry\Registry; class ...
Lodder's user avatar
  • 26.9k
1 vote

How to conditionally add filters to my query of the rsform_submission_values table?

If you implement the code from my earlier code, then you only need to write a dynamic $having array to generate the correct HAVING clause. I must note that your current coding attempt is not stable/...
mickmackusa's user avatar
  • 4,826
1 vote
Accepted

Setting Joomla input

Use input's set() method to set input values. $input = JFactory::getApplication()->input; $foo = $input->get('jform', array(), 'array'); $foo['formFieldName'] = 'newValue'; $input->set('...
Sharky's user avatar
  • 11.5k
1 vote

Get string name with double spaces

This is weird. raw simply returns the value of the field with no filtering whatsoever (see libraries/joomla/filter/input.php). However, it might be that there is some other filtering done before or ...
itoctopus's user avatar
  • 3,226
1 vote

Class 'JInput' not found after updating to 3.7.3

It seems your Joomla! instance is corrupted. Since using the Joomla admin does not help with the re-installation, I would suggest Do a complete Joomla! Core manual re-installation / package ...
FFrewin's user avatar
  • 19.7k
1 vote
Accepted

use Joomla Subform field values in custom field from same module

I solved this doing it a bit different. B is done via this code which grabs all the inputs and converts them to a select box. Then when the user makes a selection it copies that selection to a normal ...
purple11111's user avatar
1 vote

Add querystring parameters and generate a SEF URL

Looking at the router implementation of com_jumi here https://github.com/BonavalMultimedia/com_jumi/blob/master/com_jumi_bnvl/router.php for me it seems it doesn't handle extra parameters when sef is ...
Pep Lainez's user avatar
1 vote
Accepted

Getting structured data from JInputJSON

How do you do requests? I did something like the following in my projects: $jinput = JFactory::getApplication()->input->json; $feedback = $jinput->get('feedback', array(), 'array'); // will ...
Dennis Heiden's user avatar
1 vote

How to create filters for Jinput?

My try, i see that you have some experience with joomla so i will just put my few cents into it. you need to create system plugin you need to create a method after init or similar. now you need to ...
Lanah's user avatar
  • 522
1 vote

Why is Jinput only getting one of two values from the url?

Your malformed url querystring is to blame -- specifically the second ? which should be &. Demo: $url = 'http://localhost/kitchen-guide-new/index.php?option=com_content&view=article&id=...
mickmackusa's user avatar
  • 4,826

Only top scored, non community-wiki answers of a minimum length are eligible