{"id":21340269,"url":"https://github.com/mnestorov/wp-multisite-cookie-manager","last_synced_at":"2026-05-21T04:07:07.042Z","repository":{"id":199252492,"uuid":"702464105","full_name":"mnestorov/wp-multisite-cookie-manager","owner":"mnestorov","description":"Manage cookies across a WordPress multisite network.","archived":false,"fork":false,"pushed_at":"2023-11-30T14:08:19.000Z","size":197,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T02:47:57.730Z","etag":null,"topics":["wordpress","wordpress-cookie","wordpress-multisite","wordpress-plugin","wp","wp-admin","wp-multisite","wp-plugin"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mnestorov.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-10-09T11:16:35.000Z","updated_at":"2025-01-09T22:22:06.000Z","dependencies_parsed_at":"2023-10-12T16:44:46.851Z","dependency_job_id":null,"html_url":"https://github.com/mnestorov/wp-multisite-cookie-manager","commit_stats":null,"previous_names":["mnestorov/custom-multisite-cookie-manager","mnestorov/wp-multisite-cookie-manager","mnestorov/wp-custom-multisite-cookie-manager"],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/mnestorov/wp-multisite-cookie-manager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnestorov%2Fwp-multisite-cookie-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnestorov%2Fwp-multisite-cookie-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnestorov%2Fwp-multisite-cookie-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnestorov%2Fwp-multisite-cookie-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mnestorov","download_url":"https://codeload.github.com/mnestorov/wp-multisite-cookie-manager/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnestorov%2Fwp-multisite-cookie-manager/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33288197,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-21T02:57:32.698Z","status":"ssl_error","status_checked_at":"2026-05-21T02:57:31.990Z","response_time":62,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["wordpress","wordpress-cookie","wordpress-multisite","wordpress-plugin","wp","wp-admin","wp-multisite","wp-plugin"],"created_at":"2024-11-22T00:49:54.611Z","updated_at":"2026-05-21T04:07:07.016Z","avatar_url":"https://github.com/mnestorov.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003ca href=\"https://wordpress.org\" target=\"_blank\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/github/explore/80688e429a7d4ef2fca1e82350fe8e3517d3494d/topics/wordpress/wordpress.png\" width=\"100\" alt=\"WordPress Logo\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n# WordPress - Multisite Cookie Manager\n\n[![Licence](https://img.shields.io/badge/LICENSE-GPL2.0+-blue)](./LICENSE)\n\n## Overview\n\n**_Manage cookies across a WordPress multisite network with the Multisite Cookie Manager plugin._**\n\nThis plugin allows network administrators and site admins to manage cookie expiration settings, and identify all cookies being set across the multisite network. It provides a settings page within each site's admin area where you can specify cookie expiration times based on user roles and manage geo-location data as well as user sessions. A unique cookie will be set for each site in the network based on the specified settings.\n\n## Features\n\n- Unique cookie generation per site, named based on the site name and blog ID.\n- Customizable cookie expiration times based on user roles and login status.\n- Geo-location data collection and user session tracking.\n- Logging and error handling for debugging.\n- Export and import of cookie settings via JSON.\n- Site admin settings page for managing cookies.\n- Usage reporting for monitoring cookies across the network.\n\n## Installation\n\n1. Download the plugin files to your computer.\n2. Using an FTP program, or your hosting control panel, upload the unzipped plugin folder to the `/wp-content/plugins/` directory of your WordPress multisite installation.\n3. Navigate to the Plugins page within your WordPress dashboard on the site where you want to manage cookies.\n4. Locate **MN - WordPress Multisite Cookie Manager** in the list of available plugins and click \"Activate\".\n5. Once activated, a new menu item \"Cookie Settings\" will appear in the admin dashboard of the site where you activated the plugin. Now you can manage cookie settings and view cookie usage reports from this menu.\n\n## Usage\n\n### Setting Cookie Expiration Times\n\n1. After activating the plugin, navigate to the **Network Admin -\u003e Settings** page.\n2. Click on **Cookie Settings** in the menu.\n3. On the **Cookie Settings** page, you'll find a form to manage cookie expirations:\n4. Under **Cookie Expirations**, text area, input a JSON object with user roles and corresponding expiration times in seconds.\n\n**Example:**\n\n   ```json\n   {\n      \"administrator\": 86400,\n      \"editor\": 43200,\n      \"author\": 21600,\n      \"contributor\": 10800,\n      \"subscriber\": 5400,\n      \"logged_out\": 1800\n   }\n   ```\n\n5. Click **Save Settings** to save your changes.\n6. The plugin will automatically set cookies with the specified expiration times for each site in your network.\n\n### Exporting and Importing Settings\n\n- **Export:** Click on \"Export Settings\" to download a JSON file containing the current cookie expiration settings.\n- **Import:** Choose a JSON file by clicking \"Choose File\" under \"Import Settings\", then click \"Import Settings\" to apply the settings from the file.\n\n### Viewing Cookie Usage Reports\n\n- Navigate to the \"Cookie Usage Reports\" submenu under \"Cookie Settings\".\n- View the table showing the usage of each cookie across the network.\n\n### Clear the Cookies from DB\n\n- When you visit \"Cookie Usage Reports\" admin page, you'll see a \"Clear Cookies\" button above the table. Pressing this button will clear the cookies with the unique cookie name from the database.\n\n## Functions\n\n### mn_get_unique_cookie_name()\n\nGenerates a unique cookie name based on the site name and blog ID.\n\n### mn_log_error($message, $error_type = E_USER_NOTICE)\n\nHandles error logging based on the `WP_DEBUG` settings in the WordPress configuration.\n\n### mn_register_cookie_settings_page()\n\nRegisters a new menu page in the network admin for managing cookie settings.\n\n### mn_cookie_settings_page()\n\nDisplays the cookie settings page, handles form submission for updating settings, and exporting/importing settings.\n\n### mn_get_cookie_expiration($default_expiration)\n\nDetermines the expiration time for a cookie based on the user's role.\n\n### mn_set_custom_cookie()\n\nSets a custom cookie on page load with a name generated by `mn_get_unique_cookie_name()` and expiration determined by `mn_get_cookie_expiration()`.\n\n### mn_create_cookie_usage_table()\n\nCreates a new database table for logging cookie usage on plugin activation.\n\n### mn_log_cookie_usage()\n\nLogs cookie usage on page load.\n\n### mn_write_cookie_usage_log_entries()\n\nWrites log entries from transient to database hourly.\n\n### mn_register_cookie_reporting_page()\n\nRegisters a submenu page for cookie usage reports.\n\n### mn_cookie_reporting_page()\n\nDisplays cookie usage reports.\n\n### mn_export_cookie_settings()\n\nExports cookie settings to a JSON file.\n\n### mn_import_cookie_settings($json_settings)\n\nImports cookie settings from a JSON file.\n\n### mn_get_geolocation_data()\n\nFetches the user's geo-location data using an external [API](https://app.ipgeolocation.io/).\n\n### mn_clear_cookies()\n\nFunction to clear the cookies with the unique cookie name from the database.\n\n### mn_handle_clear_cookies_request()\n\nThis function is triggered by the `admin_init` action. This function checks the nonce for security, calls `mn_clear_cookies()` to clear the cookies from the database, and displays a success message.\n\n### mn_custom_plugin_styles()\n\nThe function is designed to inject custom CSS styling into the admin pages of your WordPress site without the need for an external stylesheet file. This is achieved by hooking the function into the `admin_head` action, which triggers the function to output a `\u003cstyle\u003e` block within the `\u003chead\u003e` section of WordPress admin pages.\n\n## Error Handling and Debugging\n\nEnable `WP_DEBUG` in your WordPress configuration to catch errors during development. In your `wp-config.php` file:\n\n```php\ndefine( 'WP_DEBUG', true );\ndefine( 'WP_DEBUG_LOG', true );\ndefine( 'WP_DEBUG_DISPLAY', false );\n```\n\n## Uninstallation\n\nUpon uninstallation, the plugin will remove the `multisite_cookie_usage` table from the database.\n\n## FAQs\n\n### How do I set custom cookie expiration times?\n\nNavigate to the **Settings-\u003eCookie Settings** page on any site within your network. In the provided text area, input a JSON object specifying the expiration times for different user roles and for logged-out users. Click \"Save Settings\" to save your changes.\n\n### How are cookies named?\n\nCookies are named following this pattern: `__site_name_blog_id`, where `site_name` is the name of the site with all spaces removed and converted to lowercase, and `blog_id` is the ID of the site within the network.\n\n**Example:** For a site named \"My Site\" with a blog ID of 2, the cookie would be named `__mysite_2`.\n\n### How can I view all cookies being set across the network?\n\nNavigate to the **Settings-\u003eCookie Settings-\u003eCookie Usage Reports** on any site within your network to view a list of all unique cookies being set across the network along with the number of sites on which each cookie has been found.\n\n### How can I export or import cookie settings?\n\nOn the **Settings-\u003eCookie Settings** page, you'll find options to export your current cookie settings to a JSON file, or import settings from a JSON file. This allows for easy transfer of settings between different sites or for backup purposes.\n\n### How can I style the settings and reports pages?\n\nThe plugin includes a function `mn_custom_plugin_styles()` that injects custom CSS into the admin pages. You can modify the CSS rules within this function to change the appearance of the plugin's settings and reports pages according to your preferences.\n\n## Changelog\n\nFor a detailed list of changes and updates made to this project, please refer to our [Changelog](./CHANGELOG.md).\n\n---\n\n## License\n\nThis project is released under the [GPL-2.0+ License](http://www.gnu.org/licenses/gpl-2.0.txt).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnestorov%2Fwp-multisite-cookie-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmnestorov%2Fwp-multisite-cookie-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnestorov%2Fwp-multisite-cookie-manager/lists"}