Closed (fixed)
Project:
Prepopulate
Version:
6.x-2.x-dev
Component:
Code
Priority:
Minor
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 Jan 2008 at 00:33 UTC
Updated:
5 Jul 2011 at 02:52 UTC
i needed a way to prepopulate fields but not be blatantly obvious about it, so i figured i'd share how i did it.
insert the following at line 35 of prepopulate.module:
// get base64encoded prepopulate values
if (variable_get('prepopulate_allowed_' . $type, TRUE) && $_GET['pp']) {
parse_str(base64_decode($_GET['pp']),$_GET);
}
this allows you to base64 encode a query string and pass it to the page as ?pp=
for example, if you have the query string:
$query = 'edit[title]=' . urlencode($titlestring) . '&edit[body]=' . urlencode($bodystring)
you can encode it like this:
$encoded_query = 'pp=' . base64_encode($query);
resulting in a hideously long and not so blatantly obvious prepopulating query :)
Comments
Comment #1
add1sun commentedIf this goes in, it will need to be option that is off by default and can be turned on in the settings, with a reasonable explanation of what it is and why you'd use it. This would also go in the D6 version 2 of the module.
Comment #2
bobthecow commentedI think the beauty of this is that it's "off" by default. unless someone creates a url with "pp=XXX" and adds a base64 encoded value, it will do nothing. Adding a configuration option to disable this might be a bit overkill.
Perhaps mentioning it in the documentation as an available option (along with a use case and example) would be enough?
Comment #3
add1sun commentedAhh gotcha, for some reason I completely blew by the
&& $_GET['pp']in there. :p I'll add this to the module in the V2 that's a-coming. I probably won't get time for that for a few weeks.Comment #4
jbrauer commentedThis got added but the issue wasn't closed out.
Comment #5
dennys commentedI just tested it in 2.1, it's great, thanks. The generated URL will like the following one, don't forget to put "node/add/transaction?" in the URL
Comment #7
giorgio79 commentedThis is some great stuff.
Could we have a bit more control over this in admin?
I would only like to encode only the actual value, instead of the entire query string like this
Comment #8
jbrauer commentedPlease open new issues as new requests instead of re-opening closed issues.