I'm quite newbie in PHP and plugin development, and I think I'm missing something obvious but I dont know how to do it. When I activate my plugin (it adds some menu items), everything it's ok except I have to refresh the page to see those items, I that that items appers automatically when the plugin is activated. I have this to run on activation hook (do I have to add something inside that hook): Thanks //////// Run on activation …
I'm learning plugin development and I came across this issue where I need to activate my custom plugin and from my research on this topic there are three possible scenarios: Network admin activates the plugin for the whole network Network admin or site admin activate the plugin for a specific site Regular single site installation activation flow When I activate the plugin as a network admin the plugin is activated only for the site with $blog_id = 1. other sites …
How do I implement user account activation in WordPress? (This is not for multisite.) Once the user registers through the site or admin panel, the user should get an email with an activation link. Once the link is opened the account should be activated and should be redirected to the login page. Also need to check the account is activated or not in login.
I have an activation hook to create 2 new database tables that don't exist, only the second table is created from this code: public function add_tables() { // Global $wpdb global $wpdb; $wpdb->hide_errors(); // Require upgrade require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); // Set charset $collate = ''; if ( $wpdb->has_cap( 'collation' ) ) { $collate = $wpdb->get_charset_collate(); } // SQL query $sql = " CREATE TABLE IF NOT EXISTS " . $wpdb->prefix . "test1 ( test_id bigint(20) NOT NULL AUTO_INCREMENT, …
I searched the whole net and stackexchange for a reason and a solution, but couldn't find any. There are many questions (and answers) related to own plugins and the code how to create tables on activation. But this applies not here, because I have this problem with well known and maintained plugins from the wordpress plugin repository. So, the situation: A kvm guest with around 20 docker stacks. Each stack consists of a nginx, a php:8-fpm and a mariadb container. …
Installed TinyMCE, but still getting this toolbar : https://ps.w.org/tinymce-advanced/assets/screenshot-1.jpg?rev=2390186 instead of this : https://ps.w.org/tinymce-advanced/assets/screenshot-4.jpg?rev=2390186 what can i do ?
I've written a simple Wordpress plugin to create a new database table. The new table ought to be created when the plugin is activated. When I try to activate the plugin, I get the following error: The plugin generated 3989 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin. emphasized text This is obviously a result of the fact the $wbdb is not …
So I am planning a theme that will depend on a plugin (for instance Timber or Themosis). So of course a theme will break if it can't use it's depending plugin's. So I would like a way to stop the user of activating a theme that needs a certain plugin to work and instead show an friendly error message containing the plugin that's needed. So far I found out how to check if a plugin is installed or not (link), …
This is the main plugin file. It activates but nothing happens. The menu is not created. /* * Activate plugin * create admin menu * create more stuff */ register_activation_hook(__FILE__, 'markmast_activate'); function markmast_activate() { add_action('admin_menu', 'markmast_create_admin_menu'); function markmast_create_admin_menu() { add_menu_page( 'Marketing Master', 'Marketing Master Settings', 'manage_options', 'custom'); } }
I have problems that my checkIfTablesExists() function is never called, even though I add some fake table name to the list of table names. The reason I want to make this function is to check if the table still after update for example. It should also make sure that the unknown php sever allows for table creation in the database. plugin.php function activate_myplugin() { require_once PLUGIN_PATH. 'classes/class-plugin-activator.php'; Plugin_Activator::activate(); Plugin_Activator::checkIfTablesExists(); } register_activation_hook(__FILE__, 'activate_myplugin'); plugin-activator.php <?php class Plugin_Activator { protected static $_instance …
sorry for my bad English. I want to create multiple pages when activating a plugin. This also works, but how do I get different content in the different pages? if (!current_user_can('activate_plugins')) return; $page_titles = array( 'Login', 'Dashboard' ); foreach($page_titles as $page_title) { $page = get_page_by_title( $page_title ); if( ! isset ( $page ) ) { // create post object $my_post = array( 'post_title' => $page_title, 'post_content' => '[shortcode]', 'post_status' => 'publish', 'post_author' => get_current_user_id(), 'post_type' => 'page', ); // insert …
I have received a Sucuri alert for an unauthorized plugin activation: Event: Plugin Activated Website: http://www.XXXXXX.XXX IP Address: XXX.XXX.XXX.XXX Reverse IP: XXXXXX.XXXXXX.XXXX Date/Time: 7 January 2021 5:00 PM Message: Plugin activated: Wp Zzz How can I stop this happening? Compared to a legitimate activation: Here there is no admin username specified (I guess nobody has logged in from the admin interface) The source IP address is not my home or office (this IP address keeps changing every time I get …
Class cannot be found, but the declaration is correct. Here is my code: Info-Wheel.php if ( file_exists( dirname( __FILE__ ) . "/vendor/autoload.php" ) ) { require_once dirname( __FILE__ ) . "/vendor/autoload.php"; } use Blocks\Base\Activation; use Blocks\Base\Deactivation; /** * The code that runs during plugin activation */ function iw_activate_plugin() { >> Activation::activate(); } /** * The code that runs during plugin deactivation */ function iw_deactivate_plugin() { Deactivation::deactivate(); } /** * Register Hooks for deactivation and activation */ register_activation_hook( __FILE__, "iw_activate_plugin" ); …
A client signed up for a new site in my multisite network. But, didn't finished the activation because they never received the email to verify and register. As the network administrator, I don't see a new (pending) site under Sites. I also don't see a new (pending) user under users. If I go back to the wp-signup.php page for multisites, I get the following error, "That username is currently reserved but may be available in a couple of days." Somewhere, …
I have created a plugin that register a new CPT but it doesnt work because i have to flush_rewrite_rules() (i can do this by going into the permalink setting page and save, but its not the right way) I have read inside the wordpress codex that i have to flush_rewrite_rules() on activation, but its not working cuz flush_rewrite_rules() runs before i register the CPT, to work it must run after... I am using this https://github.com/DevinVinson/WordPress-Plugin-Boilerplate And it has a class …
The idea is to get rid of mandatory new account activation through email As is: register new user -> exit without following to email verification link -> try to log in -> Site says something like: "Your account has to be activated before you can login. You can resend email with verification link by clicking here." Desired to be: register new user -> exit without following to email verification link -> try to log in -> Site let you in. …
I changed my admin email in the WordPress dashboard I'm using to create a website and it's just not sending out the email to confirm changes. The domain is hosted through BlueHost and the domain email I'm trying to use is at a Gsuite account. I'm trying to set up plugins and they are asking for my email so before I set up too many features I want to get my email updated. I keep seeing: "If you change this, …
On multisite, setting the WP_INSTALLING constant on wp-activate.php file disables all plugins prematurely. Why didn't the core create a way to bypass this. Though this may be required for activating new sites, but by default when activating a new user, the WP_INSTALLING constants should be disabled.
If a user has a version of my plugin installed and activated, let's say version 1.1 And I send the user version 1.2 and he tries to upload and activate the new version, what will happen is that they will get an error: "Failed to redeclare activate_function()" I'm struggling to see how I can prevent this. If I use class_exists or function_exists to check, that's still not working, the newer version will run first, and then the older version will …