WordPress.org

Ready to get started?Download WordPress

Forums

Zotpress
[resolved] WP_Debug Errors (12 posts)

  1. Driftless
    Member
    Posted 1 year ago #

    Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or init hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in ...wordpress/wp-includes/functions.php on line 2959 Notice: has_cap was called with an argument that is deprecated since version 2.0! Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in ...wordpress/wp-includes/functions.php on line 2923 Notice: has_cap was called with an argument that is deprecated since version 2.0! Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in ...wordpress/wp-includes/functions.php on line 2923

    http://wordpress.org/extend/plugins/zotpress/

  2. Katie
    Member
    Plugin Author

    Posted 1 year ago #

    Can you provide more information? e.g. What page was this on?

  3. Driftless
    Member
    Posted 1 year ago #

    Upon activation of plugin, and on every admin (and front-end) page at the top. Also in the admin menu above Zotpress: Notice: has_cap was called with an argument that is deprecated since version 2.0! Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in ...wordpress/wp-includes/functions.php on line 2923

    If you set wp-config argument define('WP_DEBUG', true); should light up like an x-mas tree.

    (Thanks for the awesome plugin BTW - exactly what I've been dreaming up in my head for a while...)

  4. mommaroodle
    Member
    Posted 1 year ago #

    I think this is a WP bug - I found the following function in wp-includes/capabilities.php

    function has_cap( $cap ) {
    		$capabilities = apply_filters( 'role_has_cap', $this->capabilities, $cap, $this->name );
    		if ( !empty( $capabilities[$cap] ) )
    			return $capabilities[$cap];
    		else
    			return false;
    	}
    
    }
    I wonder if that has_cap should not be role_has_cap - I did make the change and uploaded the file and still getting same error - hv done seaches on all plugins and my theme and the words has_cap doesnt appear in any except the wp-includes/capabilities.php of WP3.5.1

  5. mommaroodle
    Member
    Posted 1 year ago #

    also this on the same page - wp-includes/capabilities.php - from this code we can see where the error msg is being generated.

    /**
    	 * Whether user has capability or role name.
    	 *
    	 * This is useful for looking up whether the user has a specific role
    	 * assigned to the user. The second optional parameter can also be used to
    	 * check for capabilities against a specific object, such as a post or user.
    	 *
    	 * @since 2.0.0
    	 * @access public
    	 *
    	 * @param string|int $cap Capability or role name to search.
    	 * @return bool True, if user has capability; false, if user does not have capability.
    	 */
    	function has_cap( $cap ) {
    		if ( is_numeric( $cap ) ) {
    			_deprecated_argument( __FUNCTION__, '2.0', __('Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead.') );
    			$cap = $this->translate_level_to_cap( $cap );
    		}
    
    		$args = array_slice( func_get_args(), 1 );
    		$args = array_merge( array( $cap, $this->ID ), $args );
    		$caps = call_user_func_array( 'map_meta_cap', $args );
    
    		// Multisite super admin has all caps by definition, Unless specifically denied.
    		if ( is_multisite() && is_super_admin( $this->ID ) ) {
    			if ( in_array('do_not_allow', $caps) )
    				return false;
    			return true;
    		}
    
    		// Must have ALL requested caps
    		$capabilities = apply_filters( 'user_has_cap', $this->allcaps, $caps, $args );
    		$capabilities['exist'] = true; // Everyone is allowed to exist
    		foreach ( (array) $caps as $cap ) {
    			if ( empty( $capabilities[ $cap ] ) )
    				return false;
    		}
    
    		return true;
    	}
  6. Katie
    Member
    Plugin Author

    Posted 1 year ago #

    Strange, I DO have debug mode on, and I'm not receiving any of these messages.

    Zotpress uses "current_user_can" to prevent non-editors (and non-admins) from accessing the Zotpress pages.

    What is your account role? Could another plugin or theme be interfering?

  7. Katie
    Member
    Plugin Author

    Posted 1 year ago #

    Are these issues still occurring?

  8. Katie
    Member
    Plugin Author

    Posted 1 year ago #

    I'm going to close this thread due to inactivity -- please feel free to re-open if you're still encountering this issue.

  9. LEPblog
    Member
    Posted 11 months ago #

    I'm having this issue now. I don't know what happened to cause it to change between yesterday and today, but I'm now getting the wp_enqueue_script errors too.

  10. Katie
    Member
    Plugin Author

    Posted 11 months ago #

    I think this happens when your host turns on debugging features, including warnings. Is the script working or just throwing these messages? When I turn on debugging there's warnings, too.

  11. LEPblog
    Member
    Posted 11 months ago #

    You know what? I did turn on debugging. Thanks!

  12. Katie
    Member
    Plugin Author

    Posted 11 months ago #

    Great! Glad the issue is resolved.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags