Getting radio buttons on subscribe page where they should be

Solutions for other phpList version 2 users
Forum rules
Please do not ask questions here, this is for Solutions you have discovered or come across.

Getting radio buttons on subscribe page where they should be

Postby jaysprout » 9:16pm, Tue 29 Apr, 2008

Not being able to put URLs in here is a pain in my ass.

On my subscribe page, which I can't show you, you'd see the radio buttons are below "entity" (the name of a choice the user gets which would make sense if you could see it which you can't because I still can't put URLs in my posts) when they should be in the column to the right.

How do I fix that? What document do I need to hack so it's all pretty?
jaysprout
PL Nut
 
Posts: 38
Joined: 6:00pm, Wed 02 Apr, 2008
Location: Bradenton, FL

Postby H2B2 » 12:33am, Wed 30 Apr, 2008

As an alternative to changing the phplist code, you could try using a custom subscribe form, which would make changing the layout and formatting much easier.

See:
http://docs.phplist.com/CustomSubscribeForm
http://forums.phplist.com/viewtopic.php?t=5712
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Postby jaysprout » 1:43pm, Wed 30 Apr, 2008

Maybe I'm wrong about what a custom subscribe form is ... I thought that's what I made by editing the "Subscribe Page." Am I wrong? How can I edit the layout for those? All I see (where I'm looking, which could be the wrong place I suppose) are choices for putting in attributes and configuring them. I don't see a way to adjust how they're displayed or to save such changes.
jaysprout
PL Nut
 
Posts: 38
Joined: 6:00pm, Wed 02 Apr, 2008
Location: Bradenton, FL

Postby H2B2 » 1:59pm, Wed 30 Apr, 2008

The standard way of editing the subscribe page allows limited customization, mostly styling and some rearranging of the order of some user attributes you want to include. This usually meets the needs of most phplist users, and is described in http://docs.phplist.com/EditSubscribePageInfo

If you need more customization, you'll need to edit the phplist code that generates the subscribe page, which can be a bit messy if you are not familiar with php.

As an alternative to editing the phplist code, you can achieve full customization of your subscribe form by using the method described in http://docs.phplist.com/CustomSubscribeForm
This has the added advantage that you can easily place the form on any web page of your site.
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Postby jaysprout » 2:12pm, Wed 30 Apr, 2008

I need more customization. All I want is for my page to not look messy. So where is the phplist code that generates the subscribe page so I can edit it?

It's a simple problem - I just need to know where I go to fix it.

If I could put URLs in my posts, I could show you and you'd say "Oh, is that all it is? Go here ..."
jaysprout
PL Nut
 
Posts: 38
Joined: 6:00pm, Wed 02 Apr, 2008
Location: Bradenton, FL

Postby H2B2 » 2:19pm, Wed 30 Apr, 2008

Not entirely sure, but you could take a look at lists/index.php
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Postby jaysprout » 2:42pm, Wed 30 Apr, 2008

Is that also where I could find the document to edit the Unsubscribe page and Preferences page?
jaysprout
PL Nut
 
Posts: 38
Joined: 6:00pm, Wed 02 Apr, 2008
Location: Bradenton, FL

Postby jaysprout » 3:17pm, Wed 30 Apr, 2008

Getting the radio buttons where they should be and not looking sloppy would be totally sweet.

If I can conquer that issue, I'd also like to add a button on the Unsubscribe page. There's a link for "update your preferences" and a button for "unsubscribe." I don't mind if the link stays there but I'd like a button for it as well, right next to the Unsubscribe button.

Any suggestions?
jaysprout
PL Nut
 
Posts: 38
Joined: 6:00pm, Wed 02 Apr, 2008
Location: Bradenton, FL

Postby awi » 7:37am, Tue 03 Jun, 2008

jaysprout wrote:Getting the radio [i]buttons where they should be and not looking sloppy would be totally sweet.


:lol: Yes, I think so too!

Well, actually I don't know anything about php-coding, but by much trial and error I found a solution that works for me (in phplist version 2.10.5.) Maybe it does for others as well:

In /lists/admin/subscribelib2.php find

case "radio":

and make a simple change in the following line 823

from

Code: Select all
<tr><td colspan=2><div class="%s">%s</div>


to

Code: Select all
<tr><td><div class="%s">%s</div><td>


(Make sure to only change the code inbetween the single quotes.)

Please let me know if it works for others too...


Greetz,
Angie

Btw: phplist ist der Hammer! Or: phplist is fabulous! :!:
awi
phpList newbie
 
Posts: 2
Joined: 6:32am, Tue 03 Jun, 2008

Postby Guest » 11:39am, Tue 02 Sep, 2008

Hi all,

Neat mod, anyone know how to do the same for;

case "checkboxgroup":
case "checkbox":

i.e. where there isn't a div tag?

Perhaps this could then be used to do the same tidying of the preferred format for emails section too.

Any ideas???
Guest
 

Re: Getting radio buttons on subscribe page where they shoul

Postby Moonbase » 1:16am, Mon 11 Nov, 2013

awi, thanks a million!

Unbelievable, it’s now 5 years later, and it still hasn’t been fixed in phpList 3.0.5!

Current change for it to look okay now is (line 912+913):
Code: Select all
        case "radio":
          $output[$attr["id"]] .= sprintf("\n".'<tr><td><div class="%s">%s</div><td class="attributeinput">',$attr["required"] ? 'required' : 'attributename',stripslashes($attr["name"]));


Hopefully, this (and the checkbox equivalent) will be put into the core soon …
Moonbase
PL Nut
 
Posts: 21
Joined: 1:11am, Mon 11 Nov, 2013
Location: Krumbach (Schwaben), Germany

Re: Getting radio buttons on subscribe page where they shoul

Postby Moonbase » 2:03am, Mon 11 Nov, 2013

To facilitate a nice look for both radio buttons and checkbox groups, I actually modified /lists/admin/subscribelib2.php in two places:

For radio buttons (lines 912-927):
Code: Select all
        case "radio":
          $output[$attr["id"]] .= sprintf("\n".'<tr><td><div class="%s">%s</div><td class="attributeinput">',$attr["required"] ? 'required' : 'attributename',stripslashes($attr["name"]));
          $values_request = Sql_Query("select * from $table_prefix"."listattr_".$attr["tablename"]." order by listorder,name");
          while ($value = Sql_Fetch_array($values_request)) {
            if (!empty($_POST[$fieldname]))
              $checked = $_POST[$fieldname] == $value["id"] ? 'checked="checked"':'';
            else if ($data[$attr["id"]])
              $checked = $data[$attr["id"]] == $value["id"] ? 'checked="checked"':'';
            else
              $checked = $attr["default_value"] == $value["name"] ? 'checked="checked"':'';
            $output[$attr["id"]] .= sprintf('<input type="radio"  class="attributeinput" name="%s" value="%s" %s />&nbsp;%s&nbsp;',
              $fieldname,$value["id"],$checked, $value["name"]);
          }
          if ($attr["required"])
            $output[$attr["id"]] .= sprintf('<script language="Javascript" type="text/javascript">addGroupToCheck("%s","%s");</script>',$fieldname,$attr["name"]);
          break;


For checkboxgroups (lines 946-961:
Code: Select all
        case "checkboxgroup":
          $output[$attr["id"]] .= sprintf("\n".'<tr><td><div class="%s">%s</div><td class="attributeinput">',$attr["required"] ? 'required' : 'attributename',stripslashes($attr["name"]));
          $values_request = Sql_Query("select * from $table_prefix"."listattr_".$attr["tablename"]." order by listorder,name");
          while ($value = Sql_Fetch_array($values_request)) {
             $selected = '';
            if (is_array($_POST[$fieldname])) {
              $selected = in_array($value["id"],$_POST[$fieldname]) ? "checked" : "";
            } elseif ($data[$attr["id"]]) {
              $selection = explode(",",$data[$attr["id"]]);
              $selected = in_array($value["id"],$selection) ? 'checked="checked"':'';
            }
            $output[$attr["id"]] .= sprintf('<input type="checkbox" name="%s[]"  class="attributeinput" value="%s" %s />&nbsp;%s&nbsp;',
              $fieldname, $value["id"], $selected, stripslashes( $value["name"]) );
          }
          $output[$attr["id"]] .= sprintf('</td></tr>');
          break;


This is valid for phpList 3.0.5 and renders as follows:

Radiobutton o One o Two o Three
Checkboxgroup [_] One [_] Two …

I think it is more usual for a user to find both the radiobutton/checkbox to the left of the label.
Moonbase
PL Nut
 
Posts: 21
Joined: 1:11am, Mon 11 Nov, 2013
Location: Krumbach (Schwaben), Germany


Return to Answers, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 2 guests