dangerouspiper
Forum Replies Created
-
Forum: Plugins
In reply to: [Embed Privacy] Youtube’s direct link don’t workGreat! Thank you
Mikel
Forum: Plugins
In reply to: [Embed Privacy] Make settings pages only available for network adminFinally I wrote a small clumsy plugin that solves my problem, maybe it’s useful for somebody else. (I’m not a developer so use carefully).
The options stored in site 1 (defined in variable $mainsite) overwrites all other sites options. I could add a network setting page to manage the options or simply set the main site, but for me is enough in that way. Thank you @kittmedia for your help!
<?php
/* <WP Plugin Data>
* Plugin Name: Altuxa privacidá d'incrustaciones
* Version: 1.0
* Plugin URI:
* License: GNU/GPL3
* Description: Afita los axustes d'Embed Privacy a tolos sitios d'una rede
* Author: Mikel González
* Author URI: https://altuxa.net/
* Requires Plugins: embed-privacy
*/
defined( 'ABSPATH' ) || exit;
//Removes embed-privacy settings page link and add a link to manage the embeds
function altuxa_privacida_incrustaciones_removesettings() {
remove_submenu_page( 'options-general.php', 'embed_privacy' );
add_submenu_page( 'options-general.php', 'Remanar incrustaciones', 'Remanar incrustaciones', 'manage_options', 'edit.php?post_type=epi_embed' );
}
function altuxa_privacida_incrustaciones_run() {
//check if embed-privacy and embed-privacy-network are active for network
if ( (is_plugin_active_for_network( 'embed-privacy/embed-privacy.php' )) && (is_plugin_active_for_network( 'altuxa_privacida_incrustaciones.php' )) ) {
//take the options of the main site to default the others
//DEFINE MAIN SITE ID
$mainsite = 1;
//DEFINE MAIN SITE ID
//get current site id
$currentsite = get_current_blog_id();
//If current site is not main site
if($mainsite!=$currentsite) {
//get settings of current site
$currentsettings = array(
'js_detection' => get_option('embed_privacy_javascript_detection'),
'local_tweets' => get_option('embed_privacy_local_tweets'),
'disable_link' => get_option('embed_privacy_disable_link'),
'dw_thumbnails' => get_option('embed_privacy_download_thumbnails'),
'preserve_data' => get_option('embed_privacy_preserve_data_on_uninstall')
);
//switch to main site
switch_to_blog($mainsite);
//get settings of main site
$mainsettings = array(
'js_detection' => get_option('embed_privacy_javascript_detection'),
'local_tweets' => get_option('embed_privacy_local_tweets'),
'disable_link' => get_option('embed_privacy_disable_link'),
'dw_thumbnails' => get_option('embed_privacy_download_thumbnails'),
'preserve_data' => get_option('embed_privacy_preserve_data_on_uninstall')
);
restore_current_blog();
//if settings are not equals
if ($currentsettings!=$mainsettings){
if($currentsettings['js_detection']!=$mainsettings['js_detection']) {update_option('embed_privacy_javascript_detection', $mainsettings['js_detection']);}
if($currentsettings['local_tweets']!=$mainsettings['local_tweets']) {update_option('embed_privacy_local_tweets', $mainsettings['local_tweets']);}
if($currentsettings['disable_link']!=$mainsettings['disable_link']) {update_option('embed_privacy_disable_link', $mainsettings['disable_link']);}
if($currentsettings['dw_thumbnails']!=$mainsettings['dw_thumbnails']) {update_option('embed_privacy_download_thumbnails', $mainsettings['dw_thumbnails']);}
if($currentsettings['preserve_data']!=$mainsettings['preserve_data']) {update_option('embed_privacy_preserve_data_on_uninstall', $mainsettings['preserve_data']);}
}
}
//if current user cannot manage network remove settings page
if (!current_user_can('manage_network')){
//removes link
add_action('admin_menu', 'altuxa_privacida_incrustaciones_removesettings');
//redirect
global $pagenow;
if ( ($pagenow=='options-general.php') && isset($_GET['page']) && ($_GET['page'] == 'embed_privacy') ){
wp_redirect( 'edit.php?post_type=epi_embed' );
exit();
}
}
}
}
//run main function
add_action('init','altuxa_privacida_incrustaciones_run');Forum: Plugins
In reply to: [Embed Privacy] Make settings pages only available for network adminGood Idea, I’ll try that. Thank you very much, and thank you for your plugin, is really nice.
Thank you very much, I made a fresh install and I only installed WooCommerce and PDF Invoices & Packing Slips and then I tried with php 8.2.12 (not supported by WooCommerce) and the error persists, with php 8.0.30 the error it’s not showed.
I know it’s not a critical issue but I thought that you probably want to know for future releases (especially if is not your fault)
Thank you for your attention
line 591 is
$uri = network_admin_url( 'options-general.php?page=limit-login-attempts' );
and should be
$uri = network_admin_url( 'settings.php?page=limit-login-attempts' );I don’t know if you have to correct also https://plugins.trac.ww.wp.xz.cn/browser/limit-login-attempts-reloaded/trunk/views/tab-settings.php on line 35
- This reply was modified 5 years, 2 months ago by dangerouspiper.
I can confirm this bug, I get a 404 error. The tabs links points to options-general.php but If I manualy write on the browser https://myurl.com/network/settings.php?page=limit-login-attempts&tab=settings it works.
Also if I change my settings I cannot save (I get 404 error)
- This reply was modified 5 years, 2 months ago by dangerouspiper.
- This reply was modified 5 years, 2 months ago by dangerouspiper.