Why does calling current_user_can() crash WP 2.9.2?
-
I don’t think I’m doing anything wrong, but I came up to this tonight:
0) Did a clean install of WordPress 2.9.2
1) Started writing a new plugin
2) Put this single line of code in it:
var_dump(current_user_can('edit_post'));
3) WordPress 2.9.2 (admin and front end) crashed with the following error:
Fatal error: Call to undefined function wp_get_current_user() in /Users/trevor/Sites/playground/clean/wp-includes/capabilities.php on line 969WARNING: If you try this, be sure you have root privileges to rm -r this plugin:
In a
wp-content/plugins/asdf
, place a file calledasdf.php
with this in it:<?php
/*
Plugin Name: Asdf
Plugin URI: https://asdf.com/
Description: Asdf asdf asdf
Version: 1
Author: Top Quark Productions
*/var_dump(current_user_can(‘edit_post’));
?>Activating the plugin gives me the above error message (front-end and wp-admin):
Ummm…
What? How else would I find out if I can put something for the author on the front-end?
(Note: the header text is copied direct from Akismet, with the names changed to protect the mighty)
Thanks
Trevor
Top Quark Productions
=====================
My first published plugin went live at 0.5.0 recently.
———————
topCollage arranges photos from the gallery in css-based collages.
Lots of shortcode options and I’d like to add the ability to jQuery manipulation of those options on the front end. Thus, the call to current_user_can() that’s stumping me right now.
- The topic ‘Why does calling current_user_can() crash WP 2.9.2?’ is closed to new replies.