Day: August 22, 2014

wordpress

get user meta

get user metaDescriptionRetrieve a single meta field or all fields of user_meta data for the given user. Uses get_metadata(). This function replaces the deprecated get_usermeta() function. Usage <?php get_user_meta($user_id, $key, $single);  ?> Parameters $user_id(integer) (required) The ID of the user whose data should be...

Non classé, wordpress

WordPress用户权限详解

自己也笔记一下,也方便其他wordpress的用户。WordPress的用户级别分别是administrator,editor,auth,contributor和subscriber,权限和代表的意思分别是:administrator:管理员帐号 : 和Admin一样, 拥有对整个后台的所有操作权限。Editor/ 编辑者帐号: 可以对博客内的所有文章, 页面, 留言进行编辑, 可以发表文章. Author/ 作者帐号: 可以发表文章, 但只能对自己文章的进行编辑。Contributor/ 贡献者帐号: 可以投递文章, 只能对自己的文章进行编辑. 和作者帐号不同的是, 作者是一个博客的一员, 而贡献者可能是一个热心网友注册的帐号, 偶尔投递一两篇文章或评论. 但这些文章要在管理员审核之后才会被发表出来。Subscriber/ 订阅用户帐号: 对后台只有浏览功能, 以及设置自己的个人信息。更详细的wordpress用户角色权限请看下图

wordpress

为 new_form 注册用户表单添加一个新FLIED

FUNCTION.PHP   function my_show_extra_profile_fields( $user ) { ?> <h3>Extra profile information</h3> <tableclass="form-table"> <tr> <th><labelfor="twitter">type client</label></th> <td> <selectname="typeclient"> <optionvalue="Producteurs">Producteurs</option> <optionvalue="Transporteurs">Transporteurs</option> <optionvalue="Acheteurs">Acheteurs</option> </select> <spanclass="description">Please enter client type.</span> </td> </tr> </table> <?php } add_action( 'user_register', 'my_save_extra_profile_fields' ); add_action( 'edit_user_profile_update', 'my_save_extra_profile_fields' ); function my_save_extra_profile_fields(...