内容的栏目 * @param int $category 0列表 1频道 2单页 3外链 * @return array */ function category_list($forumlist, $model = 0, $display = 0, $category = 0) { if (empty($forumlist)) return NULL; static $cache = array(); $key = $model . '-' . $display . '-' . $category; if (isset($cache[$key])) return $cache[$key]; if ($display) { foreach ($forumlist as $k => $val) { if (1 == $val['display'] && 1 == $val['type'] && $val['category'] == $category) { $cache[$key][$k] = $val; } } } else { foreach ($forumlist as $k => $val) { if (1 == $val['type'] && $val['category'] == $category) { $cache[$key][$k] = $val; } } } return empty($cache[$key]) ? NULL : $cache[$key]; } /** * @param $forumlist 所有版块列表 不分模型 * @param int $display 0全部CMS栏目 1在首页和频道显示内容的栏目 * @param int $category 0列表 1频道 2单页 3外链 * @return array */ function category_list_show($forumlist, $display = 0, $category = 0) { if (empty($forumlist)) return NULL; static $cache = array(); $key = $display . '-' . $category; if (isset($cache[$key])) return $cache[$key]; if ($display) { foreach ($forumlist as $k => $val) { if (1 == $val['display'] && 1 == $val['type'] && $val['category'] == $category) { $cache[$key][$k] = $val; } } } else { foreach ($forumlist as $k => $val) { if (1 == $val['type'] && $val['category'] == $category) { $cache[$key][$k] = $val; } } } return empty($cache[$key]) ? NULL : $cache[$key]; } /** * @param $forumlist 所有版块列表 * @return mixed BBS栏目数据(仅列表) 尚未开放bbs频道功能 */ function forum_list($forumlist) { if (empty($forumlist)) return array(); static $cache = array(); if (isset($cache['bbs_forum_list'])) return $cache['bbs_forum_list']; $cache['bbs_forum_list'] = array(); foreach ($forumlist as $_fid => $_forum) { if ($_forum['type']) continue; $cache['bbs_forum_list'][$_fid] = $_forum; } return $cache['bbs_forum_list']; } // 导航显示的版块 function nav_list($forumlist) { if (empty($forumlist)) return NULL; static $cache = array(); if (isset($cache['nav_list'])) return $cache['nav_list']; foreach ($forumlist as $fid => $forum) { if (0 == $forum['nav_display']) { unset($forumlist[$fid]); } } return $cache['nav_list'] = $forumlist; } ?>Admin user can't update WP
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Admin user can't update WP

programmeradmin0浏览0评论

I have a site running WP 3.3.2. The backend shows a bar saying "WordPress 3.5 is available! Please notify the site administrator."

Funny thing is that I'm logged in with an admin user, I double checked that. When trying to access the update page (at wp-admin/update-core.php) I get this error:

"You do not have sufficient permissions to access this page."

Any hints on what could be going on here? Thanks.

I have a site running WP 3.3.2. The backend shows a bar saying "WordPress 3.5 is available! Please notify the site administrator."

Funny thing is that I'm logged in with an admin user, I double checked that. When trying to access the update page (at wp-admin/update-core.php) I get this error:

"You do not have sufficient permissions to access this page."

Any hints on what could be going on here? Thanks.

Share Improve this question asked Jan 6, 2013 at 11:51 Max MinMax Min 3151 gold badge2 silver badges6 bronze badges 2
  • Fresh install? Did you have any plugin that could have modified your admin's capabilities? – RRikesh Commented Jan 6, 2013 at 12:05
  • I disabled all plugins, but that did not help. I did not make a fresh install yet because I have lots of contents I would have to move to the new install. Will try that if there's no other solution. – Max Min Commented Jan 6, 2013 at 12:15
Add a comment  | 

8 Answers 8

Reset to default 3

Try to make a new admin user in the db.

Follow these steps you should be able to create a new admin user, then update and then you can give your old user admin rights again. Or use the new user.

Your old user might have wrong setting in the DB

http://www.dnawebagency/how-to-add-an-admin-user-to-the-wordpress-database

I had this problem once.

You should check your wp-config.php file and if you find this line

define('DISALLOW_FILE_MODS',true);

change its value to false:

define('DISALLOW_FILE_MODS',false);

For anyone else with this problem, there is another line that you may have to find in your wp-config or functions file and change to false:

define('DISALLOW_FILE_EDIT', true);

WordPress was telling me I didn't have 'sufficient permissions' to update my own install even when logged in as the Administrator.
I had the following line in my wp-config.php file:
define('DISALLOW_FILE_MODS',true);
I was able to apply updates once again after I changed this line to:
define('DISALLOW_FILE_MODS',false);

Add the following code to a file in your wordpress root and go to that page.

<?php
define('WP_USE_THEMES', false);
require('wp-blog-header.php');

$role = get_role('administrator');

echo '<pre>';
print_r($role);
echo '</pre>';

Now, look for [update_core] in the text displayed. It's value should be 1.

If not, add the following line after the $role = get_role('administrator') line to add the update_core capability to the administrator.

$role->add_cap( 'update_core' ); 

Reload the page to see if the value of [update_core] is 1. If it is 1, you can try to do the update. Don't forget to delete the file you've added afterwards.

Method 2:

Get on PHPMyadmin and go to the wp_users table. Look for your user ID. Now go to wp_usermeta and change the wp_capabilities of your user ID to a:1:{s:13:"administrator";b:1;}. Do a backup before touching the database, just in case.

I encountered this issue once when updating a 3.9.19 installation.

I followed @RRikesh answer and everything seemed to be normal but still I can't run update.

It turns out a define('DISALLOW_FILE_MODS',true); was configured in functions.php.

So yeah, look for that line in your wp-config.php as well as functions.php.

Not sure if adding that line to functions.php is common practice since most answers here only suggest looking at wp-config.php

Often you have to deal with giving your wordpress installation the correct file and directory permissions. If you can log into your server via SSH it is no problem at all.

  1. Reset permission of all files to 664:

find /var/www/html/ -type f -exec chmod 664 {} \;

  1. Reset permission of directories to 775:

find /var/www/html/ -type d -exec chmod 775 {} \;

  1. Get user which is running Apache (User should be the first row/column):

ps aux | grep apache

  1. Retrieve the groups the user is part of:

groups [username]

  1. Reset the group to the group running Apache:

chgrp -R [group] /var/www/html/

Now you should be able to update Wordpress automatically from your backend.

This is a shot in the dark, but do you by chance have any mu-plugins that could be causing this? wp-content/mu-plugins

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论