soportemenntun
Respuestas de foro creadas
Viendo 2 respuestas - de la 1 a la 2 (de un total de 2)
-
Foro: Instalación – Actualizaciones
En respuesta a: Problema para al conectar dos wordpresssolucione ese problema de la siguiente manera cargue un pluguin en la plataforma A la cual me permitía entrar sin problemas con el siguiente codigo que encontré:
<?php /* Plugin Name: Duplicate Caps Plugin URI: Description: Tiny plugin to duplicate capabilities in a setup where users (and user tables) are shared across more than one install Author: Mikk3lRo Version: 0.1 Author URI: */ $dummy = new duplicate_caps(); class duplicate_caps { function __construct() { add_action('updated_user_meta', array($this, 'update_prefixed_caps'), 10, 2); add_action('added_user_meta', array($this, 'update_prefixed_caps'), 10, 2); add_action('deleted_user_meta', array($this, 'update_prefixed_caps'), 10, 2); } function update_prefixed_caps($mid, $object_id) { /** * Note that $object_id contains the id of the user that was * just changed. * On a site with many users it would make sense to only * get and set information regarding the just-changed user * Currently this function corrects roles for all users * making sure pre-existing users are duplicated, and keeping * the table in sync. */ global $wpdb; //Quick and dirty - get all *capabilities rows for all users $sql = "SELECT * FROM {$wpdb->usermeta} WHERE <code>meta_key</code> LIKE '%capabilities'"; $results = $wpdb->get_results($sql) or die(mysql_error()); //Will hold all prefixes (always include our own) $prefixes = array($wpdb->prefix); //Will grab the existing role for each prefix $user_roles = array(); //Loop our results foreach ($results as $result) { //Make sure the meta_key looks right, and grab the prefix if (preg_match('#^(.*)capabilities$#', $result->meta_key, $matches)) { $prefix = $matches[1]; // Collect prefixes $prefixes[] = $prefix; //Note the entire row for later use $user_roles[$result->user_id][$prefix] = $result; } } //Make sure we only have one of each $prefixes = array_unique($prefixes); //Loop through the users we found foreach ($user_roles as $user_id => $existing_prefixes) { if (!isset($existing_prefixes[$wpdb->prefix])) { //User was probably just deleted - all rows are deleted by //wordpress though, so no cleanup for us :) } else { //We want all prefixes to obey us (we just created or changed //the user, so we want that to affect all sites) $desired_role = $existing_prefixes[$wpdb->prefix]->meta_value; //Loop through all prefixes foreach ($prefixes as $prefix) { //Data to be inserted / updated $cap_data = array( 'user_id' => $user_id, 'meta_key' => $prefix . 'capabilities', 'meta_value' => $desired_role ); //If the prefix doesn't exist for this user if (!in_array($prefix, array_keys($existing_prefixes))) { //Actually insert it (user was probably just created) $wpdb->insert($wpdb->usermeta, $cap_data, array('%d', '%s', '%s')); } else if ($desired_role !== $existing_prefixes[$prefix]->meta_value) { //Update it if not already correct (user was probably just edited) $cap_data['umeta_id'] = $existing_prefixes[$prefix]->umeta_id; $wpdb->replace($wpdb->usermeta, $cap_data, array('%d', '%s', '%s', '%d')); } } } } } }
- Esta respuesta fue modificada hace 4 años, 1 mes por jose64. Razón: Etiquetar código
Foro: Instalación – Actualizaciones
En respuesta a: Problema para al conectar dos wordpressParcialmente, logre conectarlos, pero me surgió un nuevo problema las dos plataformas me descargan la misma data, es decir, los usuarios solo deberian compartir el campo de usuario y contraseña, pero hay campos adicionales en una que deberian ser diferentes pero me descarga la misma
Viendo 2 respuestas - de la 1 a la 2 (de un total de 2)