Forum Replies Created

Viewing 15 replies - 31 through 45 (of 122 total)
  • Forum: Plugins
    In reply to: WP-OnlineCounter

    There a few “Whos Online” Plugins kicking about, ive been meaning to make a more useable one for some time.

    Thread Starter Phunky

    (@phunky)

    arrrr great stuff, thats just what i was looking for i assumed there would be a hook or filter for it 🙂 thanks

    Ive just checked over my post again, and it wont actual work as it would be checking against as serialized array string.

    you would need to unserialize($userRole) and check against the role feild in the array

    You can do this, but it depends on the server that your WordPress is installed on.

    basicly the .gif format copyright was updated changing what was allowed to be done with the file format and in turn this ability had to be filtered out in new versions of apache.

    But tbh, if its a thumbnail anyway it would be best practise to not have it animated as why would someone want to view the same image again just because it was larger?

    here’s a quick function i knocked up for you that should return true or false depending if $userRole matches $role that is set.


    <?php
    function pky_dirtyRoleCheck($id,$role='admin'){
    global $wpdb ;
    $userRole = $wpdb->get_var("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = '$id' AND meta_key='wp_capabilities'");
    if($userRole==$role){
    return true;
    } else {
    return false;
    }
    }
    ?>

    So just set $id to the current user id and $role to the role you are trying to find!

    this will only work on WP2.0 and up!

    Please note ive not tested it 😀 just hacked it from my own personal userProfile plugin i use on my sites

    Hi Rediect1, glad you got it sorted!

    Im almost certain there is a built in function to get the user role but ive totaly forgot what it is.

    Tbh i tend to re-create the get_currentuserinfo() function myself with one that gathers all the user detail including wp_usermeta and the user role.

    Anyway im glad you got it to work 🙂

    The function i wrote only returns the role value, so you would need to echo dirty_get_role(); for my one to print.

    Try putting your widget_user_role() as the last widget on your sidebar, if it then displays all the other widgets you know there summat wrong with the widget_user_role() function its self.

    Also if its working when not being used as a widget it would seem to suggest you have not written the function correctly, i belive theres a certain way you are supose to write you widgets.

    But as i said before, ive not really bothered with widgets so cant really help much on that side of things!

    Im not too sure how to help you here, ive not really looked at widgets myself.

    Do you get a error at all on the sidebar? or is it just a case of nothing else will display after the widget_user_role()prints out?

    Sorry i should have also mentioned above that you would need to global $userdata if you hadnt already got hold of the userid.

    update_usermeta(ID,'META_NAME','META_VALUE');

    This is the function i use in all my custom signup forms to allow for extra feilds to be attached to users.

    This add’s it to wp_usermeta table instead of wp_users, which i belive is the way WP wanted people to do it

    Thread Starter Phunky

    (@phunky)

    I basicly ended up writing my own function which would create a nice user object.

    Also there is a sub-object within it with everything from wp_usermeta for that user.

    Ive done it a few times over now :S i dont have the newest version of this at work, but if you want to have a look over the code email me on mark[at]phunky.co.uk and ill send you what ive done on my new project.

    No doubt there is a better way then doing it like this but…


    function dirty_get_role($id){
    $role = explode('"',$wpdb->get_var("SELECT meta_value FROM wp_usermeta WHERE meta_key = 'wp_capabilities' and user_id = '$id'"));
    return $role[1];
    }

    This is a VERY, dirty way of doing it!

    Forum: Plugins
    In reply to: Run WP in a flash movie?
    Phunky

    (@phunky)

    So you wish to take the WordPress output and place it into flash.

    Sounds intresting, i dont think ive seen anything like this around and tbh i would be suprised if i did as it quite a strange request.

    You would most likely be better looking at some Flash/Action Scripting sites about importing data via PHP/MySQL this can be done quite easily.

    Im unsure but if Flash can parse RSS that could be another way to use the data from WordPress

    Forum: Fixing WordPress
    In reply to: Quote codes
    Phunky

    (@phunky)

    Dont get what your wanting? are you wanting to display a random quote on your page? or a quote from a post??

    Phunky

    (@phunky)

    Of course, you would need to create a theme for WordPress really – but you could just be dirty and stick it in there :S

    Quick and Simple way is to use XAMPP

Viewing 15 replies - 31 through 45 (of 122 total)