Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Forum: Plugins
    In reply to: How to hack user level?
    Thread Starter agapeincognito

    (@agapeincognito)

    The author of the Multiply plugin has now polished off the fix I mentioned above and released a new version:

    https://rephrase.net/box/word/multiply/

    agapeincognito

    (@agapeincognito)

    In Manish’s defense (talk about full circle), their turn around for bug reports is excellent. When I reported bugs I had found, they had fixed within a couple of days and a new version ready for download. You might want to point some things out to the authors – I have no doubt they’ll be on top of it!

    Forum: Plugins
    In reply to: How to hack user level?
    Thread Starter agapeincognito

    (@agapeincognito)

    Important FYI:

    I have discovered that you can’t easily do the same kind of fix for get_userdatabylogin. So far, I have found this affects two areas:

    (1) Posting via client software (xmlrpc)
    (2) Level 10 user privileges are no longer assumed on additional presses (rights must be specifically granted)

    I am currently researching, but any help is appreciated.

    agapeincognito

    (@agapeincognito)

    Manish:

    Understood that it was a full productivity app, but for what was needed in this post, it was kind of misleading. Somewhat more of a sales pitch rather than a helpful recommendation. HOWEVER, at $37, that’s a respectable recommendation ??

    Forum: Plugins
    In reply to: How to hack user level?
    Thread Starter agapeincognito

    (@agapeincognito)

    Additional info:

    You will want to add the following to the end of each IF line (before the end parenthesis):

    && $mb_id

    This ensures none of this new code is executed when the Default (original) blog/press is selected.

    You may also want to alter this slightly and use it as necessary for get_userdatabylogin, and both functions can be placed into the Multiply plugin so that you don’t have to edit the original code. The plugin author has also reviewed the above and gave it a thumbs up.

    Let me know if you find any problems with it.

    Forum: Plugins
    In reply to: How to hack user level?
    Thread Starter agapeincognito

    (@agapeincognito)

    Okay, I figured it out (I think)…

    For those who care and for reference sake, it appears that the Multiply plugin DOES correctly set the $user_level variable for a given press (non-default blog). However, in 1.5.x WordPress doesn’t look at this variable when checking several (if not all) of the permissions (such as the user_can_create_post permission/function in functions-post.php). Instead, this function calls the get_userdata function found in pluggable-functions.php, which returns the “cached” user data level.

    Therefore, I added the following lines under the get_userdata function:

    if ( empty($press_cache[$mb_id]) && $userid != 0) {
    $presses = mb_authorized_presses();
    $cache_userdata[$userid]->user_level = $presses[$mb_id]->level;
    } else {
    $cache_userdata[$userid]->user_level = $press_cache[$mb_id]->level;
    }

    This uses the press cache if available (updates it for the given user if empty), then sets the WordPress cached user level equal to the current Multiply press user level for the current press.

    After doing this, everything Multiply was intended to do seems to work fine. I currently have users set at “0” in the User Management. Then, in the Presses management, I increase their levels as desired. After logging in as them, they have NO rights on the Default Press and the exact rights needed on the other presses.

    I don’t yet know if there are any negative affects from this (such as in large environments or if I have somehow messed something else up). So far though, everything is working great!!!

    Forum: Plugins
    In reply to: How to hack user level?
    Thread Starter agapeincognito

    (@agapeincognito)

    Thanks, Michael! That was very helpful, but I don’t think it’s exactly what I’m looking for. It does give me a much better starting point though ??

    I think (and let me stress “think”) what I’m really looking for is some way to change the master variable right at the beginning. I’m not sure why I’m having such a hard time figuring out how to do it.

    It isn’t that I want to change what the various levels do (I’m happy with the way WP has them defaulted). Rather, I want to have it look at the Multiply table for the user level instead of the WordPress table. At first, I thought I would need to change all the current WP variables to Multiply variables. But, I think I may be able to just set the value of WordPress user level variable to equal the Multipy user level value for the given press (blog).

    I have a sneaky notion that it’s much easier than it looks and that I’m just a moron…

    Are you kidding me? I have better things to do with $150…

Viewing 8 replies - 1 through 8 (of 8 total)