English flagItalian flagKorean flagChinese (Simplified) flagChinese (Traditional) flagPortuguese flagGerman flagFrench flagSpanish flagJapanese flagArabic flagRussian flagGreek flagDutch flagBulgarian flagCzech flagCroatian flagDanish flagFinnish flagHindi flagPolish flagRomanian flagSwedish flagNorwegian flagCatalan flagFilipino flagHebrew flagIndonesian flagLatvian flagLithuanian flagSerbian flagSlovak flagSlovenian flagUkrainian flagVietnamese flagAlbanian flagEstonian flagGalician flagMaltese flagThai flagTurkish flagHungarian flagBelarus flagIrish flagIcelandic flagMacedonian flagMalay flagPersian flag

Posts Tagged ‘php code help’


WordPress 3 Compatible

I have seen several plugins that “hide” the dashboard from subscribers, but none that functions as I want.
I don’t want it to allow only the tools, and profile page. I want it to straight kick the user out of the dashboard!

So, I wrote my own plugin that does that. If anyone that is not an admin (cannot activate plugins) attempts to access the dashboard via url or link, they are redirected to the front of the site. sorry, access denied..

Here is my code. Just drop this in your themes functions.php file and edit the url of the redirect to whatever you want.

{code type=php}
//hook onto dashboard and redirect all non admin to front site
add_action(“admin_init”,”redirect_nonadmin_fromdash”);
function redirect_nonadmin_fromdash(){
if (!current_user_can(‘activate_plugins’)) {
// Edit Line Below For Your Own Redirect
header( ‘Location: http://www.erikshosting.com’ ) ;
}
}
{/code}