Kwebble : Blog

Label: php

  • PHP Login System with Admin Features

    Gepubliceerd op 31 augustus 2005 in Programming.

    PHP Login System with Admin Features describes the implementation of a complete login system that can be easily integrated into any website. Included features are: member levels, admin center, visitor tracking, account info for the users, forgotten password support.

    • php
    • security
  • Searching pages in WordPress 1.5

    Gepubliceerd op 20 februari 2005 in Programming. 2 reacties

    Update (march 6, 2004): David B. Nagle made a plugin which gives the same results as this hack, but does it the right way, using the plugin system. Use it instead of hacking as described below.

    A few days ago version 1.5 of WordPress was released. One of the interesting new features is the addition of pages. You use pages for static content on a site, which means you can now use WordpPress to build a larger part of you site. Very useful.

    But one thing I don’t understand is why pages are left out of search results? Through a thread on the support site I found a bug report that states This is intended behaviour until we revamp search.. So I looked for a solution.

    Hacking the search function

    Warning: This describes a change to one of the core WordPress files. It may introduce bugs or unwanted side effects when used. I haven’t done much testing, but it seems to work ok.
    I you decide to use this hack it’s your choice, you are responsible, not me. If you’re not comfortable with it don’t apply the change.

    To have the search function also return pages I changed classes.php. You find this file in the wp-includes directory. On line 493 this piece of code starts:

            if ($this->is_page) {
                $where .= ' AND (post_status = "static"';
            } else {
                $where .= ' AND (post_status = "publish"';
            }

    Change it to the following:

            // 2005-02-20, Rob Schluter: Hack to search posts & pages.
            if (!empty($q['s'])) {
                $where .= ' AND ((post_status = "static" or post_status = "publish")';
            } else{
                if ($this->is_page) {
                    $where .= ' AND (post_status = "static"';
                } else {
                    $where .= ' AND (post_status = "publish"';
                }
            }
            // end hack
    

    That’s it, put the changed file on your server and the search should work for pages also.

    • php
    • search
    • wordpress
  • Building a linklog with Bloglines

    Gepubliceerd op 11 december 2004 in Programming. 1 reactie

    There’s a new part on the site, a list of links or linklog that contains links to interesting items from the webfeeds I read. The list is not maintained on this site, but comes from Bloglines, which I use as my reader for webfeeds. Here’s how I did that:

    The links are stored using the blog on Bloglines that comes with an account. I activated my blog and created Kwebble’s linklog. On Bloglines you can post to the blog direct from the reading page by using the Clip/Blog This link. This makes collecting items from several webfeeds very easy.

    The next step is to get the data here on Kwebble.com. The input from Bloglines that can be used for this is the webfeed for the blog. With the freely available MagpieRSS using this webfeed is easy. MagpieRSS can retrieve the webfeed, cache it and parse it’s contents. These few lines of PHP add the items to this page:

    require_once('rss_fetch.inc');
    $rss = fetch_rss('http://www.bloglines.com/blog/kwebble/rss');
    echo '<ul>';
    foreach ($rss->items as $item) {
        preg_match('/.*?><a href="(.*?)".*?>(.*?)<.*?/', $item[description], $matches);
        echo '<li><a href="' . $matches[1] . '">' . $matches[2] . '</a></li>';
    }
    echo '</ul>';
    

    The regular expression gets the first link from each message. I could have used $item[description] directly but Bloglines adds some attributes to the link I don’t want.

    • bloglines
    • php
  • Nieuwere artikelen »
  • Rubrieken

    • Artikelen
    • Foto's
    • Links
    • Media
    • Overheid
    • Programming
  • Recente Berichten

    • Stanford Web Applications course lectures
    • The importance of knowing Unicode
    • “If you are not paying for it, you’re not the customer; you’re the product being sold.”
    • Inzage in je gegevens bij Facebook
    • Tuning Oracle UCM 11 & Site Studio performance
  • Abonneren

    • Atom feed Artikelen
    • Atom feed Reacties
  • Archief

© Rob Schlüter - Contact