+###
+# user prefs
+###
+
+=item get_page_pref NAME, TABLENUM
+
+Returns the user's page preference named NAME for the current page. If the
+page is a view or edit page or otherwise shows a single record at a time,
+it should use TABLENUM to link the preference to that record.
+
+=cut
+
+sub get_page_pref {
+ my ($prefname, $tablenum) = @_;
+
+ my $m = $HTML::Mason::Commands::m
+ or die "can't get page pref when running outside the UI";
+ # what's more useful: to tie prefs to the base_comp (usually where
+ # code is executing right now), or to the request_comp (approximately the
+ # one in the URL)? not sure.
+ $FS::CurrentUser::CurrentUser->get_page_pref( $m->request_comp->path,
+ $prefname,
+ $tablenum
+ );
+}
+
+=item set_page_pref NAME, TABLENUM, VALUE
+
+Sets the user's page preference named NAME for the current page. Use TABLENUM
+as for get_page_pref.
+
+If VALUE is an empty string, the preference will be deleted (and
+C<get_page_pref> will return an empty string).
+
+ my $mypref = set_page_pref('mypref', '', 100);
+
+=cut
+
+sub set_page_pref {
+ my ($prefname, $tablenum, $prefvalue) = @_;
+
+ my $m = $HTML::Mason::Commands::m
+ or die "can't set page pref when running outside the UI";
+ $FS::CurrentUser::CurrentUser->set_page_pref( $m->request_comp->path,
+ $prefname,
+ $tablenum,
+ $prefvalue );
+}
+