├── .gitmodules
├── sql.txt
├── changelog.txt
├── README.md
├── blog-user-creator-files
└── languages
│ └── blog-user-creator.pot
└── blog-user-creator.php
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "dash-notice"]
2 | path = dash-notice
3 | url = git@bitbucket.org:incsub/wpmudev-dashboard-notification.git
4 | branch = master
5 |
--------------------------------------------------------------------------------
/sql.txt:
--------------------------------------------------------------------------------
1 | CREATE TABLE IF NOT EXISTS `wp_blog_user_creator_queue` (
2 | `blog_user_creator_ID` bigint(20) unsigned NOT NULL auto_increment,
3 | `blog_user_creator_site_ID` bigint(20),
4 | `blog_user_creator_blog_ID` bigint(20),
5 | `blog_user_creator_batch_ID` varchar(255),
6 | `blog_user_creator_user_name` varchar(255),
7 | `blog_user_creator_user_pass` varchar(255),
8 | `blog_user_creator_user_email` varchar(255),
9 | `blog_user_creator_blog_name` varchar(255),
10 | `blog_user_creator_blog_title` varchar(255),
11 | `blog_user_creator_blog_types` TEXT,
12 | `blog_user_creator_add_admin` tinyint(1),
13 | `blog_user_creator_admin_uid` varchar(255),
14 | `blog_user_creator_stamp` bigint(20),
15 | `blog_user_creator_error` tinyint(1),
16 | `blog_user_creator_error_msg` varchar(255),
17 | PRIMARY KEY (`blog_user_creator_ID`)
18 | ) ENGINE=MyISAM;
--------------------------------------------------------------------------------
/changelog.txt:
--------------------------------------------------------------------------------
1 | Plugin Name: Blog & User Creator
2 | Author: Andrew Billits, Ulrich Sossou
3 |
4 | Change Log:
5 | ----------------------------------------------------------------------
6 | ----------------------------------------------------------------------
7 |
8 | 1.1.9 - 01/10/2011
9 | ----------------------------------------------------------------------
10 | - 3.1+ compatibility update
11 | - Bug fixes
12 | - Internationalization
13 |
14 | 1.1.8 - 06/01/2010
15 | ----------------------------------------------------------------------
16 | - 3.0+ compatibility update
17 |
18 | 1.1.7 - 06/16/2009
19 | ----------------------------------------------------------------------
20 | - Fixed typo.
21 |
22 | 1.1.6 - 06/15/2009
23 | ----------------------------------------------------------------------
24 | - Fixed url typo.
25 |
26 | 1.1.5 - 06/09/2009
27 | ----------------------------------------------------------------------
28 | - Initial Premium Release.
29 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Blog & user creator
2 |
3 |
4 | **INACTIVE NOTICE: This plugin is unsupported by WPMUDEV, we've published it here for those technical types who might want to fork and maintain it for their needs.**
5 |
6 | ## Translations
7 |
8 | Translation files can be found at https://github.com/wpmudev/translations
9 |
10 | ## About
11 |
12 | Blog & User Creator is the quickest and easiest way for you, and your users to bulk create blogs and users and email out their passwords.
13 |
14 | Bulk create new users, batch add existing users to a blog and mass create blogs – all combined into one powerful plugin. Every day this plugin makes life easier for educators and their students on [Edublogs.](http://edublogs.org/)
15 |
16 | ### Incredibly easy
17 |
18 | Install and activate for a nice new 'Blog & User Creator' menu item to appear under Users in the site admin dashboard.
19 |
20 | 
21 |
22 | Seamless integration with WordPress
23 |
24 | Access a beautiful form for adding new users, adding existing users or creating blogs in batches of 5, 10,...or more
25 |
26 | 
27 |
28 | Save countless hours adding multiple users
29 |
30 | Blog & User Creator is the ultimate time saver for adding new users, existing users and creating blogs – built for Multisite and BuddyPress.
31 |
32 | ## Usage
33 |
34 | ### To install:
35 |
36 | 1. Download the plugin file
37 | 2. Unzip the file into a folder on your hard drive
38 | 3. Upload **/blog-user-creator/** folder to **/wp-content/plugins/** folder on your site
39 | 4. Visit **Network Admin -> Plugins** and **Network Activate** it there.
40 |
41 | _Note: If you have an older version of the plugin installed in /mu-plugins/ please delete it._
42 |
43 | * **That's it! No configuration necessary!**
44 |
45 | ### To Use:
46 |
47 | Once activated go **Settings > Blog & User creator** in the network admin dashboard and enable the components you want your different users to be able to access.
48 |
49 | 
50 |
51 | This controls what your users will be able to see under each tab in the 'Blog & User Creator' in their site admin dashboard.
52 |
53 | ### To add a new user
54 |
55 | 1\. Go to **Users > Blog & User Creator **
56 |
57 | 2\. Click on the **Add New Users** tab
58 |
59 | 
60 |
61 | 3\. Add suitable usernames.
62 |
63 | 4\. Add their email address
64 |
65 | 5\. Add their password
66 |
67 | * leave this blank if you want to let the system automatically create the password
68 |
69 | 6\. Select their role (learn more about [user role’s](https://premium.wpmudev.org/wpmu-manual/introduction-to-super-admin-user/) here)
70 |
71 | 7\. Click **Submit** to create and add them to your blog.
72 |
73 | 
74 |
75 | ### To add a new user
76 |
77 | 1\. Go to **Users > Blog & User Creator **
78 |
79 | 2\. Click on the **Add Existing Users** tab
80 |
81 | 
82 |
83 | 3\. Add their existing usernames or the email addresses attached to their usernames
84 |
85 | 4\. Select their roles (learn more about [user role’s](../wpmu-manual/introduction-to-super-admin-user/) here)
86 |
87 | 5\. Click **Submit** **
88 |
89 | 
90 |
91 | **
92 |
93 | ### To create new blogs
94 |
95 | 1. Go to **Users** > **Blog & User Creator **
96 |
97 | 2\. Click on the **Create Blogs** tab
98 |
99 | 3\. Select their role on their new blog, their role on your blog, your role on their blog (learn more about [user role’s](../wpmu-manual/introduction-to-super-admin-user/) here)
100 |
101 | 
102 |
103 | 4\. Add suitable usernames.
104 |
105 | 5\. Add their email address
106 |
107 | 6\. Add their password
108 |
109 | * leave this blank if you want to let the system automatically create the password
110 |
111 | 7\. Add their blog urls
112 |
113 | 8\. Add Blog title
114 |
115 | * This can be changed later in Settings > General
116 |
117 | 9. Click **Submit** at the bottom of the page
118 |
119 | * Click on **Add More** if you want to create in batches more than 5 blogs.
120 |
121 | 
122 |
123 |
124 |
--------------------------------------------------------------------------------
/blog-user-creator-files/languages/blog-user-creator.pot:
--------------------------------------------------------------------------------
1 | # Translation of the WordPress plugin Blog And User Creator 1.1.9 by Andrew Billits, Ulrich Sossou.
2 | # Copyright (C) 2011 Andrew Billits, Ulrich Sossou
3 | # This file is distributed under the same license as the Blog And User Creator package.
4 | # FIRST AUTHOR
You can create up to 15 "
59 | "different users and blogs at one time and new users will be emailed their "
60 | "usernames and passwords automatically. If you need more than 15 please "
61 | "simply process this form and then start again.
Please try to use "
62 | "unique usernames and blog URLs as this will make the process a lot quicker "
63 | "for you. An easy way to do this is to add numbers and letters after a "
64 | "regular name - for example 'James' at 'Kings Heath School' in year 10 could "
65 | "be 'jameskh10'."
66 | msgstr ""
67 |
68 | #: blog-user-creator.php:305 blog-user-creator.php:831
69 | msgid "User Name"
70 | msgstr ""
71 |
72 | #: blog-user-creator.php:308 blog-user-creator.php:834
73 | msgid ""
74 | "This will be the name used to log in, try to choose something that will be "
75 | "unique - e.g. jamesqt3"
76 | msgstr ""
77 |
78 | #: blog-user-creator.php:309 blog-user-creator.php:480
79 | #: blog-user-creator.php:835 blog-user-creator.php:1332
80 | msgid ""
81 | "For existing users, leave this field blank and just enter the user email "
82 | "below."
83 | msgstr ""
84 |
85 | #: blog-user-creator.php:312 blog-user-creator.php:483
86 | #: blog-user-creator.php:838 blog-user-creator.php:1335
87 | msgid "User Email"
88 | msgstr ""
89 |
90 | #: blog-user-creator.php:315 blog-user-creator.php:486
91 | #: blog-user-creator.php:841 blog-user-creator.php:1338
92 | msgid ""
93 | "Required - if a user already exists with this email address, that user will "
94 | "be added to the blog you are creating."
95 | msgstr ""
96 |
97 | #: blog-user-creator.php:318 blog-user-creator.php:844
98 | msgid "User Password"
99 | msgstr ""
100 |
101 | #: blog-user-creator.php:321 blog-user-creator.php:847
102 | msgid ""
103 | "Leave this blank for a random password to be automatically generated and "
104 | "emailed to the user."
105 | msgstr ""
106 |
107 | #: blog-user-creator.php:324 blog-user-creator.php:850
108 | msgid "Blog Url"
109 | msgstr ""
110 |
111 | #: blog-user-creator.php:327 blog-user-creator.php:853
112 | msgid ""
113 | "You must fill this in for a blog to be created - try to choose something "
114 | "unique - e.g. myblog1aq will create http://myblog1aq."
115 | msgstr ""
116 |
117 | #: blog-user-creator.php:330 blog-user-creator.php:856
118 | msgid "Blog Title"
119 | msgstr ""
120 |
121 | #: blog-user-creator.php:333 blog-user-creator.php:859
122 | msgid ""
123 | "Required if you are creating a blog - this will appear as the title and can "
124 | "easily be changed later on - e.g. My School Blog"
125 | msgstr ""
126 |
127 | #: blog-user-creator.php:375 blog-user-creator.php:460
128 | #: blog-user-creator.php:916 blog-user-creator.php:1294
129 | msgid "Add Admin"
130 | msgstr ""
131 |
132 | #: blog-user-creator.php:378 blog-user-creator.php:463
133 | #: blog-user-creator.php:918 blog-user-creator.php:1296
134 | msgid "No"
135 | msgstr ""
136 |
137 | #: blog-user-creator.php:379 blog-user-creator.php:464
138 | #: blog-user-creator.php:919 blog-user-creator.php:1297
139 | msgid "Yes"
140 | msgstr ""
141 |
142 | #: blog-user-creator.php:383 blog-user-creator.php:467
143 | #: blog-user-creator.php:922 blog-user-creator.php:1300
144 | msgid ""
145 | "This will add you as a co-administrator of the blog so you can log into it "
146 | "and edit settings / make posts."
147 | msgstr ""
148 |
149 | #: blog-user-creator.php:392 blog-user-creator.php:414
150 | #: blog-user-creator.php:493 blog-user-creator.php:811
151 | #: blog-user-creator.php:931 blog-user-creator.php:1308
152 | #: blog-user-creator.php:1347
153 | msgid "Create"
154 | msgstr ""
155 |
156 | #: blog-user-creator.php:394 blog-user-creator.php:416
157 | #: blog-user-creator.php:495 blog-user-creator.php:814
158 | #: blog-user-creator.php:934 blog-user-creator.php:1311
159 | #: blog-user-creator.php:1350
160 | msgid "This may take some time so please be patient."
161 | msgstr ""
162 |
163 | #: blog-user-creator.php:399
164 | msgid "Advanced"
165 | msgstr ""
166 |
167 | #: blog-user-creator.php:417 blog-user-creator.php:1252
168 | msgid "Common Options"
169 | msgstr ""
170 |
171 | #: blog-user-creator.php:473
172 | msgid ":"
173 | msgstr ""
174 |
175 | #: blog-user-creator.php:476 blog-user-creator.php:1328
176 | msgid "Blog/User Name"
177 | msgstr ""
178 |
179 | #: blog-user-creator.php:479
180 | msgid ""
181 | "This will be the name used to log in and the name of the blog (ex: name."
182 | msgstr ""
183 |
184 | #: blog-user-creator.php:560 blog-user-creator.php:1018
185 | msgid "Only lowercase letters and numbers allowed"
186 | msgstr ""
187 |
188 | #: blog-user-creator.php:573 blog-user-creator.php:1031
189 | msgid "Sorry, that name is not allowed"
190 | msgstr ""
191 |
192 | #: blog-user-creator.php:580
193 | msgid "Sorry, blog name must be at least 4 characters"
194 | msgstr ""
195 |
196 | #: blog-user-creator.php:588
197 | msgid "Sorry, blog names may not contain the character '_'"
198 | msgstr ""
199 |
200 | #: blog-user-creator.php:598
201 | msgid "Sorry, blog names must have letters too"
202 | msgstr ""
203 |
204 | #: blog-user-creator.php:619
205 | msgid "Sorry, that blog name already exists"
206 | msgstr ""
207 |
208 | #: blog-user-creator.php:627
209 | msgid "Please provide a blog title"
210 | msgstr ""
211 |
212 | #: blog-user-creator.php:639 blog-user-creator.php:647
213 | #: blog-user-creator.php:1086 blog-user-creator.php:1094
214 | msgid "You must provide a valid email address"
215 | msgstr ""
216 |
217 | #: blog-user-creator.php:661
218 | msgid "Sorry, that username already exists"
219 | msgstr ""
220 |
221 | #: blog-user-creator.php:679
222 | msgid ""
223 | "That username is currently reserved but may be available in a couple of days"
224 | msgstr ""
225 |
226 | #: blog-user-creator.php:688 blog-user-creator.php:1136
227 | msgid "Only lowercase letters and numbers allowed in usernames"
228 | msgstr ""
229 |
230 | #: blog-user-creator.php:700
231 | msgid "You must provide a username"
232 | msgstr ""
233 |
234 | #: blog-user-creator.php:709
235 | msgid "Sorry, usernames must have letters too"
236 | msgstr ""
237 |
238 | #: blog-user-creator.php:716
239 | msgid "Username must be at least 4 characters"
240 | msgstr ""
241 |
242 | #: blog-user-creator.php:723
243 | msgid "Sorry, usernames may not contain the character '_'"
244 | msgstr ""
245 |
246 | #: blog-user-creator.php:736
247 | msgid "That username is not allowed"
248 | msgstr ""
249 |
250 | #: blog-user-creator.php:748 blog-user-creator.php:1196
251 | msgid ""
252 | "You cannot use that email address. We are having problems with them blocking "
253 | "some of our email. Please use another email provider."
254 | msgstr ""
255 |
256 | #: blog-user-creator.php:755 blog-user-creator.php:1203
257 | msgid "Please enter a correct email address"
258 | msgstr ""
259 |
260 | #: blog-user-creator.php:765 blog-user-creator.php:1213
261 | msgid "Sorry, that email address is not allowed"
262 | msgstr ""
263 |
264 | #: blog-user-creator.php:793 blog-user-creator.php:1239
265 | msgid "Errors were found. Please fix the errors and hit Create."
266 | msgstr ""
267 |
268 | #: blog-user-creator.php:812 blog-user-creator.php:932
269 | #: blog-user-creator.php:1309 blog-user-creator.php:1348
270 | msgid "Cancel"
271 | msgstr ""
272 |
273 | #: blog-user-creator.php:941 blog-user-creator.php:1357
274 | #: blog-user-creator.php:1384
275 | msgid "Creatings blogs..."
276 | msgstr ""
277 |
278 | #: blog-user-creator.php:993
279 | #, php-format
280 | msgid "%s 's Blog"
281 | msgstr ""
282 |
283 | #: blog-user-creator.php:1038 blog-user-creator.php:1164
284 | msgid "Sorry, blog/user names must be at least 4 characters"
285 | msgstr ""
286 |
287 | #: blog-user-creator.php:1046 blog-user-creator.php:1171
288 | msgid "Sorry, blog/user names may not contain the character '_'"
289 | msgstr ""
290 |
291 | #: blog-user-creator.php:1056 blog-user-creator.php:1157
292 | msgid "Sorry, blog/user names must have letters too"
293 | msgstr ""
294 |
295 | #: blog-user-creator.php:1077 blog-user-creator.php:1108
296 | msgid "Sorry, that blog/user name already exists"
297 | msgstr ""
298 |
299 | #: blog-user-creator.php:1126
300 | msgid ""
301 | "That blog/user name is currently reserved but may be available in a couple "
302 | "of days"
303 | msgstr ""
304 |
305 | #: blog-user-creator.php:1148
306 | msgid "You must provide a blog/user name"
307 | msgstr ""
308 |
309 | #: blog-user-creator.php:1184
310 | msgid "Sorry, that blog/user name is not allowed"
311 | msgstr ""
312 |
313 | #: blog-user-creator.php:1331
314 | #, php-format
315 | msgid ""
316 | "This will be the name used to log in and the name of the blog (ex: name.%1$s"
317 | "%2$s), try to choose something that will be unique - e.g. jamesqt3"
318 | msgstr ""
319 |
320 | #: blog-user-creator.php:1397
321 | msgid "Blogs and users created."
322 | msgstr ""
323 |
324 | #: blog-user-creator.php:1419
325 | msgid ""
326 | "Please install the latest version of our free "
328 | "Update Notifications plugin which helps you stay up-to-date with the "
329 | "most stable, secure versions of WPMU DEV themes and plugins. More information »"
332 | msgstr ""
333 |
334 | #. Plugin Name of the plugin/theme
335 | msgid "Blog And User Creator"
336 | msgstr ""
337 |
338 | #. Plugin URI of the plugin/theme
339 | msgid "http://premium.wpmudev.org/project/blog-and-user-creator"
340 | msgstr ""
341 |
342 | #. Description of the plugin/theme
343 | msgid ""
344 | "The blog and user creator plugin is an amazing powerful feature that allows "
345 | "you, and your users, to batch create gazillions of blogs and/or users while "
346 | "setting passwords, urls, titles and more!"
347 | msgstr ""
348 |
349 | #. Author of the plugin/theme
350 | msgid "Andrew Billits, Ulrich Sossou"
351 | msgstr ""
352 |
353 | #. Author URI of the plugin/theme
354 | msgid "http://premium.wpmudev.org/project/"
355 | msgstr ""
356 |
--------------------------------------------------------------------------------
/blog-user-creator.php:
--------------------------------------------------------------------------------
1 | fields = isset( $_GET['fields'] ) ? $_GET['fields'] : '';
73 |
74 | // default to 15 field sets
75 | if ( $this->fields == '' )
76 | $this->fields = 15;
77 |
78 | // no more than 50 fields sets
79 | if ( $this->fields > 50 )
80 | $this->fields = 50;
81 |
82 | // load text domain
83 | if ( defined( 'WPMU_PLUGIN_DIR' ) && file_exists( WPMU_PLUGIN_DIR . '/blog-user-creator.php' ) ) {
84 | load_muplugin_textdomain( 'blog_user_creator', 'blog-user-creator-files/languages' );
85 | } else {
86 | load_plugin_textdomain( 'blog_user_creator', false, dirname( plugin_basename( __FILE__ ) ) . '/blog-user-creator-files/languages' );
87 | }
88 | }
89 |
90 | /**
91 | * Update database
92 | **/
93 | function make_current() {
94 | global $plugin_page;
95 |
96 | if( 'blog-user-creator' !== $plugin_page )
97 | return;
98 |
99 | if ( get_site_option( 'blog_user_creator_version' ) == '' )
100 | add_site_option( 'blog_user_creator_version', '0.0.0' );
101 |
102 | if ( get_site_option( 'blog_user_creator_version' ) !== $this->version ) {
103 | update_site_option( 'blog_user_creator_version', $this->version );
104 | update_site_option( 'blog_user_creator_installed', 'no' );
105 | }
106 |
107 | $this->global_install();
108 |
109 | if ( get_option( 'blog_user_creator_version' ) == '' )
110 | add_option( 'blog_user_creator_version', $this->version );
111 |
112 | if ( get_option( 'blog_user_creator_version' ) !== $this->version )
113 | update_option( 'blog_user_creator_version', $this->version );
114 | }
115 |
116 | function global_install() {
117 | global $wpdb;
118 |
119 | if ( get_site_option( 'blog_user_creator_installed' ) == '' )
120 | add_site_option( 'blog_user_creator_installed', 'no' );
121 |
122 | if ( get_site_option( 'blog_user_creator_installed' ) !== 'yes' ) {
123 |
124 | if( @is_file( ABSPATH . '/wp-admin/includes/upgrade.php' ) )
125 | include_once( ABSPATH . '/wp-admin/includes/upgrade.php' );
126 | else
127 | die( __( 'We have problem finding your \'/wp-admin/upgrade-functions.php\' and \'/wp-admin/includes/upgrade.php\'', 'blog_user_creator' ) );
128 |
129 | $charset_collate = '';
130 | if( $wpdb->supports_collation() ) {
131 | if( !empty( $wpdb->charset ) ) {
132 | $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
133 | }
134 | if( !empty( $wpdb->collate ) ) {
135 | $charset_collate .= " COLLATE $wpdb->collate";
136 | }
137 | }
138 |
139 | $blog_user_creator_table = "CREATE TABLE `{$wpdb->base_prefix}blog_user_creator_queue` (
140 | `blog_user_creator_ID` bigint(20) unsigned NOT NULL auto_increment,
141 | `blog_user_creator_site_ID` bigint(20),
142 | `blog_user_creator_blog_ID` bigint(20),
143 | `blog_user_creator_batch_ID` varchar(255),
144 | `blog_user_creator_user_name` varchar(255),
145 | `blog_user_creator_user_pass` varchar(255),
146 | `blog_user_creator_user_email` varchar(255),
147 | `blog_user_creator_blog_name` varchar(255),
148 | `blog_user_creator_blog_title` varchar(255),
149 | `blog_user_creator_blog_types` TEXT,
150 | `blog_user_creator_add_admin` tinyint(1),
151 | `blog_user_creator_admin_uid` varchar(255),
152 | `blog_user_creator_stamp` bigint(20),
153 | `blog_user_creator_error` tinyint(1),
154 | `blog_user_creator_error_msg` varchar(255),
155 | PRIMARY KEY (`blog_user_creator_ID`)
156 | ) $charset_collate;";
157 |
158 | maybe_create_table( "{$wpdb->base_prefix}blog_user_creator_queue", $blog_user_creator_table );
159 |
160 | update_site_option( 'blog_user_creator_installed', 'yes' );
161 |
162 | }
163 |
164 | }
165 |
166 | function plug_pages() {
167 | add_submenu_page( 'users.php', __( 'Blog & User Creator', 'blog_user_creator' ), __( 'Blog & User Creator', 'blog_user_creator' ), 'manage_options', 'blog-user-creator', array( &$this, 'page_output' ) );
168 | }
169 |
170 | function queue_insert( $batch_ID, $stamp, $blog_name, $blog_title, $blog_types, $add_admin, $admin_uid, $user_name, $user_pass, $user_email ) {
171 | global $wpdb;
172 | $wpdb->query( $wpdb->prepare( "INSERT INTO {$wpdb->base_prefix}blog_user_creator_queue ( blog_user_creator_site_ID, blog_user_creator_blog_ID, blog_user_creator_batch_ID, blog_user_creator_user_name, blog_user_creator_user_pass, blog_user_creator_user_email, blog_user_creator_blog_name, blog_user_creator_blog_title, blog_user_creator_blog_types, blog_user_creator_add_admin, blog_user_creator_admin_uid, blog_user_creator_stamp ) VALUES ( %d, %d, %d, %s, %s, %s, %s, %s, %s, %d, %d, %s )", $wpdb->siteid, $wpdb->blogid, $batch_ID, $user_name, $user_pass, $user_email, $blog_name, $blog_title, $blog_types, $add_admin, $admin_uid, $stamp ) );
173 | }
174 |
175 | function queue_process( $tmp_blog_ID, $tmp_site_ID ) {
176 | global $wpdb, $current_site, $current_user, $base;
177 |
178 | $blog_user_creator_enable_blog_types = $this->enable_blog_types;
179 |
180 | if ( '' == $base )
181 | $base = '/';
182 |
183 | $query = "SELECT * FROM " . $wpdb->base_prefix . "blog_user_creator_queue WHERE blog_user_creator_site_ID = '" . $tmp_site_ID . "' AND blog_user_creator_blog_ID = '" . $tmp_blog_ID . "' LIMIT 1";
184 | $tmp_creator_items = $wpdb->get_results( $query, ARRAY_A );
185 |
186 | if (count($tmp_creator_items) > 0){
187 | foreach ($tmp_creator_items as $tmp_creator_item){
188 |
189 | if ($tmp_creator_item['blog_user_creator_blog_name'] == ''){
190 | $tmp_create_blog = 'no';
191 | } else {
192 | $tmp_create_blog = 'yes';
193 | }
194 | if ($tmp_create_blog == 'yes'){
195 | //setup domain / path
196 | $tmp_domain = strtolower( esc_html( $tmp_creator_item['blog_user_creator_blog_name'] ) );
197 | $tmp_blog_title = stripslashes($tmp_creator_item['blog_user_creator_blog_title']);
198 | if( constant( "VHOST" ) == 'yes' ) {
199 | $tmp_blog_domain = $tmp_domain.".".$current_site->domain;
200 | $tmp_blog_path = $base;
201 | } else {
202 | $tmp_blog_domain = $current_site->domain;
203 | $tmp_blog_path = $base.$tmp_domain.'/';
204 | }
205 | }
206 | //user bits
207 | $tmp_user_email = trim( esc_html( stripslashes( $tmp_creator_item['blog_user_creator_user_email'] ) ) );
208 | $tmp_user_email_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->base_prefix . "users WHERE user_email = '" . $tmp_user_email . "'");
209 | if ($tmp_user_email_count > 0){
210 | //user already exists for email - use it!
211 | $user_id = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_email = '" . $tmp_user_email . "'");
212 | //no new password:
213 | $tmp_user_pass = '';
214 | } else {
215 | if ($tmp_creator_item['blog_user_creator_user_pass'] == '' || $tmp_creator_item['blog_user_creator_user_pass'] == strtolower('null')){
216 | $tmp_user_pass = wp_generate_password();
217 | } else {
218 | $tmp_user_pass = $tmp_creator_item['blog_user_creator_user_pass'];
219 | }
220 | $tmp_user_name = $tmp_creator_item['blog_user_creator_user_name'];
221 | $user_id = wpmu_create_user($tmp_user_name,$tmp_user_pass,$tmp_user_email);
222 |
223 | if( false !== $user_id )
224 | wp_new_user_notification( $user_id, $tmp_user_pass );
225 | }
226 | //blog bits
227 | $wpdb->hide_errors();
228 | if ($tmp_create_blog == 'yes'){
229 | //double check username
230 | if ($user_id == ''){
231 | $user_id = $wpdb->get_var("SELECT ID FROM " . $wpdb->users . " WHERE user_email = '" . trim( esc_html( stripslashes( $tmp_creator_item['blog_user_creator_user_email'] ) ) ) . "'" );
232 | }
233 | //double check password
234 | if ($tmp_user_pass == ''){
235 | $tmp_user_pass = '';
236 | }
237 | $blog_id = wpmu_create_blog( $tmp_blog_domain, $tmp_blog_path, esc_html( $tmp_blog_title ), $user_id, 1, $current_site->id );
238 | //$wpdb->show_errors();
239 | $wpdb->hide_errors();
240 | if( !is_wp_error($blog_id) ) {
241 | $content_mail = sprintf( __( 'New blog created by %1s\n\nAddress: http://%2s\nName: %3s', 'blog_user_creator' ), $current_user->user_login , $tmp_blog_domain.$tmp_blog_path, esc_html( $tmp_blog_title ) );
242 | @wp_mail( get_option('admin_email'), sprintf(__( '[%s] New Blog Created', 'blog_user_creator' ), $current_site->site_name), $content_mail );
243 | //wp_redirect( add_query_arg( "updated", "blogadded", $_SERVER[ 'HTTP_REFERER' ] ) );
244 |
245 | if ($tmp_creator_item['blog_user_creator_add_admin'] == 1){
246 | add_user_to_blog($blog_id, $tmp_creator_item['blog_user_creator_admin_uid'], 'administrator');
247 | }
248 | if ( '1' == $blog_user_creator_enable_blog_types && !empty( $blog_types ) ){
249 | update_blog_option( $blog_id, 'blog_types', $tmp_creator_item['blog_user_creator_blog_types'] );
250 | }
251 | //send email
252 | wpmu_welcome_notification($blog_id, $user_id, $tmp_user_pass, esc_html( $tmp_blog_title ), '');
253 | } else {
254 | echo sprintf( __( 'Error creating blog: %1$s - %2$s', 'blog_user_creator' ), $tmp_add_blog_domain, $blog_id->get_error_message() ) . '
';
255 | }
256 | }
257 | //=====================================================================//
258 | //=====================================================================//
259 | $wpdb->query( "DELETE FROM " . $wpdb->base_prefix . "blog_user_creator_queue WHERE blog_user_creator_blog_ID = '" . $wpdb->blogid . "' AND blog_user_creator_site_ID = '" . $wpdb->siteid . "' AND blog_user_creator_ID = '" . $tmp_creator_item['blog_user_creator_ID'] . "'" );
260 | }
261 | }
262 | }
263 |
264 | function page_output() {
265 | global $wpdb, $wp_roles, $current_user, $user_ID, $current_site, $blog_types, $blog_types_selection, $blog_types_branding_singular, $blog_types_branding_plural, $base;
266 |
267 | $blog_user_creator_fields = $this->fields;
268 | $blog_user_creator_enable_blog_types = $this->enable_blog_types;
269 | $default_blog_type = $this->default_blog_type;
270 |
271 | if(!current_user_can('manage_options')) {
272 | ?>
273 |
274 | ()
289 |
290 |
You can create up to 15 different users and blogs at one time and new users will be emailed their usernames and passwords automatically. If you need more than 15 please simply process this form and then start again.
Please try to use unique usernames and blog URLs as this will make the process a lot quicker for you. An easy way to do this is to add numbers and letters after a regular name - for example \'James\' at \'Kings Heath School\' in year 10 could be \'jameskh10\'.', 'blog_user_creator' ) ?> ()
403 |
404 |
You can create up to 15 different users and blogs at one time and new users will be emailed their usernames and passwords automatically. If you need more than 15 please simply process this form and then start again.
Please try to use unique usernames and blog URLs as this will make the process a lot quicker for you. An easy way to do this is to add numbers and letters after a regular name - for example \'James\' at \'Kings Heath School\' in year 10 could be \'jameskh10\'.', 'blog_user_creator' ) ?>
' . __( 'Creatings blogs...', 'blog_user_creator' ) . '
'; 1388 | $tmp_queue_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->base_prefix . "blog_user_creator_queue WHERE blog_user_creator_site_ID = '" . $wpdb->siteid . "' AND blog_user_creator_blog_ID = '" . $wpdb->blogid . "'" ); 1389 | $this->queue_process( $wpdb->blogid, $wpdb->siteid ); 1390 | 1391 | if ($tmp_queue_count > 0){ 1392 | echo " 1393 | 1396 | "; 1397 | } else { 1398 | echo " 1399 | 1402 | "; 1403 | } 1404 | break; 1405 | } 1406 | echo ''; 1407 | } 1408 | 1409 | } 1410 | $blog_user_creator =& new Blog_User_Creator(); 1411 | 1412 | 1413 | /** 1414 | * Show notification if WPMUDEV Update Notifications plugin is not installed 1415 | **/ 1416 | if ( !function_exists( 'wdp_un_check' ) ) { 1417 | add_action( 'admin_notices', 'wdp_un_check', 5 ); 1418 | add_action( 'network_admin_notices', 'wdp_un_check', 5 ); 1419 | 1420 | function wdp_un_check() { 1421 | if ( !class_exists( 'WPMUDEV_Update_Notifications' ) && current_user_can( 'edit_users' ) ) 1422 | echo '' . __('Please install the latest version of our free Update Notifications plugin which helps you stay up-to-date with the most stable, secure versions of WPMU DEV themes and plugins. More information »', 'wpmudev') . '