Sorry to be a pain..
I tried it, most of it did work. The <%endif%> tags worked fine, so did the URL and show only subscriptions.
But it did not actually display the different lists, it only gave the following error:
Error: Variable 'subscript_list' is not a code reference (subscript_list is what I called the global).
The global you showed, I entered that as a global in LinksSQL since I could not find anywhere to enter a global or either list or community.
The code I used on the user_profile template is (did a small change, see part in red):
<%subscript_list('My Newsletter,Another Newsletter', $comm_email)%>
<%loop loop_glist_lists%>
<input name="app_glist_subscribed" type="checkbox" value="<%lst_id%>" <%if checked%>checked<%endif%>">
<%endloop%>
The Global Code I entered into LinksSQL is:
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 };
}
Any idea?
Thanks!
I tried it, most of it did work. The <%endif%> tags worked fine, so did the URL and show only subscriptions.
But it did not actually display the different lists, it only gave the following error:
Error: Variable 'subscript_list' is not a code reference (subscript_list is what I called the global).
The global you showed, I entered that as a global in LinksSQL since I could not find anywhere to enter a global or either list or community.
The code I used on the user_profile template is (did a small change, see part in red):
<%subscript_list('My Newsletter,Another Newsletter', $comm_email)%>
<%loop loop_glist_lists%>
<input name="app_glist_subscribed" type="checkbox" value="<%lst_id%>" <%if checked%>checked<%endif%>">
<%endloop%>
The Global Code I entered into LinksSQL is:
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 };
}
Any idea?
Thanks!