Title: Customize for Mult. Users
Last modified: January 13, 2017

---

# Customize for Mult. Users

 *  [Jeff](https://wordpress.org/support/users/jmf/)
 * (@jmf)
 * [22 years ago](https://wordpress.org/support/topic/customize-for-mult-users/)
 * I’m a high school teacher looking for blog software for my students to use next
   year. I’m planning on hosting all the blogs (maybe as many as 100?) on my own
   server. I’m running MT on my own site right now, but I like some of the CSS layouts
   I’m seeing for WP, as well as its overall simplicity. I’ve got a test WP install
   set up to play with…
    Ideally, I’d like the students to have some control over
   the way their blog looks–I think it would make it far more interesting for them.
   Is there a way I could set up authors in one large blog so that they can each
   use a custom CSS file for the look? Some hack, maybe? 50-100 separate WP installs
   might be a bit much to administer, I’m thinking… 😉 Thanks, Jeff. ([http://www.ferrellweb.com](http://www.ferrellweb.com))

Viewing 14 replies - 1 through 14 (of 14 total)

 *  [carthik](https://wordpress.org/support/users/carthik/)
 * (@carthik)
 * [22 years ago](https://wordpress.org/support/topic/customize-for-mult-users/#post-53392)
 * Do you mean to say that there is one blog, but when you click on an author, you
   see only his/her entries, and that too in a page with a customized stylesheet?
   
   This, I think is possible. The main blog will be a page with a link to the different
   authors and the different authors will have different stylesheets. That could
   work, but will need work! 🙂
 *  Thread Starter [Jeff](https://wordpress.org/support/users/jmf/)
 * (@jmf)
 * [22 years ago](https://wordpress.org/support/topic/customize-for-mult-users/#post-53393)
 * > Do you mean to say that there is one blog, but when you click on an author,
   > you see only his/her entries
 * Erk, no — I guess not. I haven’t had a chance to dig in to the setup yet, but
   what I _really_ want is each blog to be “self-contained”…um, so we might have
   [http://www.ferrellweb.com/blogs/SomeStudent/](http://www.ferrellweb.com/blogs/SomeStudent/)
   and [http://www.ferrellweb.com/blogs/AdifferentStudent/](http://www.ferrellweb.com/blogs/AdifferentStudent/)…
   can I *do* this with _one_ WP install? I *think* I had worked out a way to do
   it with MT, but I ran across WP and dropped the MT experimentation to take a 
   look… 🙂
 *  1539
 * [22 years ago](https://wordpress.org/support/topic/customize-for-mult-users/#post-53396)
 * Ah, you want to have one installation of WP but have multiple sites?
 *  Thread Starter [Jeff](https://wordpress.org/support/users/jmf/)
 * (@jmf)
 * [22 years ago](https://wordpress.org/support/topic/customize-for-mult-users/#post-53398)
 * YeahYeah! That’s it! (Can I do it?)
 *  [unteins](https://wordpress.org/support/users/unteins/)
 * (@unteins)
 * [22 years ago](https://wordpress.org/support/topic/customize-for-mult-users/#post-53407)
 * My investigations into the topic say….Yes and No.
    It would be possible to hack
   WP to do this, it wouldn’t even be terribly difficult I don’t think. However,
   there would be several issues to contend with, not the least of which is what
   to do when the next WP version comes out. There are some possibilities that using
   a combination of Apache and a little php trickery you might be able to have essentially
   100 copies of WP, but not really. I remember reading somewhere that multiple 
   blogs were a feature that was either planned or under consideration. When do 
   you have to get the whole thing up and running by?
 *  Thread Starter [Jeff](https://wordpress.org/support/users/jmf/)
 * (@jmf)
 * [22 years ago](https://wordpress.org/support/topic/customize-for-mult-users/#post-53423)
 * Hmm…I’m looking at next school year, so, by August. Perhaps I’ll just sit tight
   for now. Thanks!
 *  [Sushubh](https://wordpress.org/support/users/sushubh/)
 * (@sushubh)
 * [22 years ago](https://wordpress.org/support/topic/customize-for-mult-users/#post-53445)
 * its in the todos…
    the current method can be messy… i got 4 blogs running on 
   a single site and it’s messy.
 *  [unteins](https://wordpress.org/support/users/unteins/)
 * (@unteins)
 * [22 years ago](https://wordpress.org/support/topic/customize-for-mult-users/#post-53458)
 * Here is a quick idea that might even work…just theorizing, again it wouldn’t 
   be too painful if you are on a *nix and know a tiny bit of shell scripting. It
   actually would be fairly upgradeable too.
    Here is what I would propose you give
   a try: Install WP in a location and use this as your “main” install. Go through
   the setup procedure, so create something like [http://www.ferrellweb.com/blogs/JMF/](http://www.ferrellweb.com/blogs/JMF/)
   Once that blog works here is how I think you can create a student’s blog without
   too much pain. Create a new directory that is [http://www.ferrellweb.com/blogs/SomeStudent/](http://www.ferrellweb.com/blogs/SomeStudent/)
   Place the wp-config.php and wp-layout.css file in that directory. Change the 
   wp-config.php line with the table prefeix to be something like wp_SomeStudent_
   instead of wp_ or wp_JMF_ (depending on how you set it up the first time) Ok,
   now comes the shell script. You need to make symlinks from the student directory
   to the main WP directory. this should let WP find the files it needs and allow
   you to have custom setups per student without having to have 100 copies of the
   files. It would also allow you to add hacks/plugins as needed. Of course, it 
   doesn’t help with massive proliferation of tables in the database, but that requires
   a lot more hacking.
 *  Thread Starter [Jeff](https://wordpress.org/support/users/jmf/)
 * (@jmf)
 * [22 years ago](https://wordpress.org/support/topic/customize-for-mult-users/#post-53911)
 * Mrah…it’s been a while, so I don’t know if anybody’s still looking, but let me
   throw in an update, for the record. I’m not sure if I can explain this clearly,
   but here goes:
    I installed a main blog at [http://www.ferrellweb.com/wordpress/](http://www.ferrellweb.com/wordpress/)—
   fine. Then I created a directory, [http://www.ferrellweb.com/blogs/student5/](http://www.ferrellweb.com/blogs/student5/)(
   well, it’s 5 now… ;-). Initially (I hope I’m remembering this correctly…) I made
   symlinks from the /student5/ directory to the /wordpress/ directory. Then I threw
   out config.php in /student5/, and put a new one in, with the table prefix changed
   to wp_student5_. I called up [http://www.ferrellweb.com/blogs/student5](http://www.ferrellweb.com/blogs/student5)
   in a browser, and it ran me through the install business! Woo! To make a long
   story short, whatever I had done there *seemed* to work–it even created the student5
   tables in the database, right alongside the default tables from the main install.
   But somehow the config.php and layout.css files were still linked–any changes
   I made to layout.css in one affected the other. SO, I started from scratch. This
   time, I REMOVED wp-config.php and layout.css from the /wordpress/ directory–the
   main install. THEN I made the rest symlinks in /student5/ (I’m just using something
   like ln -s ~/www/wordpress/* ~/www/blogs/student5). Once I had my symlinks, I
   placed nice clean copies of wp-config.php (set up with a wp_student5_ prefix)
   and a layout.css file in the /student5/ directory, and hit it with a web browser.
   Here’s where it gets sticky: Now I get the “There doesn’t seem to be a wp-config.
   php file…” message, when there IS a wp-config.php file sitting right there. The
   only thing I have to go on it this–right now, there is NO wp-config.php file 
   in the MAIN INSTALL directory. If I PUT a wp-config.php file in /wordpress/, 
   THEN I get the message “It doesn’t look like you’ve installed WP yet. Try running
   install.php.” VERDICT: I’m missing something (maybe). Something in the /student5/
   directory is kicking it back into /wordpress/ to look for config.php, instead
   of looking for the new one in /student5/. My prime suspect is wp-blog-header.
   php, but I’m not sure what to modify there to get it to look in the right directory,
   or even if I SHOULD. QUESTION: Would there be a problem if I just configured /
   student5/ from /wordpress/wp-config.php, as long as the table prefix was different
   each time? Would the rest work anyway? (All I really need, I guess, is for each
   to read a DIFFERENT layout.css file…nothing else matters.) BUT, would I run into
   the same problem with /student5/ trying to read /wordpress/layout.css instead
   of student5/layout.css? I’m off to find out the hard way, but I’d appreciate 
   any insights…I’m sure I’ll be stuck shortly.
 *  [wnp](https://wordpress.org/support/users/wnp/)
 * (@wnp)
 * [22 years ago](https://wordpress.org/support/topic/customize-for-mult-users/#post-53912)
 * The problem with the symlink method of creating multiple blogs is that wp-login.
   php finds the wp-config.php file by doing a dirname(__FILE__) call and then appending“
   wp-config.php”.
    This gets the REAL directory where that file resides, not the
   directory where the currently used symlink is located — and voila, we’re messed
   up. So right now I am trying this out with dirname(__FILE__) removed from wp-
   login.php; since wp-login.php is in the same directory as wp-config.php this 
   should not really matter. Another potential problem is that references with “..”
   refer to the REAL parent directoy rather than the symlink; so at least the directories
   must not be symlinks but actual directories. I’m appending a perl script which
   does this; make sure you adjust some of the vars at the top. And remember to 
   remove the call to dirname at teh top of wp-login.php. Wolf Paul makeblog script:—-
   cut here —- #!/usr/bin/perl # Turn this off if you don’t want output $Debug =
   1 ; # This should be the directory of the original WP installation $BLOGSRC =“/
   var/www/html/wordpress” ; # This should be the directory in which you want to
   create the new blog $BLOGBASE = “/var/www/html/blogs” ; # this is the user who
   should own all the files in the new blog $WEBUSER = “apache” ; die “Usage: $0
   new_blog_name\n” unless $ARGV[0] ; # New blog name is specified on the commandline
   $NEWBLOG = $ARGV[0] ; # perl chown needs numeric args $webuid = (getpwnam($WEBUSER))[
   3] ; $webgid = (getpwnam($WEBUSER))[4] ; # create new blog dir mkdir(“$BLOGBASE/
   $NEWBLOG”) ; # go to original blog chdir($BLOGSRC) ; # get a list of all subdirs—
   sorry, I’m too lazy to do this in perl open(DIRS, “find . -type d -print|”) ;
   while ( <DIRS> ) { chomp ; s/^\.\/// ; # that’s cosmetic, it would work anyway
   $dir = $_ ; # that’s also just for comprehension, we could use $_ directly print“
   DIR is $dir\n” if $Debug ;; mkdir(“$BLOGBASE/$NEWBLOG/$dir”) unless $dir eq “.”;#“.”
   already exists, so we dont need to make it chown($webuid,$webgid,”$BLOGBASE/$
   NEWBLOG/$dir”) ; [@files](https://wordpress.org/support/users/files/) = <$BLOGSRC/
   $dir/*> ; foreach $file ( [@files](https://wordpress.org/support/users/files/)){
   if ( -f $file ) # discard subdirs { $basefile = $file ; $basefile =~ s/$BLOGSRC\/
   $dir\/// ; print “\tLinking $file\n\t\ttto $BLOGBASE/$NEWBLOG/$dir/$basefile\
   n” if $Debug ; symlink($file, “$BLOGBASE/$NEWBLOG/$dir/$basefile”) ; } } } close
   DIRS ; # These three files are good to have locally (in fact, wp-config.php cannot
   be a symlink) foreach $file ( “index.php”, “wp-config.php”, “wp-layout.css” ){
   print “Unlinking $BLOGBASE/$NEWBLOG/$file\n” if $Debug ; unlink(“$BLOGBASE/$NEWBLOG/
   $file”) ; print “Copying $BLOGSRC/$file\n\tto $BLOGBASE/$NEWBLOG/$file\n” if 
   $Debug ; &copy(“$BLOGSRC/$file”, “$BLOGBASE/$NEWBLOG/$file”) ; chown($webuid,
   $webgid,”$BLOGBASE/$NEWBLOG/$file”) ; } sub copy { ($src,$targ) = [@_](https://wordpress.org/support/users/_/);
   open(SRC, $src) or die “cannot open $src for reading” ; open(DST, “>$targ”) or
   die “cannot open $targ for writing” ; while ( <SRC> ) { # this adjusts the table
   prefix to include teh name of teh new blog if ( /^\$table_prefix = / ) { print
   DST “\$table_prefix = ‘wp_${NEWBLOG}_’; // example: ‘wp_’ or ‘b2’ or ‘mylogin_’\
   n” ; next ; } print DST ; } } —- cut here —-
 *  Thread Starter [Jeff](https://wordpress.org/support/users/jmf/)
 * (@jmf)
 * [22 years ago](https://wordpress.org/support/topic/customize-for-mult-users/#post-53914)
 * Wow. Forgive me, but I can barely scratch my way through all this stuff. What’s
   the usage for this like? Obviously adjust the paths for BLOGSRC and BLOGBASE 
   to reflect my setup… WEBUSER should be my account username, I assume? Save as
   a .pl file and upload to the root of my account? Chmod to something executable?
   755 or something? What syntax do I need to use to kick it off from the command
   line? I can see the *basics* of what it does, but with PHP and Perl I’m still
   about one step past “hello world!” as far as my own coding expertise goes. 😉
 *  [wnp](https://wordpress.org/support/users/wnp/)
 * (@wnp)
 * [22 years ago](https://wordpress.org/support/topic/customize-for-mult-users/#post-53922)
 * O.K., I spent some more time on this.
    Unfortunately the script as posted last
   night does not do the trick, because it turns out that even when the directories
   are real (not symlinks), the reference “..” refers back to the REAL parentdirectory
   of the file. So I now have a modified version (all it really does is replace 
   the “symlink” function call with “link”) which creates the directory structure
   and then hard links all of the files. This way everything seems to work (tested
   it quite extensively). It still makes index.php, wp-config.php and wp-layout.
   css separate local files. One other change I made was to optionally set $tableuser
   in wp-config.php and wrap the corresponding line in wp-settings.php in an ‘if(
   $tableusers == “” )’ — this way one can use ONE usertable for multiple related
   blogs (i.e., I have an English and a German blog). To answer the questions posed
   by JMF (sorry, I forget that people have different levels of acquaintance with
   code :-): 1. Since links are a UNIX feature, this will only work on a UNIX-like
   OS (i.e. any real UNIX, Linux, BSD, etc). 2. Yes, BLOGSRC and BLOGBASE need to
   be changed to reflect your setup; WEBUSER is the user under which your Apache
   webserver runs, not YOUR account. Usually it will be something like “apache” 
   or “web” or “httpd”. If you put the following code into a file in your web root,
   say “getinfo.php” and then view it with your browser, you can scroll down to 
   the “APACHE” section and find the User/Group values about six rows down: ` <?
   php // Show all information, defaults to INFO_ALL phpinfo(); ?>  3. Download 
   the PERL script from [http://www.doulos.at/makeblog.pl](http://www.doulos.at/makeblog.pl),
   edit it as described above and upload it to your webserver (make sure you save
   it in UNIX format, i.e. only newlines rather than CR/NL at the end of lines).
   Then make it executable with “chmod +x filename”. 4. It is advisable to think
   carefully about any mods to the distributed wordpress which you want to have 
   in ALL blogs, and to make these to the master copy before creating “clones” with
   makeblog. 5. Call the script at the commandline as “makeblog.pl NEWBLOGNAME” 
   which will put the new blog into a subdir called NEWBLOGNAME in the BLOGBASE 
   directory, and will also modify the new blog’s wp-config.php to use wp_NEWBLOGNAME_
   as the table prefix. 6. Run the new blog’s wp-admin/install.php and you’re done.
   7. I suspect that after an upgrade (minor upgrades at least) to WordPress you
   can just save any modified index.php, wp-layout.css, and wp-config.php files 
   for each blog, delete the individual blog subdirs, and then re-create them from
   the updated master with makeblog. If you used the same NEWBLOGNAME, you then 
   just need to copy your saved files back, and the blog should work with the new
   code and the old database tables without running install.php again.
 *  Thread Starter [Jeff](https://wordpress.org/support/users/jmf/)
 * (@jmf)
 * [22 years ago](https://wordpress.org/support/topic/customize-for-mult-users/#post-53923)
 * That sounds awesome! And thanks for the detailed instructions. 😉 Unfortunately,
   I can’t grab the file…it tells me it doesn’t exist. 🙁 I’ll give it a try later,
   and see if it’s some connection problem…
 *  [wnp](https://wordpress.org/support/users/wnp/)
 * (@wnp)
 * [21 years, 12 months ago](https://wordpress.org/support/topic/customize-for-mult-users/#post-53935)
 * Sorry, I forgot that the .pl extension will try to execute as a cgi-program,
   
   but EXEC-CGI is turned off for that directory. I have renamed the file to [http://www.doulos.at/makeblog.pl.src](http://www.doulos.at/makeblog.pl.src),
   just download and then rename to makeblog.pl.

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘Customize for Mult. Users’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 14 replies
 * 6 participants
 * Last reply from: [wnp](https://wordpress.org/support/users/wnp/)
 * Last activity: [21 years, 12 months ago](https://wordpress.org/support/topic/customize-for-mult-users/#post-53935)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
