Private属性文章无法显示
2005-03-18 20:37
429 查看
Show private entries when logged in
http://wiki.cornbreadtree.org/index.php?title=How_do_I_set_up_Wordpress_on_cornbreadtree.org%3F#Show_private_entries_when_logged_inI have no idea why this bug hasn't been fixed in the Wordpress 1.5 codebase, but $user_ID never seems to be set properly when PHP goes to the database. Call
get_currentuserinfo()immediately before to ensure all the posts are retreived.
wp-includes/classes.php: get_currentuserinfo();[/b] // Get private posts if (isset($user_ID) && ('' != intval($user_ID))) $where .= " OR post_author = $user_ID AND post_status != 'draft' AND post_status != 'static')"; else $where .= ')';
Once all the posts are loaded (when the owner is logged in, of course), distinguish between private and published posts with the following hack:
wp-includes/template-functions-post.php: function get_the_title($id = 0) { global $post, $wpdb; if ( 0 != $id ) { $id_post = $wpdb->get_row("SELECT post_title, post_password FROM $wpdb->posts WHERE ID = $id"); $title = $id_post->post_title; if (!empty($id_post->post_password)) $title = sprintf(__('Protected: %s'), $title); } else { $title = $post->post_title; if (!empty($post->post_password)) $title = sprintf(__('Protected: %s'), $title); } if ($post->post_status == "private") { $title = sprintf(__('Private: %s'), $title); }[/b] return $title; }
相关文章推荐
- css中overflow:hidden的属性 可能会导致js下拉菜单无法显示
- JS设置IMAGE src属性无法显示图片解决
- php7下dedecms文章内容不能显示,dede织梦{dede:field.body /}标签无法解析
- CSS background属性在IE6下无法显示背景图片
- 首页文章分类 关于 Search private(私有)方法单元测试无法覆盖?那就用反射调用来测试private(私有)方法
- EF实体框架-从数据库更新模型 一部分表的外键(导航属性)无法显示
- 说明:关于部分文章的图片无法直接显示的说明
- 解决wordpress部分博客文章页面无法显示的问题
- 在VB6中,使用ADO对象模型时,ADO对象、属性、方法不“无法显示帮助”的问题?
- 织梦dedecms后台发布文章提示“标题不能为空”,编辑器内容无法显示中文
- 解决博易博客后台文章管理页面无法显示分页的问题
- U盘文件不显示U盘中毒隐藏属性无法修改的原理及解决
- dede5.7 GBK 在php5.4环境下 后台编辑器无法显示文章内容
- ecshop订单打印无法显示商品属性,前台商品属性
- 网页无法显示img标签alt属性给的提示文字!
- img src属性有中文时无法显示图片
- Silverlight中通过WCF方式传递数据 修改服务器端类的属性Silverlight中无法显示该属性
- Android Studio 模拟器无法显示的情况 这篇文章可以说是很好的解决了我的问题~
- 无法使用系统显示隐藏文件属性
- extjs中第一次访问有效,第二次访问出现部分组件无法显示的,动态改变组件的label值的方法,ExtJs中组件最好少使用ID属性(推荐更多使用Name属性)