Support » Themes and Templates » Two wordpress one database 1 login for all users.

  • Hi i am trying to use two different wordpress themes on a single blog, i understand that i could use a single database as long as i have a different prefix for each blog installation.

    Now the big question is there anyway i/all my users can use the same user/pass on those 2 blogs?. without having to register twice?

    blogs will be like this..
    mainblog/video gallery theme.

Viewing 15 replies - 1 through 15 (of 24 total)
  • If you install WordPress twice in the same database, only with a different prefix you’re still gonna have 2 blogs with separate users there’s no way around that. I’m afraid you’re looking for a solution to your problem in the wrong place.
    You see the database only stores the content, IE the text. The themes contain the presentation of that content and has nothing to do with the database.

    If you however merge the style.CSS files of 2 different themes you can create specific templates that look like a completely different theme. You can check of there’s a plugin that will do that but I don’t know of one myself. I don’t think there is a quick theme switch solution for you here. You’ll have to make templates and majorly modify your theme

    i got the issues worked out.

    i installed the main blog and have another wordpress installed on the same database with a different prefix, then i integrated the logins together.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Put them both in the same database with different prefixes. Then choose one of them to be the master user table. Then do this in both wp-config.php files:

    define(CUSTOM_USER_TABLE,'wp_users');
    define(CUSTOM_USER_META_TABLE,'wp_usermeta');

    Replace the wp_ with the prefix you want, obviously.

    That is so cool Otto42.

    I have been planning a new site (you’ve answered another login question about it before — importing the users from an older blog).

    This technique is going to make it much better for my users. I’ll have 5 blogs to start (using the VMB, Virtual Multiblog technique), more to be added later, and only some of the users will care about all the blogs. Some users just care about 1. It will be so much better for me and some of the users to have just 1 user table for all the blogs.

    The only worry I have — would you know? VMB technique uses basically one wp-config file for all the blogs. I’m going to put those 2 lines of code in the one wp-config file (changing the prefix wp to be the prefix of my master blog). It should work. All the VMB blogs reference that same config file, basically.

    Well, I stand corrected. I had no idea that was possible. My bad.

    @otto42 *humbly* thanks for the lesson, I might actually need to use that someday.

    while im at it how about cookie sessions?

    so if you login in to one your logged in to other

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    vurea: You don’t. You can’t share cookies like that across multiple domains.

    otto42 i found a post which was posted by you which stated

    WordPress does not use sessions, and if the URL’s of the two sites are on different domains, then the cookies cannot be passed from one to the other (browser security restrictions). Therefore what you want is not possible in such a case.

    In multiple folders on the same domain, it can be done, as shown by the link given above.

    In multiple folders on the same domain, it can be done, as shown by the link given above.

    this is what im tryign to do. they are on the same domain, different folder.

    one is on http://www.site.com other is on http://www.site.com/folder/

    anyway to make it so if i logon to site.com it would log me on automatically at http://www.site.com/folder/ ?

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Did you happen to follow the link given in that thread?

    yes i did otto it doesnt seem like its working for 2.6.2 .

    any other solutions?

    Why not one blog one database. Add the video theme stylesheet to the mainblog theme renaming it videostyle.css then edit and add the page.php template from the video theme into the mainblog theme as a custom page template. Create a page named video and assign it the custom page tempale you just added. Put a conditional statement in the header.php to switch style sheets when on that page.

    <?php if (is_page('videopageidhere')) { ?>
      <link rel=”stylesheet” type=”text/css” href=”<?php bloginfo(’template_url’); ?>/videostyle.css” />
      <?php } else { ?>
      <link rel=”stylesheet” type=”text/css” href=”<?php bloginfo(’stylesheet_url’); ?>” />
      <?php } ?>

    If you want the page to show posts assigned to a the category “video” integrate this code into the loop for the video custom page template to enable pagination.

    <?php
    $limit = get_option('posts_per_page');
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('cat=videocategoryidhere&showposts=' . $limit=5 . '&paged=' . $paged);
    $wp_query->is_archive = true; $wp_query->is_home = false;
    ?>
    <?php while (have_posts()) : the_post(); ?>
    <!--Do Stuff Here-->
    <?php endwhile; ?>

    – EM HR

    Forgot to mention the single pages for this category could be likewise conditionally styled in the header.php using (is_single('') && in_category('catidhere')) and the single.php will need a conditional double loop to reflect the markup changes between the themes and their respective stylesheets.

    let me give that a try. so using this method i could use preety much two themes in one blog ?

    could you be more descriptive kind of noobie doing this:P

    i know i could define page template by adding a line on top of the php file but how would i add a whole theme as a page template such as unique header.php, index.php etc etc.

    regardless im gonna give this a try:P

    If I’m hearing you correctly, you want to use one theme for the majority of your site and one theme just for a section of the site for a video gallery. I am suggesting you combine and edit the template files from two themes, thus creating a singular custom theme that switches stylesheets according to what page, category archive or single-post page of the site you’re on.

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘Two wordpress one database 1 login for all users.’ is closed to new replies.