Hi, I'm trying to create a page with a "don't show this page again" checkbox within a members area for a new network I'm building but I'm stumped as to how to do it and Google Searches are getting me nowhere, I'm guessing there are two ways to do it using either cookies or SQL - Does anyone have any ideas or know of any ready made scripts...
-
Re: Don't Show this again Page
Tue, January 29, 2008 - 8:18 PMWell i would say you want to store it in some kind of profile in the DB in most cases. This is because if you use cookies/sessions if that cookie or session expires then theyll see the page, or have to go through and reset it to no view again. That said the code is going to differ wildly depending on your DB and its schema.
id use a m2m relationship with a user_page_flags table consiting of a pk, a varchar or a fk to another table containing flags, a fk to the user_profile table and column with the value for the page (like an url or another fk to a table containing pages). then when the user clicks on ignore id have it create/update a user_page_flag related to the user_profile, the page and a flag.
So if i were using Propel as my ORM the entire operation in the script on the server might look like this:
$user = UserProfilePeer::retreiveByPk($pk); //assuming youve passed th primary key of the user profile you want in as $pk
$upf = new UserPageFlag();
$upf->setFlag('i'); // assume 'i' is your flag for ignore
$upf->setPage($page); // assume $page is the page url or Page object to reference
$user->addUserPageFlag($upf);
$user->save();