Don't Show this again Page

topic posted Tue, January 29, 2008 - 2:57 PM by  Lee
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...
posted by:
offline Lee
United Kingdom
  • Well 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


Recent topics in "PHP Developers"

Topic Author Replies Last Post
Looking for a technical partner Ryan 2 August 26, 2011
CGI form mail issue Tedward 0 April 25, 2011
progress bar Satinder 2 March 17, 2011
Building an online gift economy - hans 0 August 10, 2010