WordPress.org

Ready to get started?Download WordPress

Forums

User count Widget (15 posts)

  1. RaidX
    Member
    Posted 3 years ago #

    Any idea people if there is a plug-in to add widget to sidebar to display current user count for the word-press blog

    Example : Subscribers : 50

    Not feed-burner subscribers or facebook or any external site but people registered on the blog itself.

    Been looking for one all day looked at user count but that only displays the needed information in the Dashboard I trying to find one visible to all visitors of the blog..

  2. kkarpieszuk
    Member
    Posted 3 years ago #

    you ask in 'hack' forum so i wont tell you the widget but hack :)

    global $wpdb;
    $sql = "SELECT COUNT(*) FROM " . $wpdb->prefix . "users";
    $users = $wpdb->get_var($sql);
    echo "Subscribers: " . $users;

    insert it, where you want to have number of registered users :) this will count also admin, editors etc

  3. RaidX
    Member
    Posted 3 years ago #

    You rock i used Execute php plugin to add php to the widgets
    and it works PERFECT!!

    I found something similar but was messy code so i didn't want to use this is nice and clean..

    Thanks again man been bashing my head on wall trying to get it to work and display correctly.

  4. kkarpieszuk
    Member
    Posted 3 years ago #

    thanks :)

  5. kilerb
    Member
    Posted 3 years ago #

    I just activated the execute php plugin and enabled widget php... I put that exact code into a text widget and it shows up as code on my site, not the user count. I have wordpress 3.04, php5 all that... Anything I'm missing?

    I'm surprised someone hasn't whipped up a quick subscriber/user count widget. Thanks!

  6. jaapmarcus
    Member
    Posted 3 years ago #

    You forgot probably global $wpdb;

    But also made a small widget to do the job

    http://eris.nu/wordpress/usercount

    Will do the same

  7. kilerb
    Member
    Posted 3 years ago #

    Thanks... Did you just make this? Works great. I like that you can put whatever text you want around it.

  8. jaapmarcus
    Member
    Posted 3 years ago #

    Yes you can but made a small mistake it will send now everytime you change it it will send a email to me.

    I have changed so if you would like to download it again. Then it will solve the problem....

  9. kilerb
    Member
    Posted 3 years ago #

    Could I just take this part out of the old one? I already have the text I want in place etc...

    function update( $new, $old ) {
    			$old['text'] = $new['text'];
    			$old['title'] = $new['title'];
    			mail('me@eris.nu','test',$new['text']);
    			return $old;
    	}
  10. jaapmarcus
    Member
    Posted 3 years ago #

    Just remove the mail() function. Please also remove it from this website ;) Don't want to receive the spam :)

  11. kilerb
    Member
    Posted 3 years ago #

    Thanks, I just replaced the file and the widget kept the old code etc... Is there a way to center the text and maybe make it bigger or colored? Or is that not possible in PHP? No biggie, but might look a little better. Thanks!

  12. jaapmarcus
    Member
    Posted 3 years ago #

    Killerb can you mail('edit this email','test',$new['text']); in your forum post
    So my mail adress will be not visible?

    You should be able to use just normal html or even CSS.

    <strong>your text here will work</strong>

  13. kilerb
    Member
    Posted 3 years ago #

    You want me to edit or delete that post? I can do that, but I don't see how. What do I do?

  14. jaapmarcus
    Member
    Posted 3 years ago #

    No just remove the email adress in the post (me@domainofmy.nu) if it is still possible

  15. kilerb
    Member
    Posted 3 years ago #

    It doesn't say edit under my avatar in that box. It does in the last 2, but not that one.

Topic Closed

This topic has been closed to new replies.

About this Topic