View Issue Details

IDProjectCategoryView StatusLast Update
0015235phpList 3 applicationSubscribe Processpublic29-04-19 11:11
Reporterlwc 
PrioritynormalSeverityfeatureReproducibilityalways
Status newResolutionopen 
Product Version3.4.1 
Target VersionFixed in Version 
Summary0015235: Support setting list membership and HTML preference via HTTP GET vars for remote subscriptions / ajax / form submissions
DescriptionYou already accept $_REQUEST['email'] and $_REQUEST['emailconfirm'] so there's no reason not accept defaults via $_GET parameters for the other two fields:

1) Allow ?p=subscribe&list[x]=signup

function ListAvailableLists...

  if (isset($_POST['list'])) {
    $list = $_POST["list"];
// custom code - start
  } elseif (!isset($_POST["subscribe"]) && isset($_GET['list'])) {
    $list = $_GET["list"];
// custom code - end
  } else...

2) Allow ?p=subscribe&htmlemail=1

function ListAttributes...

    if (isset($_POST['htmlemail'])) {
      $htmlemail = $_POST["htmlemail"];
// custom code - start
    } elseif (!isset($_POST["subscribe"]) && isset($_GET['htmlemail'])) {
      $htmlemail = $_GET["htmlemail"];
// custom code - end
    }
Additional InformationNote that you should NOT under any cirumstances "just" use $_REQUEST for "list" and "htmlemail" because it would turn them into required fields!

That's why this request also fixes request 0011011
TagsNo tags attached.

Relationships

related to 0011011 new Preselection of one, all or some lists per subscribe-page url 
related to 0015236 new Support for defining a default for "htmlemail" 

Activities

lwc

18-02-09 13:38

updater   ~0050506

Please add relationship to 0011011

lwc

12-08-09 10:34

updater   ~0050712

Here's a more complicated but much more friendly solution for 1):

1) Allow ?p=subscribe&list=x,y,z (or just list=x)

function ListAvailableLists...

  if (isset($_POST['list'])) {
    $list = $_POST["list"];
// custom code - start
  } elseif (!isset($_POST["subscribe"]) && isset($_GET['list'])) {
    $list_value = "signup";
    $list_values = explode(",", $_GET["list"]);
    if (function_exists(array_fill_keys)) // Only in PHP 5+
      $list = array_fill_keys($list_values, $list_value);
    else // For PHP 4, per phplist's current system requirements
      foreach($list_values as $key=>$value)
          $list[$value] = $list_value;
// custom code - end
  } else...