Home : Products : Gossamer List : Discussion :

Products: Gossamer List: Discussion: Re: [demon] Subscription list: Edit Log

Here is the list of edits for this post
Re: [demon] Subscription list
Hi,

The global template below will handle this matter:

Code:
sub {
my ($lids, $email) = @_;

return unless $lids;
lib->import('PATH_TO_GLIST/private/lib');
require GT::SQL;
require GT::SQL::Condition;
my $db = GT::SQL->new('PATH_TO_GLIST/private/defs');
my %hash;
if ($email) {
my $subs_db = $db->table('Subscribers');
my $sth = $subs_db->select(['sub_list_id_fk'], { sub_email => $email });
while (my ($lid) = $sth->fetchrow_array) {
$hash{$lid} ||= 1;
}
}
my @lids = split(',', $lids);
my $db_list = $db->table('Lists');
$db_list->select_options('ORDER BY lst_title');
my $lists = $db_list->select(GT::SQL::Condition->new(lst_id => 'IN' => \@lids))->fetchall_hashref;
if (%hash) {
foreach (@$lists) {
$_->{checked} = 1 if (exists $hash{$_->{lst_id}});
}
}
return { loop_glist_lists => $lists, lists => $lids };
}

Now, you can use the global in user_include_profile.html or user_signup.html form like:
<%global_name('list_id1,list_id2,...', $comm_email)%>
<%loop loop_glist_lists%>
<input name="app_glist_subscribed" value="<%lst_id%>" <%if checked%>checked<%endif%>
<%endloop%>

list_id1, list_id2 are list ID that you want to display on the user profile form.

Hope thats help.

TheStone.

B.

Last edited by:

TheStone: Jan 4, 2005, 10:11 AM

Edit Log: