pods-framework / pods

The Pods Framework is a Content Development Framework for WordPress - It lets you create and extend content types that can be used for any project. Add fields of various types we've built in, or add your own with custom inputs, you have total control.
https://pods.io/
GNU General Public License v2.0
1.07k stars 264 forks source link

Class PodsInit not found in 2.7.14 #5416

Closed vtad closed 5 years ago

vtad commented 5 years ago

Describe the bug

I used until 2.7.13 in functions.php remove_action( 'media_buttons', array( PodsInit::$admin, 'media_button' ), 12 ); which now throws a Typ E_ERROR since the class is not found

Pods Version

2.7.14

WordPress Environment

` ### wp-core ### version: 5.2.2 site_language: de_DE user_language: de_DE permalink: /%postname%/ https_status: true user_registration: 1 default_comment_status: closed multisite: false user_count: 398 dotorg_communication: true ### wp-paths-sizes ### wordpress_path: /home/www/wpvtad wordpress_size: 217,34 MB (227898467 bytes) uploads_path: /home/www/wpvtad/wp-content/uploads uploads_size: 22,36 GB (24010159333 bytes) themes_path: /home/www/wpvtad/wp-content/themes themes_size: 2,48 MB (2596508 bytes) plugins_path: /home/www/wpvtad/wp-content/plugins plugins_size: 65,57 MB (68758575 bytes) database_size: 60,77 MB (63717376 bytes) total_size: 22,70 GB (24373130259 bytes) ### wp-active-theme ### name: wpvtad17 version: 1.0 author: JPK author_website: http://vtad.de parent_theme: Twenty Seventeen theme_features: automatic-feed-links, title-tag, post-thumbnails, menus, html5, post-formats, custom-logo, customize-selective-refresh-widgets, editor-style, editor-styles, wp-block-styles, responsive-embeds, starter-content, custom-header, align-wide, widgets theme_path: /home/www/wpvtad/wp-content/themes/twentyseventeen ### wp-themes (2) ### Twenty Nineteen: version: 1.4, author: Das WordPress-Team Twenty Seventeen: version: 2.2, author: dem WordPress-Team ### wp-plugins-active (26) ### Advanced CF7 DB: version: 1.6.1, author: Vsourz Digital All In One WP Security: version: 4.3.9.4, author: Tips and Tricks HQ, Peter Petreski, Ruhul, Ivy Auto Prune Posts: version: 1.6.6, author: Ramon Fincken Classic Editor: version: 1.5, author: WordPress Contributors Contact Form 7: version: 5.1.3, author: Takayuki Miyoshi Events Manager: version: 5.9.5, author: Marcus Sykes File Manager Advanced: version: 2.8, author: modalweb File Manager Advanced Shortcode: version: 1.8, author: modalweb HD Quiz: version: 1.6.1, author: Harmonic Design MathJax-LaTeX: version: 1.3.11, author: Phillip Lord, Simon Cockell, Paul Schreiber Members: version: 2.1.0, author: Justin Tadlock Pods - Custom Content Types and Fields: version: 2.7.14, author: Pods Framework Team Post Views Counter: version: 1.3, author: dFactory Shortcodes Ultimate: version: 5.3.0, author: Vladimir Anokhin Simple History: version: 2.31.1, author: Pär Thernström Statify: version: 1.6.3, author: pluginkollektiv TinyMCE Advanced: version: 5.2.1, author: Andrew Ozz To Top: version: 1.8.1, author: Catch Plugins Tuxedo Big File Uploads: version: 1.2, author: Trevor Anderson User Menus: version: 1.1.3, author: Jungle Plugins User Switching: version: 1.5.1, author: John Blackbourn & contributors VTAD Adim Menu: version: 1.0, author: Kienitz VTAD Login: version: 1.1.0, author: Jörg Kienitz WordPress Importer: version: 0.6.4, author: wordpressdotorg WPeMatico: version: 2.3.5, author: etruel WP Rollback: version: 1.6, author: Impress.org ### wp-media ### image_editor: WP_Image_Editor_Imagick imagick_module_version: 1799 imagemagick_version: ImageMagick 7.0.7-11 Q16 x86_64 2017-11-20 http://www.imagemagick.org imagick_limits: imagick::RESOURCETYPE_AREA: 4 GB imagick::RESOURCETYPE_DISK: -1 imagick::RESOURCETYPE_FILE: 49152 imagick::RESOURCETYPE_MAP: 4 GB imagick::RESOURCETYPE_MEMORY: 2 GB imagick::RESOURCETYPE_THREAD: 1 gd_version: bundled (2.1.0 compatible) ghostscript_version: 9.26 ### wp-server ### server_architecture: Linux 3.16.0-8-amd64 x86_64 httpd_software: Apache php_version: 7.2.15 64bit php_sapi: apache2handler max_input_variables: 1000 time_limit: 180 memory_limit: 1024M max_input_time: -1 upload_max_size: 50M php_post_max_size: 50M curl_version: 7.38.0 OpenSSL/1.0.1t suhosin: false imagick_availability: true htaccess_extra_rules: true ### wp-database ### extension: mysqli server_version: 5.5.62-0+deb8u1 client_version: mysqlnd 5.0.12-dev - 20150407 - $Id: 3591daad22de08524295e1bd073aceeff11e6579 $ ### wp-constants ### WP_HOME: https://www.vtad.de WP_SITEURL: https://www.vtad.de WP_CONTENT_DIR: /home/www/wpvtad/wp-content WP_PLUGIN_DIR: /home/www/wpvtad/wp-content/plugins WP_MAX_MEMORY_LIMIT: 512M WP_DEBUG: false WP_DEBUG_DISPLAY: false WP_DEBUG_LOG: false SCRIPT_DEBUG: false WP_CACHE: false CONCATENATE_SCRIPTS: undefined COMPRESS_SCRIPTS: undefined COMPRESS_CSS: undefined WP_LOCAL_DEV: undefined ### wp-filesystem ### wordpress: writable wp-content: writable uploads: writable plugins: writable themes: writable ### pods ### pods-server-software: Apache pods-user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0 pods-session-save-path: /tmp pods-session-save-path-exists: Yes pods-session-save-path-writable: Yes pods-session-max-lifetime: 1440 pods-opcode-cache-apc: No pods-opcode-cache-memcached: No pods-opcode-cache-opcache: No pods-opcode-cache-redis: No pods-object-cache-apc: No pods-object-cache-apcu: No pods-object-cache-memcache: No pods-object-cache-memcached: No pods-object-cache-redis: No pods-memory-current-usage: 57,115M pods-memory-current-usage-real: 30,250M pods-network-wide: No pods-install-location: /home/www/wpvtad/wp-content/plugins/pods/ pods-developer: No pods-tableless-mode: No pods-light-mode: No pods-strict: No pods-allow-deprecated: Yes pods-api-cache: Yes

Possible Workaround I deleted the action from functions.php

issue-label-bot[bot] commented 5 years ago

Issue-Label Bot is automatically applying the label Type: Bug to this issue, with a confidence of 0.69. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

JoryHogeveen commented 5 years ago

Pods has helper functions for it's classes. In your case this should work (and be a better solution):

remove_action( 'media_buttons', array( pods_admin(), 'media_button' ), 12 );

Also, since this is related to admin I'd always wrap it inside with if ( is_admin() ).

vtad commented 5 years ago

I reactivated the action, and now it works fine - seemed to be a caching problem just after the update. I think this issue should be set as a warning, cause WP 5.22 deactivates the plugin when it gets the a fatal error after the update. @JoryHogeveen pods_admin() works also, since it is for all (edit) users I didn't wrap it with if(is_admin())

JoryHogeveen commented 5 years ago

@vtad Glad to year the issue is resolved.

One comment: is_admin() has nothing to do with users. It checks whether the current page is within the admin interface or not (wp_admin). In your case you want to remove the media buttons from Pods, which are only visible within the WordPress admin. That's why I recommended to wrap it in is_admin(). Documentation: https://codex.wordpress.org/Function_Reference/is_admin

Validation users can be done with current_user_can( $capability ) or is_super_admin().