Custom Dashboard Widget on each site using multisite

Can I use this plugin to create custom widgets on a per site basis?

I want widgets with unique instructions specific to each site on a multisite installation.

  • Patrick
    • Support Monkey

    Hi there @greg

    Welcome to the forums, glad to have you aboard!

    No, unfortunately, this plugin is not coded to enable different messages per site in your network. It must be network-activated, and displays the same widget content on all sites.

    There is a rather cool alternative however: create a custom dashboard Welcome screens for each site by adapting the code found here for each:

    http://www.wpexplorer.com/custom-wordpress-welcome-message/

    Or you could create a single plugin with that code to network-activate containing conditionals to detect the blog ID, and display different content depending on the ID, like so:

    global $blog_id;

    if ($blog_id == 2) {
    some stuff here;
    }

    elseif ($blog_id == 3) {
    other stuff here;
    }

    else {
    default stuff here;
    }

    I hope this helps! And thanks for being a member :slight_smile:

  • Greg
    • Flash Drive

    HI @patrick,

    Thanks, glad to be here!

    The custom Welcome Message plugin seems like a great idea.

    I created the plugin and activated, but am not sure how to edit the plugin on a per site basis on multisite.

    How do edit separately code for each site?

    Thanks,

    Greg

  • Patrick
    • Support Monkey

    Hi again @greg

    How do edit separately code for each site?

    You just need to wrap the per blog content in the conditional like the example I posted above.

    But I realize that may not be so simple if you’ve never done it before. :slight_smile:

    So I’ve packaged up the code into a nice little plugin that you can customize. Download the attached zip and extract the single file inside.

    Then open it up in your favorite text editor (mine is Notepad++: http://notepad-plus-plus.org/ ).

    Scroll down to the bottom where you’ll see the code you can customize starting at line 58.

    I’ve left the standard stuff at the top in there (Next Steps & More Actions). So all you need to do is add in your custom stuff starting where you see:

    if ($blog_id == 1)

    Remember to change the IDs in there to the IDs of the sites you want to target on your network.

    Once you’ve customized the content to your liking, you can simply upload that file (don’t even have to zip it up again) to your wp-content/mu-plugins folder. If mu-plugins doesn’t yet exist, simply create it in your FTP client or File Manager at your cPanel.

    Anything in mu-plugins (which means Must-Use-plugins) will be automatically activated on every site in your network. So that’s a very handy place to put stuff that really needs no tweaking after installation. :slight_smile:

    I hope this helps! And thanks for being a member :slight_smile:

  • Greg
    • Flash Drive

    Hey @patrick,

    Wow, thanks! That is really above and beyond!

    I created the folder, uploaded file and edited for a few sites. Seems like this will work well.

    I am using the WPMU Branding plugin and it is now hiding the Welcome Message. I do not see any option in Branding to show the Welcome Message. Is there a setting in Branding to show the Welcome Message?

    Thanks,

    Greg

  • Greg
    • Flash Drive

    Hey,

    This is working well so far, but the Welcome Message does not appear in my user’s account. It appears fine when I am in my admin account.

    When in the other user’s account ‘Welcome’ is not an item in the screen options menu.

    Any idea why ‘Welcome’ is not a Screen Option for my user?

    Thanks,

    Greg

  • Michael Bissett
    • Recruit

    Hey @greg,

    This is working well so far, but the Welcome Message does not appear in my user’s account. It appears fine when I am in my admin account.

    When in the other user’s account ‘Welcome’ is not an item in the screen options menu.

    What role is assigned to this user? If it’s the Subscriber role, then the Welcome widget isn’t going to show up for them, as subscribers can’t add/edit content,

    What content were you wanting to have the dashboard widget show to users with the “Subscriber” role?

    Please advise,

    Michael

  • Greg
    • Flash Drive

    Hey,

    I changed the user from Shop Manager to Administrator and the Welcome Message does show up.

    Is there any way around this? The user needs to have the role of Shop Manager to restrict them from accessing the inner workings of Woo Commerce and the customized WordPress menus I created to match that role.

    Any ideas?

    Best,

    Greg

  • Ash
    • WordPress Hacker

    Hi Greg

    I just talked to the plugin developer and he said it is not currently possible out of the box. As I have already flagged a SLS developer, let’s see if he can find any easy workaround for this.

    We appreciate your patience on this.

    Cheers

    Ash

  • Saurabh
    • New Recruit

    Hi @greg,

    There is a way we can work this out using the Custom Dashboard Widget plugin. In the settings, there is an option that says Execute content:. If you set this to yes, we can write php code inside the content that will be then shown to the visitors.

    It is not recommended generally since it uses the eval function of php and you shouldn’t use it unless you are sure of the code that you are writing. So, unless you are sure of the code, please get a developer on board to review the code. Although, like @patrick Cohen has suggested,

    global $blog_id;

    if (1 == $blog_id) {
    echo ('This appears on the main site only');
    } elseif (17 == $blog_id) {
    echo ('This appears on Demo Subsite #1 only');
    } elseif (20 == $blog_id) {
    echo ('This appears on Demo Subsite #2 only');
    } else {
    echo ('This appears on all other subsites.');
    }

    will work just fine.

    However, I’d strongly recommend getting your final code reviewed by a developer or better still get this custom coded from one. You may hire from a marketplace, like this one:

    https://premium.wpmudev.org/wordpress-development/

    or any other source.

    I hope this helps. Do let us know if you need more help with this.

    Best

    Saurabh

  • Predrag Dubajic
    • Support

    Hi TeamSnap,

    If you are referring to Custom Dashboard Widget plugin, it’s still available on wp.org but it hasn’t been updated for 7 years now so I would suggest finding a different solution for your needs.

    This ticket is also quite old on its own and if you need further assistance with finding a solution to your question please start new chat or ticket with more information of what you’re trying to accomplish.

    Best regards,

    Predrag

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.