Forum Replies Created
-
AuthorPosts
-
kardonParticipant
I never got to complete that last change. But, everything is now working.
Over the weekend the hosting provider took several actions. They turned off HHVM, recompiled my PHP and Apache server settings and then removed URE plugin.
I reinstalled the plugin nice and clean after all was done. It all works perfectly now.
No one could identify exactly what fixed things although they feel the HHVM could be the problem.
I do greatly appreciate all your efforts with this problem. Without the specifics you gave me they would have never figured any things to try. They aren’t coders so they couldn’t figure out where the problem could possibly be coming from in their set up.
kardonParticipantThis is where I put it in base_lib
protected function __construct($options_id) { $this->multisite = function_exists('is_multisite') && is_multisite(); if ($this->multisite) { $this->blog_ids = $this->get_blog_ids(); // get Id of 1st (main) blog $this->main_blog_id = $this->blog_ids[0][0]; } $this->init_options($options_id); } // end of __construct() <strong>/** * Returns the main site IDs * @global $current_site * @return $current_site->blog_id */ public function get_main_site() { global $current_site; return $current_site->blog_id; } // end of get_main_site()</strong> /** * Returns the array of multisite WP blogs IDs * @global wpdb $wpdb * @return array */ protected function get_blog_ids() { global $wpdb;
kardonParticipantprotected function init_options($options_id) { global $wpdb; if (รง) { if ( ! function_exists( 'is_plugin_active_for_network' ) ) { // Be sure the function is defined before trying to use it require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); } $this->active_for_network = is_plugin_active_for_network(URE_PLUGIN_BASE_NAME); } $current_blog = $wpdb->blogid; if ($this->multisite && $current_blog!=$this->main_blog_id) { if ($this->active_for_network) { // plugin is active for whole network, so get URE options from the main blog switch_to_blog($this->main_blog_id); } } $this->options_id = $options_id; $this->options = get_option($options_id); if ($this->multisite && $current_blog!=$this->main_blog_id) { if ($this->active_for_network) { // plugin is active for whole network, so return back to the current blog restore_current_blog(); } } <strong>echo '</br> ure-lib:$this->multisite '. $this->multisite; echo '</br> ure-lib:$current_blog: '. $current_blog; echo '</br> ure-lib:$this->main_blog_id: '. $this->main_blog_id; echo '</br> ure-lib:this->active_for_network: '. $this->active_for_network;</strong> } // end of init_options()
This code that echos the exact variable names used in the function returns this:
ure-lib:$this->multisite 1
ure-lib:$current_blog: 38
ure-lib:$this->main_blog_id:
ure-lib:this->active_for_network: 1I then added the global line you mentioned and the echo of it.
ure-lib:$current_site->blog_id 1
ure-lib:$this->multisite 1
ure-lib:$current_blog: 38
ure-lib:$this->main_blog_id:
ure-lib:this->active_for_network: 1Does this provide any clue to the problem?
kardonParticipantOK, here is what I have learned.
I put thIS code in the theme functions.php
echo '</br> Main site ID theme functions.php: '. $current_site->blog_id;
and then also added it to the ure-lib.php.
protected function init_options($options_id) { global $wpdb; if ($this->multisite) { if ( ! function_exists( 'is_plugin_active_for_network' ) ) { // Be sure the function is defined before trying to use it require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); } $this->active_for_network = is_plugin_active_for_network(URE_PLUGIN_BASE_NAME); } $current_blog = $wpdb->blogid; if ($this->multisite && $current_blog!=$this->main_blog_id) { if ($this->active_for_network) { // plugin is active for whole network, so get URE options from the main blog switch_to_blog($this->main_blog_id); } } echo '</br> Main site ID ure-lib: '. $current_site->blog_id.' '; $this->options_id = $options_id; $this->options = get_option($options_id); if ($this->multisite && $current_blog!=$this->main_blog_id) { if ($this->active_for_network) { // plugin is active for whole network, so return back to the current blog restore_current_blog(); } }
This is what it returns:
Main site ID ure-lib:
Main site ID theme functions.php: 1I don’t know why it knows the value in one place and not the other. If you give me more direction I will do further analysis, though.
Thanks so very much for all your help with this!!
kardonParticipantOK, I found shortcodes.php and made a change to force it ON
class URE_Shortcodes {
private $lib = null;
public function __construct(Ure_Lib_Pro $lib) {
$this->lib = $lib;
$activate_content_for_roles_shortcode = $this->lib->get_option(‘activate_content_for_roles_shortcode’, false);
$activate_content_for_roles_shortcode = true;
if ($activate_content_for_roles_shortcode) {
add_action(‘init’, array($this, ‘add_content_shortcode_for_roles’));
}
}
// end of __construct()I did do an echo on that before and after setting it to test it. When it did the get_option the variable returned was blank.
So, this is the problem. How can I fix the get to the db to return the value of ON. I checked once again and that box is checked on the network settings for URE.
kardonParticipantIs there any way to force the sub-sites to see the shortcodes?
kardonParticipantMain site ID: 1
blog_id 1
kardonParticipantIt is Network Activated and the box for Activate [user_role_editor roles=”role1, role2, …”] shortcode is checked.
kardonParticipantI have discovered the issue is only on subsites, not the main network site. Is there a way I can reset that or check to see if the subsites are set to use the shortcode?
kardonParticipantIt was not on. I set it to ON. But, the problem persists.
Hosting tech seems to think this error is related:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
jquery-migrate.min.js:2 JQMIGRATE: Migrate is installed, version 1.4.1https://kardonhq.net/wp-content/plugins/media/style.css?ver=e6fbd43a92cc6bc14580501f0ea9497f Failed to load resource: the server responded with a status of 500 (Internal Server Error)
Because wp-content/plugins/media folder doesn’t exist the error happens.
kardonParticipantThank you so much for the work you did here!! Got this thing working pretty easily and it works great on all our testing. Rolling it out live in the next week!
kardonParticipantThe Gravity Forms team says they have never worked with URE but they have hooks that could be used for what we want to do if we know the actions to perform.
https://www.gravityhelp.com/documentation/category/user-registration/
Has the list of hooks.They believe the user updated one is what we need. https://www.gravityhelp.com/documentation/article/gform_user_updated/
Can you tell me what the PHP code would need to do in order for me to add a checkbox field for adding secondary roles?
kardonParticipantI knew it would be something tiny like that! You have made my day!
kardonParticipantJust sent it over to you. Thanks for your help.
-
AuthorPosts