WordPress.org

Ready to get started?Download WordPress

Forums

Programatically activate / deactivate different options for certain blogs (2 posts)

  1. jasiekjp
    Member
    Posted 2 years ago #

    hi there

    i am trying to alter the default WPMU registration process to match my requirements, and so far i managed to get the user registration / blog creation working. what i am now trying to do, is to write a set of simple functions to manage those sub-sites options programatically.

    i need to enable / disable certain themes for certain users. so i want to create a function that could look something like this:

    function enable_themes_for_user($theme_names = array(), $user_id){
    }

    and then call it like this:

    enable_themes_for_user(array('twentyten', 'twentyeleven'), 123);

    or the other way around - i could just disable certain themes for a specific user, ie. disable_themes_for_user(array('twentyten', 'premium_theme'), 123);

    in addition to this, i also want to restrict users from accessing some items in their dashboard. i am looking for ways to disable Posts, Links, Comments, Widgets, Users, entire Tools menu and everything in the Settings menu except for the General settings page.

    i want to be able to do this for specific users based on my liking, so, lets say Peter and John have a blog on my WPMU install and i want Peter to be able to have access to the Posts menu but i dont want John to be able to create any posts at all. now, i know that i can do this just by removing those items from the dashboard menu based on the logged in user ID, but i was wondering if there is any more efficient / secure way of doing this?

    ideally i would like to have a function that goes something like this:

    disable_for_client_sites($allowed_menu_items = array(), $user_id)

    and i would call it like that:

    disable_for_client_sites(array('settings', 'posts', 'tools', 'widgets'), 123);

    can you make any suggestions on whats the best way to achieve this?

    any help will be GREATLY appreciated.

  2. jasiekjp
    Member
    Posted 2 years ago #

    i forgot to mention that i want to activate / deactivate plugins for users in the same manner.

Topic Closed

This topic has been closed to new replies.

About this Topic