过去判断登录用户的角色我喜欢用current_user_can(),比如判断当前用户是否是作者用current_user_can(‘author’),记得WordPress官方文档中给的例子也是这样用,不过今天看了一下文档,貌似用法变了,传递角色作为参数不再可靠,正确的用法是传递$capability,那么该如何判断用户角色呢?
注:以下内容在WP 3.4+上测试通过
current_user_can()的正确用法
current_user_can()文档中有一句话要注意一下
Do not pass a role name to current_user_can(), as this i… Read More
Write in a terminal:
sudo apt-get update && sudo apt-get upgrade
or edit Update Manager settings (try this first if you have already configured Update Manager).
Launch Update Manager and try again.
Running update through a terminal gives option whether to allow or disallow untrusted packages.
WARNING: The following packages cann… Read More
Was installing Java today, this is an easy install thanks to “ppa:webupd8team/java”, but when I tried it was not working, but has worked for me all this while. Little goggling around found me a solution. Here is full conversation if you wanted to have a look http://ubuntuforums.org/showthread.php?t=2048793
Installing JAVA on Ubuntu is si… Read More
在讲数据库水平拆分时候,我列出了水平拆分数据库需要解决的两个难题,它们分别是主键的设计问题和单表查询的问题,主键问题前文已经做了比较详细的讲述了,但是第二个问题我没有讲述,今天我将会讲讲如何解决数据表被垂直拆分后的单表查询问题。
要解决数据表被水平拆分后的单表查询问题,我们首先要回到问题的源头,我们为什么需要将数据库的表进行水平拆分。下面我们来推导下我们最终下定决心做水平拆分表的演进过程,具体如下:
第一个演进过程:进行了读写分离的表在数据增长后需要进行水平拆分吗?回答这个疑问我们首先要想想进行读写分离操作的表真的是因为数据量大吗?答案其实是否定的。最基本的读写分离的… Read More