Welcome to Geeklog, Anonymous Monday, May 27 2024 @ 06:37 am EDT

Geeklog Forums

COM_featuredCheck delete all featured flags except one


Text Formatted Code
function COM_featuredCheck()
    global $_TABLES;

    // Look for multiple featured frontpage articles. If more than one pick the newest.
    $sql = "SELECT sid FROM {$_TABLES['stories']} WHERE featured = 1 AND draft_flag = 0 AND frontpage = 1 AND date <= NOW() ORDER BY date DESC LIMIT 2";
    $resultB = DB_query($sql);
    $numB = DB_numRows($resultB);
    if ($numB > 1) {
        $B = DB_fetchArray($resultB);
        // un-feature all other featured frontpage story
        $sql = "UPDATE {$_TABLES['stories']} SET featured = 0 WHERE featured = 1 AND draft_flag = 0 AND frontpage = 1 AND date <= NOW() AND sid <> '{$B['sid']}'";
I have multiple topics and each topic has one featured article. The code above allows one featured article and delete the other featured flags through all topics. Is this how it works?

Status: offline


Site Admin
Registered: 09/27/05
Posts: 1468
Yes that is how it works.

We did have a feature request for what you are describing at one point:


but it was closed.

I would think it should be easy to implement (by just changing that SQL) but from what I remember their was some sort of problem which would crop up. Unfortunately I cannot remember what it was and I didn't leave a comment about it.

If it is something you want add a feature request and if you do customize your site with it be sure to include your code in the feature request so we can add it in.
One of the Geeklog Core Developers.

All times are EDT. The time is now 06:37 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content