Skip to content

Commit b1c8da7

Browse files
Sam Tukemichield
authored andcommitted
Add preferences link to /lists homepage (#310)
* Added clarifying inline comments * Added link to preferences page * Added default value for constant SHOW_PREFERENCESLINK * Documented constants relating to public subscribe page links
1 parent f46745d commit b1c8da7

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

public_html/lists/admin/init.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,9 @@
257257
if (!defined('UNSUBSCRIBE_JUMPOFF')) {
258258
define('UNSUBSCRIBE_JUMPOFF', 1);
259259
}
260+
if (!defined('SHOW_PREFERENCESLINK')) {
261+
define('SHOW_PREFERENCESLINK', true);
262+
}
260263
if (!defined('SHOW_UNSUBSCRIBELINK')) {
261264
define('SHOW_UNSUBSCRIBELINK', true);
262265
}

public_html/lists/config/config_extended.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,15 @@
440440
// see also https://mantis.phplist.com/view.php?id=15274
441441
define('PREFERENCEPAGE_SHOW_PRIVATE_LISTS', 0);
442442

443+
// Show the link(s) to subscribe page(s) on the phpList public homepage (lists/)
444+
define('SHOW_SUBSCRIBELINK', true);
445+
446+
// Show link to the preferences page on the phpList public homepage (lists/)
447+
define('SHOW_PREFERENCESLINK', true);
448+
449+
// Show link to the unsubscribe page on the phpList public homepage (lists/)
450+
define('SHOW_UNSUBSCRIBELINK', true);
451+
443452
// Show 'All Subscribers' section on Subscriber Lists page
444453
// This flag enabled will show a list called “All subscribers” on the
445454
// Subscriber Lists page that has all subscribers in the system as members.

public_html/lists/index.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,12 @@
333333
FileNotFound();
334334
}
335335
} else {
336+
// If no particular page was requested then show the default
336337
echo '<title>'.$GLOBALS['strSubscribeTitle'].'</title>';
337338
echo $pagedata['header'];
338339
$req = Sql_Query(sprintf('select * from %s where active', $tables['subscribepage']));
340+
341+
// If active subscribe pages exist then list them
339342
if (Sql_Affected_Rows()) {
340343
while ($row = Sql_Fetch_Array($req)) {
341344
$intro = Sql_Fetch_Row_Query(sprintf('select data from %s where id = %d and name = "intro"',
@@ -346,12 +349,19 @@
346349
strip_tags(stripslashes($row['title'])));
347350
}
348351
}
352+
// If no active subscribe page exist then print link to default
349353
} else {
350354
if (SHOW_SUBSCRIBELINK) {
351355
printf('<p><a href="'.getConfig('subscribeurl').'">%s</a></p>', $strSubscribeTitle);
352356
}
353357
}
354358

359+
// Print preferences page link
360+
if (SHOW_PREFERENCESLINK) {
361+
printf('<p><a href="'.getConfig('preferencesurl').'">%s</a></p>', $strPreferencesTitle);
362+
}
363+
364+
// Print unsubscribe page link
355365
if (SHOW_UNSUBSCRIBELINK) {
356366
printf('<p><a href="'.getConfig('unsubscribeurl').'">%s</a></p>', $strUnsubscribeTitle);
357367
}

0 commit comments

Comments
 (0)