hongpong
Forum Replies Created
-
Hello everyone, here is a code snippet you can throw in a functions.php file or a standalone plugin file (outside of a class). I had this in a namespace so I use a leading slash on WP_CLI. I am offering this under the GPL license and please feel free to roll into the plugin. (WP CLI is a command line interface for your server) https://wp-cli.org/
Offers commands like this so you can manually control these user states (and get back in your site again!) I wrote this because I didn’t want to fiddle around with update_user_meta commands. Actually have never written a WP_CLI command before! Woohoo.
It will also alert you and error out if the UID you attempt to set does not exist.
wp uv-set 5 0 // unverifies UID 5
wp uv-set 1 1 // verifies UID 1
wp uv-check 1 // tells you if UID1 is verified or unverified, and prints the verification key.if ( defined( 'WP_CLI' ) && \WP_CLI ) {
/**
* Check user-verification state in WP CLI (enter UID)
*/
$check_verification = static function ( $args ): void {
if (!isset ($args) || count($args) === 0) {
\WP_CLI::error( "No user specified.", $exit = true );
}
$user_id = $args[0];
$user_activation_status = get_user_meta($user_id, 'user_activation_status', true);
//$user_activation_status = empty($user_activation_status) ? 0 : $user_activation_status;
$uv_status = $user_activation_status === 1 ? __('Verified', 'user-verification') : __('Unverified', 'user-verification');
$activation_key = get_user_meta($user_id, 'user_activation_key', true);
if ($user_activation_status === '1') {
\WP_CLI::log( 'Verified' );
}
if ($user_activation_status === '0') {
\WP_CLI::log( 'Unverified');
}
if ($user_activation_status === '') {
\WP_CLI::log( 'Old User' );
}
\WP_CLI::log( 'Activation key: ' . $activation_key );
//\WP_CLI::success($args[0]);
};
\WP_CLI::add_command( 'uv-check', $check_verification );
/**
* Manual verify: UID + 0/1 . Set to Verified (0) or unverified (1)
*/
$set_verification = static function ( $args ) {
if (!isset ($args) || count($args) === 0) {
\WP_CLI::error( "No user specified.", $exit = true );
}
if ( count($args) === 1 || count($args) >= 3) {
\WP_CLI::error( "Wrong number of arguments.", $exit = true );
}
$user_id = $args[0];
$new_status = $args[1];
$user = get_userdata( $user_id );
if ( $user === false ) {
\WP_CLI::error( "User not found. (UID: " . $user_id . ")", $exit = true );
}
try {
update_user_meta($user_id, 'user_activation_status', $new_status);
\WP_CLI::success('User (UID '. $user_id .') changed: ' . $new_status);
} catch ( \Exception $e ) {
\WP_CLI::error( $e->getMessage(), $exit = true );
}
};
\WP_CLI::add_command( 'uv-set', $set_verification );
}- This reply was modified 2 months, 1 week ago by hongpong.
Forum: Plugins
In reply to: [Timeline Express] Critical error on page with timelineThere are known issues going on with php8.0 + it has not been updated
https://www.ads-software.com/support/topic/php-8-0-conflict-3/
Forum: Plugins
In reply to: [Timeline Express] PHP 8.0 Conflict@eherman24 sorry to bug you but timeline express keeps throwing notices intensively (due to cmb2) and i saw you were listed as a dev.. i tried emailing the codeparrots and their form is busted. best regards
Would be ideal to combine with the ACF Oembed rendering of Youtube iframes as well – due to similar performance issues been dealing w similar ideas.
Forum: Plugins
In reply to: [Timeline Express] PHP 8.0 Conflictbackground – cmb2 is a separate library inside this plugin that should be updated by the timeline express devs
https://github.com/CMB2/CMB2/blob/develop/includes/rest-api/CMB2_REST.php
simply use this function to check if the extension is missing before running this https://www.php.net/manual/en/function.extension-loaded.php
this is still the issue. if PHP extensions should be present this can be checked for.
Fatal error: Uncaught Error: ftp_nlist(): Argument #1 ($ftp) must be of type resource, null given
in /var/www/html/wp-admin/includes/class-wp-filesystem-ftpext.php on line 438v3.0.3 is still causing fatal errors from the upsell function . i really recommend pulling this function or at least catching the exception because it halts the whole site. can check if the input of ftp_nlist() is a null or a resource.
Fatal error: Uncaught Error: ftp_nlist(): Argument #1 ($ftp) must be of type resource, null given
in /var/www/html/wp-admin/includes/class-wp-filesystem-ftpext.php on line 438ftp_nlist() wp-admin/includes/class-wp-filesystem-ftpext.php:438 WP_Filesystem_FTPext::exists() wp-content/plugins/ultimate-blocks/includes/pro_manager/base/Pro_Extension_Upsell.php:144 Ultimate_Blocks\i\p\b\Pro_Extension_Upsell::generate_upsell_data() call_user_func_array() wp-content/plugins/ultimate-blocks/includes/pro_manager/base/Pro_Extension_Upsell.php:82 Ultimate_Blocks\i\p\b\Pro_Extension_Upsell::get_upsell_data() wp-content/plugins/ultimate-blocks/includes/pro_manager/Pro_Manager.php:232 Ultimate_Blocks\i\p\Pro_Manager::prepare_priority_upsell_data() wp-content/plugins/ultimate-blocks/includes/pro_manager/Pro_Manager.php:60 Ultimate_Blocks\i\p\Pro_Manager::init_process() wp-content/plugins/ultimate-blocks/includes/common/traits/Manager_Base_Trait.php:53 Ultimate_Blocks\i\p\Pro_Manager::init() wp-content/plugins/ultimate-blocks/includes/class-ultimate-blocks.php:180 Ultimate_Blocks::define_admin_hooks() wp-content/plugins/ultimate-blocks/includes/class-ultimate-blocks.php:64 Ultimate_Blocks::__construct() wp-content/plugins/ultimate-blocks/ultimate-blocks.php:127 run_ultimate_blocks() wp-includes/class-wp-hook.php:310 WP_Hook::apply_filters() wp-includes/class-wp-hook.php:334 WP_Hook::do_action() wp-includes/plugin.php:517 do_action() wp-settings.php:495 require_once() wp-config.php:94 require_once() wp-load.php:50 require_once() wp-admin/admin.php:34 require_once() wp-admin/plugins.php:10
Forum: Plugins
In reply to: [Ultimate Blocks - WordPress Blocks Plugin] upsell function ftp errorThanks, if there are file write locations then a check for writeability would probably cover the issue.
Forum: Plugins
In reply to: [PDF Embedder] max-width breaks many elementsset the following
wp_dequeue_style('pdfemb_embed_pdf_css'); wp_deregister_style('pdfemb_embed_pdf_css');
using the unusual hook wp_print_footer_scripts
add_action( 'wp_print_footer_scripts', 'your_function_name', 0 ); // this has to be ZERO
this worked for me. may need wp_enqueue_scripts, wp_footer or wp_head actions as well.
Regarding the function named here
by @ericreynolds007 . If you want to move it to a plugin it needs to run somewhere like the ‘plugins_loaded’ hook. Otherwise Yoast is not loaded and WPSEO_VERSION will not be available. So put in a function like:
add_action('plugins_loaded', 'override_yoast_behavior');
This seems to have resolved my issues for now, while keeping other funny alterations out of the theme.
However please let us know what is supposed to replace Tribe__Events__Template__Month since that is deprecated. Not finding the right info to update it in custom code!
- This reply was modified 2 years, 3 months ago by hongpong.
Forum: Plugins
In reply to: [Cloudflare] PHP intl extension required or media library deletions failthis is like marginally related
https://www.ads-software.com/support/topic/php-8-0-gives-error/
Forum: Plugins
In reply to: [Kint Debugger] Offer to maintain kint debuggerI tried with no luck. I am going to email the [email protected] and see if I get anywhere – i will mention that you are also interested.
Forum: Plugins
In reply to: [Kint Debugger] Offer to maintain kint debuggerHi Sascha, I have not been able to get any response. I think I will pursue getting the plugin since it is actively useful when I do WP work – however the last time I spent significant effort on trying to look after an abandoned plugin and they decided to give it to people that were not going by the process.
If I can get ahold of it I would be happy to share the plugin with you.
I have more than enough PHP experience but the details of how plugins are administered in this ecosystem I have less experience with. This will entail writing the patch and sending it in, which I can probably do by Monday.
it appears another update dropped btw , will probably give it a try in a few days