• hi didier,

    i’m not only a satisfied user of your plugin, but also the author of generalstats. my plugin basically counts cornerstones of wordpress instances like posts, pages, tags, … and also user counts.

    the latter are (at least) temporary wrong if for example users need to confirm their account with sabre. in other words, these users should not be counted until their confirmation.

    here come my questions:

    • is it possible to insert a simple check if sabre is installed and activated?
    • for which types of wp-users do you store datasets in sabre_table? (something like no users above level 8?)
    • is there a global function which returns the name of your table, or even better returns the number of confirmed users?
    • do you also update the user_status field in wp_users?

    in the following i prepared a bit of code which either i could use or you could integrate in future versions…

    $q = "SELECT count(u.ID) FROM $wpdb->users as u, wp_sabre_table s WHERE u.ID=s.user_id AND s.status like '%ok%' UNION SELECT count(u.ID) FROM $wpdb->users as u, $wpdb->usermeta as m WHERE u.ID=m.user_id AND m.meta_key='wp_user_level' AND m.meta_value>8";

    what do you think?

    greetz,
    berny

    https://www.ads-software.com/extend/plugins/sabre/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello Berny,

    First of all, thank you for your interest in Sabre ! ??

    To answer your questions:
    – When Sabre is installed and activated, the global variable SABRE_TABLE is defined and contains the complete name (with the prefix included) of the Sabre table. Which answers at the same time to your third question…
    – Users with ‘edit_user’ capability are not controlled by Sabre, all others are checked.
    – There’s no global function returning the number of confirmed users at that time. But I can consider it…
    – Sabre doesn’t use the user_status field of users table as I don’t know if WordPress will use or maintain it in the future.

    I hope I have answered your questions. Don’t hesitate to ask again if you have more points to discuss about.

    Best regards,
    Didier

    Thread Starter Bernhard Riedl

    (@neoxx)

    hi didier,

    thanks for your reply. today i worked out the necessary code and tested it within generalstats. it counts all users in the sabre table with status ‘ok’ and adds the cardinality of the residual set of all users in the wp users’ table which are not stored in the sabre_table. imho that should do the job, until someone forgets to import the users into sabre as mentioned in your faq’s. ??

    $q="SELECT COUNT(u.ID) FROM $wpdb->users as u, ".SABRE_TABLE." as s WHERE u.ID=s.user_id AND s.status in ('ok') UNION SELECT COUNT(u.ID) FROM $wpdb->users as u LEFT JOIN ".SABRE_TABLE." as s ON u.ID=s.user_id WHERE s.user_id IS NULL";
    
    $results = $wpdb->get_col($q);
    $userCount=$results[0]+$results[1];

    in addition we could use the function has_cap(), but that shouldn’t be necessary. – what do you think?

    btw. from a oo point of view i really like your suggestion, that you provide a global function within sabre. if you like to, you could use the code above…

    anyway, after realization of the count function either in my or your plugin, i also plan to link sabre in my readme.txt file and also make a small remark within the php code. which link do you prefer – your page or the wordpress plugin page?

    greetz,
    berny

    Hi Berny,

    You’re perfectly right, your coding should do the trick ! No need to check user’s capability.
    Right now, I suggest that you go on with the count function in your plugin as I don’t know when I will release the next version of Sabre. ??
    If you want to link to Sabre in your own documentation (of which I thank you, BTW), you’d better mention the Sabre’s WordPress plugin page.

    Best regards,
    Didier

    Thread Starter Bernhard Riedl

    (@neoxx)

    hi didier,

    i just uploaded version 0.71 of generalstats which now works together with sabre. – as promised, i linked you in the description page of generalstats and also mentioned sabre in the php source.

    if you want to, you can also add a link on future updates of sabre to generalstats.

    thanks for the cooperation.

    greetz,
    berny

    Hello Berny,

    I’m glad to say that, with Sabre 0.7.3, I added a link to your plugin in the FAQ tab of the Sabre page on www.ads-software.com/extend/ and on my own site too.
    It’s a real pleasure to collaborate with you.

    Best regards,
    Didier

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Generalstats reflects Sabre’s functionality’ is closed to new replies.