• Resolved krkjee

    (@krkjee)


    Hi,
    Is it possible to make a setup where, all users no matter there role can duplicate a post to the Main Site of my multisite installation and the Main Site only?

    Thank you in advance!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author MagicStick

    (@magicstick)

    That’s interesting! And can be easily done using our filters. Simply add this code to your functions.php file in your theme and change the $id_of_main_site to the id of the site in question:

    function mpd_filter_sites_to_one($args){
    
        $id_of_main_site = 2 // Change this to the id of your 'main' site;;
        
        $args['ID'] = $id_of_main_site;
        
        return $args;
        
    }
    add_action('mpd_get_sites_args','mpd_filter_sites_to_one');

    In order to allow

    all users no matter their role

    simply set Minimum user role allowed to use MPD to Subscriber in the plugin settings page. Have fun! And thanks for using this plugin! ??

    Plugin Author MagicStick

    (@magicstick)

    Sorry forgot to mention this will ONLY work if you are running WordPress 4.6.1.

    As uses WordPress new (awesome) get_sites class!

    Plugin Author MagicStick

    (@magicstick)

    Presuming this one is resolved as not heard anything in a few days. ??

    Thread Starter krkjee

    (@krkjee)

    Sorry for my late response. I just got the email-notification.
    I’ll take a look at it.

    Thank you so much!

    Thread Starter krkjee

    (@krkjee)

    I get the following:
    Parse error: syntax error, unexpected ‘$args’ (T_VARIABLE) in /wp-content/themes/themename/functions.php on line 211

    Line 211 is: $args[‘ID’] = $id_of_main_site;

    Plugin Author MagicStick

    (@magicstick)

    Make sure there is a semi colon at the end of the line:

    $id_of_main_site = 2;

    Thread Starter krkjee

    (@krkjee)

    Okay, it removed the error, but i can’t post. The main site isn’t showing.

    It is showing when I′m logged in as admin, not edit even though I have followed your guide through settings.

    • This reply was modified 8 years ago by krkjee.
    Plugin Author MagicStick

    (@magicstick)

    Sorry I don’t understand what you mean. Can you clarify further?

    Thread Starter krkjee

    (@krkjee)

    I’ll try ??
    The semi colon; fixed the error I got from line 211.

    The function I want is currently working, but only for Administrators even though I have change the settings as you have explained.

    Plugin Author MagicStick

    (@magicstick)

    I think there maybe other user capability issues at play if you set to subscriber. Try changing the minimum role to author or contributor or even editor.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Only duplicate to Main site’ is closed to new replies.