How to make sense of the active_plugins option_value to enable and disable certain plugins from the database?

That’s a serialized array. // Serialized: a:8:{i:0;s:21:”adrotate/adrotate.php”;i:1;s:19:”akismet/akismet.php”;i:2;s:33:”better-related/better-related.php”;i:3;s:17:”clicky/clicky.php”;i:4;s:49:”custom-post-permalinks/custom-post-permalinks.php”;i:5;s:32:”disqus-comment-system/disqus.php”;i:6;s:33:”export-to-text/export-to-text.php”;i:7;s:36:”google-sitemap-generator/sitemap.php”;} // dump: var_dump( maybe_unserialize(‘a:8:{i:0;s:21:”adrotate/adrotate.php”;i:1;s:19:”akismet/akismet.php”;i:2;s:33:”better-related/better-related.php”;i:3;s:17:”clicky/clicky.php”;i:4;s:49:”custom-post-permalinks/custom-post-permalinks.php”;i:5;s:32:”disqus-comment-system/disqus.php”;i:6;s:33:”export-to-text/export-to-text.php”;i:7;s:36:”google-sitemap-generator/sitemap.php”;}’) ); // Result array(8) { [0]=> string(21) “adrotate/adrotate.php” [1]=> string(19) “akismet/akismet.php” [2]=> string(33) “better-related/better-related.php” [3]=> string(17) “clicky/clicky.php” [4]=> string(49) “custom-post-permalinks/custom-post-permalinks.php” [5]=> string(32) “disqus-comment-system/disqus.php” [6]=> string(33) “export-to-text/export-to-text.php” [7]=> string(36) “google-sitemap-generator/sitemap.php” } Use maybe_unserialize() or unserialize() to transform it back to an array.

Shared table across network

Use $wpdb->base_prefix . ‘table_name’ as a table name when you want to create a table for the whole network, or when you want to run queries on it. $wpdb->base_prefix is always the prefix for the current network’s main table.

Is it possible to define two databases for one installation?

What you’re talking about is a database fallback. It’s possible to set something like this up, but not directly with WordPress. How it would work Instead of accessing the database directly, you’d access a proxy. This proxy would sit in front of both your primary and backup databases and pass traffic through. Essentially, it would … Read more

Can a post ID be 0?

No, post ID can not be 0 in the DB. But the value 0 has a special meaning in the code, indicating the currently handled post (if the context is set up correctly)

How to track user progress?

If you’re using ACF you can also attach custom fields to users. You can attach them by using the Location Rules (the ones in the ‘User’ subgroup), see Creating custom user profile pages with ACF You could add a single relational → post object field in a field group, Filter by Post Type → Lesson. … Read more

How to check if image is already stored in a site’s post database? (network)

Yes, a database query is possible with WordPress: function is_image_in_network( $image_name ) { global $wpdb; $image = “uploads/2012/01/{$image_name}”; $value=”%”.like_escape( $image ).’%’; $blog_id = get_current_blog_id(); $wpdb->set_blog_id( $blog_id ); $image = $wpdb->get_var( $wpdb->prepare( “SELECT ID FROM {$wpdb->posts} WHERE post_status=”publish” AND post_content LIKE ‘%s'” , $value ) ); return is_null( $image ) ? false : true; } You … Read more