When a user wants to subscribe to a specific feed, she needs a page she can visit to automatically create her user account and a second page where the subscription settings are made. The page for the account setup is covered in the previous chapter.
For subscription manipulation, a new php script email_sub.php3
is created. This file requires the normal login as in the admin scripts.
When the script is accessed, it checks if there is a record in the email_auto_users table for the user id of the logged in user. If so, the confirmed flag is checked. If it is 0, only a hint is displayed saying that confirmation is still missing and how to do the confirmation.
Then, the script selects all records from the subscription database table subscriptions which match the logged in user id. The select should join with the respective slice_owner and category table records as well as the slice type.
The current subscriptions are displayed in a table. Each row from the subscriptions table is displayed as a row in the table, indicating category (can be NULL, then insert "all"), content type (can be NULL, then insert "all"), slice_owner, frequency and last post date.
The table should also have a column with a button saying "delete" in each row. Hitting this button would cause the row to be immediately deleted from the subscriptions table.
Below the table, there should be a form for additions to the subscriptions table. The form contains
On submission of this form, the script should check if there is a slice which indeed has the given combination of slice owner and content type. If not, the new subscription should not be added and instead, a message describing the problem should be displayed. A hint may be given to the user to broaden their subscription.
Then, the new record is added to the subscriptions table.
Whenever a subscription setting is changed, if the user has a record in the ref id="email_auto_users"> table, the field last_change in the email_auto_users talbe is updated to the current time.