Fork me on GitHub

registered users  Bottom

  • how can i put the number of users like some where on my page fo rexample.. 125 registered users thanks
  • Perhaps with something like this, paraphrased from the stats module:

    $userdb = $dbconn->Execute("SELECT count(*) AS count FROM $pntable[users]");
    list($usernum) = $userdb->fields;
    echo pnVarPrepForDisplay($usernum-1);

    That's the basic idea. If you set it up right, you could even make a variable accessible to your theme (plugin script with Xanthia for example), and just display the total count on your site globally if you want.
    --Kevin
  • thanks for the code :)

    I put

    Code

    <!--[php]-->
    $dbconn =& pnDBGetConn(true);
    $pntable =& pnDBGetTables();
    $userdb = $dbconn->Execute("SELECT count(*) AS count FROM $pntable[users]");
    list($usernum) = $userdb->fields;
    echo pnVarPrepForDisplay($usernum-1);
    <!--[/php]-->


    In my Xanthia template and it showed the number of members, it'd probably be neater to make a plugin for Xanthia tho like you say, but for me that does it's job on an entry page "We have this many members, Join/Register" :)

This list is based on users active over the last 60 minutes.