Tag Info

Hot answers tagged

2

The WordPress function switch_to_blog() expects an integer as an input parameter. You can read more about it in the Codex: http://codex.wordpress.org/Function_Reference/switch_to_blog Please try this kind of structure instead: <?php $original_blog_id = get_current_blog_id(); // get current blog $bids = array(1,2); // all the blog_id's to loop through ...


2

The plugin should use the API, not some made-up SQL. addslashes() is not safe enough anyway. $user = get_user_by( 'email', 'user@example.com' ); echo $user->ID; Besides that, the user tables are almost the same, there are just some tighter restrictions for user names in multi-site, because new sub domains could be made from the names.


2

The function that deals with this is ms_site_check(). If existent, it will use the following files. And they should render a full custom HTML page. WP_CONTENT_DIR . '/blog-deleted.php' WP_CONTENT_DIR . '/blog-inactive.php' WP_CONTENT_DIR . '/blog-suspended.php' Another option is to short-circuit the process and redirect the visitor. It has to be done ...


2

As @s_ha_dum mentioned in the comments, building an API or some sort of XML or JSON feed (or leveraging one that's already there, or installing a plugin on whatever system that is, etc) is really your only way of getting at that data remotely. Once you get that going, you can use wp_remote_get to query the API. To make this question a little more WordPress ...


2

To copy a post from one blog to another you can do something like this: function copy_post_to_blog($post_id, $target_blog_id) { $post = get_post($post_id, ARRAY_A); // get the original post $post['ID'] = ''; // empty id field, to tell wordpress that this will be a new post switch_to_blog($target_blog_id); // switch to target blog ...


1

This is not exactly worpdress multisite suggestion, but a hack to run and manage multiple wordpress websites. I don't know if it works for you : STEP 1. Move your wordpress installation to its own directory say common (Instructions can be found at http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory) STEP 2. Change the path of wp-content folder ...


1

I'm not sure that what you want is possible. Per the WordPress Codex page on Multisite: You are given the choice between sub-domains and sub-directories, except when existing settings restrict your choice. You must choose one or the other. So you can set your network up to use either sub-domains OR sub-directories for your child sites, but not ...


1

It was actually much easier than I originally thought - just doing a WP_User_Query for a meta value (meta arrays are supported as well, like for the other query classes). public function on_deactivate() { $meta_key = 'tools_page_tsi_per_page'; $query = new WP_User_Query( array( 'meta_key' => $meta_key ) ); if ( empty( $query->results ) ) ...


1

Yes, a multisite is what you need. The membership part is arguably a separate question, and there are many ways of doing it. I would suggest a dedicated members site users register to, but there are lots of other ways of doing it, and there is no definitive answer. See here for what to do before you create a network This is how you'd create a network ...


1

There is no way to add a page template through the WP-Admin screens in vanilla WordPress. To create a page template, you simply create a new .php file in your theme's folder and add this comment to the top: <?php /* Template Name: YourTemplateNameGoesHere */ ?> You will then be able to select that template from the page edit screen. If you're ...


1

I found the issue, thanks to @Toscho giving me the spark of an idea. We are using custom user roles and capabilities. It had something to do with the User Role Editor plugin. Deleted the custom role, and created a new one, reassigning all capabilities. Then updating all users to the newly created user role. Problem fixed. Not sure why that happened, but ...


1

You can try this instead of get_last_updated(): global $wpdb; $blogs = $wpdb->get_results("SELECT blog_id, domain, path FROM {$wpdb->blogs} ORDER BY last_updated DESC" , ARRAY_A ); print_r($blogs); just to see if it changes anything to skip the public, archived, mature, spam , site_id and deleted filters.


1

The following query works. Note the quotes in AND blog_id != '1' global $wpdb; $query = " SELECT blog_id FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' AND blog_id != '1' ORDER BY blog_id ASC"; $blogs = $wpdb->get_col( $wpdb->prepare( ...



Only top voted, non community-wiki answers of a minimum length are eligible