SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    Freelance Web Designer KeithMcL's Avatar
    Join Date
    Oct 1999
    Location
    Dublin, Ireland
    Posts
    1,125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Moderating Submissions

    I'm trying to work about a way of validating submissions for my upcoming site.

    Basically, when a registered member logs in they can submit a featured deal (web hosting). When I login to the admin cp I want to be able to approve the submissions in bunches of 5 or 10. I want it to work very similarly to the way posts awaiting moderation works on vB. I tried viewing the code of vb's moderate.php file but it's way too complicated for me at the mo. I'm still learning. Would a foreach loop do the trick? Here's what spits out the radio buttons at the moment:

    PHP Code:
    while($row $result->fetch()) {
       echo 
    '<li><strong>' .$row['title']. '</strong></li>';
       echo 
    '<p>' .nl2br($row['details']). '</p>';
       echo 
    '<p>' .$row['url']. '</p>';
       echo 
    '<p><label for="app_'.$row['dealid'].'"><input type="radio" name="eventaction['.$row['dealid'].']" value="1" id="app_'.$row['dealid'].'">Approve</label>';
       echo 
    '<label for="del_'.$row['dealid'].'"><input type="radio" name="eventaction['.$row['dealid'].']" value="-1" id="del_'.$row['dealid'].'">Delete</label>';
       echo 
    '<label for="ign_'.$row['dealid'].'"><input type="radio" name="eventaction['.$row['dealid'].']" value="0" id="ign_'.$row['dealid'].'" checked="checked">Ignore</label></p>';
      } 

  2. #2
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Just add another field in the DB called approved and give it a default value of 0 and when you've approved them change it to 1. Then only display those submissions WHERE approved = 1

  3. #3
    Freelance Web Designer KeithMcL's Avatar
    Join Date
    Oct 1999
    Location
    Dublin, Ireland
    Posts
    1,125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I already have a field called status which is defaulted to 0. I need to know how to change the status to 1 for several submissions in one go if approved and if not approved to delete them altogether.

  4. #4
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could use a loop to update each affected record individually (seperate mysql query for each record to be updated/deleted) or you could construct two long sql statements, one for the approved posts and one for deletion.

    UPDATE tableName
    SET status=1
    WHERE primaryKey = <some_value>
    OR primaryKey = <another_value>
    OR primaryKey = <yet_another_value>

    Same with the delete

    DELETE FROM tableName
    WHERE primaryKey = <some_value>
    OR primaryKey = <another_value>
    OR primaryKey = <yet_another_value>

    You would have to write a bit of php code to loop through and construct those sql strings.

  5. #5
    Freelance Web Designer KeithMcL's Avatar
    Join Date
    Oct 1999
    Location
    Dublin, Ireland
    Posts
    1,125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The reason I'm doing it this way is because I don't want to have to change the approval system a few months down the line. I'm hoping that i'll get hundreds of submissions a month and would like to be able to approve them in bunches rather than invidually as it'll save time.

    I think i'm getting closer to figuring it out from slicing up the moderate.php file vbulletin uses. If they can do it, so can I

  6. #6
    Freelance Web Designer KeithMcL's Avatar
    Join Date
    Oct 1999
    Location
    Dublin, Ireland
    Posts
    1,125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tiss ok now, I got it working


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •