EmilySmith
Forum Replies Created
-
Forum: Networking WordPress
In reply to: Contact Child Site AdminsAnd by took a stab … I mean I had a “conversation” with ChatGPT about this! I’m leery to try it out, unless you think it looks solid.
Forum: Networking WordPress
In reply to: Contact Child Site AdminsThank you for your response. I took a wild stab at building a WordPress plugin that would: 1) get the subsites, then identify the administrators on each subsite, then tag each of those administrators with something (cs-admin), create a dashboard, populate the tagged users into a sortable table in the dashboard that you can download to CSV, and to undo any changes the plugin made if you uninstall it. Could you take a look at this for me? Here is the code:
<?php /* Plugin Name: Multisite User Tagging Description: A plugin to tag users in a WordPress multisite network Author: ChatGPT Version: 1.0.0 */ // Get all sites in the multisite network using wp_get_sites() function $siteList = wp_get_sites(); foreach($siteList as $site){ // Query for administrators of each site using get_users() function and add cs-admin user meta tag with add_user_meta() function foreach($siteList as $site){ $args = array('role' => 'administrator'); $admins = get_users($args); foreach($admins as $admin){ add_user_meta( $admin->ID, 'cs-admin', true ); } } // Create dashboard page and add it to the admin menu function mstagdashboard(){ ?> <div class="wrap"> <h2><?php _e('Tagged Users') ?></h2> < // Query for tagged users using get_users() function $args = array( 'meta_key' => 'cs-admin', 'meta_value' => true, ); $taggedUsers = get_users($args); ?> <table class="wp-list-table widefat fixed striped posts"> <thead> <tr> <th><?php _e('Name') ?></th> <th><?php _e('Email') ?></th> <th><? <?php // Create CSV file with tagged users if(isset($_POST['exportCSV'])){ $filename = 'tagged-users.csv'; $fp = fopen($filename, 'w'); $headerRowArray=array(); $headerRowArray[]='Name'; $headerRowArray[]='Email'; $headerRowArray[]='Site'; // Write header row to csv file fputcsv($fp,$headerRowArray); // Display tagged users in a table on dashboard page <table class="wp-list-table widefat fixed striped posts"> <thead> <tr> <th><?php _e('Name') ?></th> <th><?php _e('Email') ?></th> <th><?php _e('Site') ?></th> </tr> </thead> <tbody id="the-list"> // Loop through each user and write to csv file foreach($taggedUsers as $user){ $row=array(); $row[]=$user->first_name.' '.$user->last_name; $row[]=$user->user_email; $row[]=get_bloginfo('url'); fputcsv($fp,$row); } fclose($fp); // Download CSV file with tagged users header("Content-type: text/csv"); header("Cache-Control: no-store, no-cache"); // Create uninstall hook register_uninstall_hook(__FILE__, 'mstag_uninstall'); // Uninstall function function mstag_uninstall(){ delete_user_meta('cs-admin'); }I definitely gave up on S2member right away. A headache and sub-standard to our current member software. I instead paid a programmer to do what needed to be done, and I have no idea how they did it.
Forum: Plugins
In reply to: [Each domain a page] Multisite in the future?and I take it we cannot communicate through this platform about anything meaningful…or please advise?
Forum: Plugins
In reply to: [Each domain a page] Multisite in the future?@sterndata ok. What is the best way to communicate with people?
Forum: Plugins
In reply to: [Each domain a page] Multisite in the future?@rojokuze can you send me the code you are using to hack MailPoet3 to allow it to be used for multisite? This is really key for us, and now we can no longer use MailPoet2.
Thank you! That is exactly right.