WordPress.org

Ready to get started?Download WordPress

Forums

Two wordpress one database 1 login for all users. (24 posts)

  1. vurea
    Member
    Posted 5 years ago #

    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.

  2. jberghem
    Member
    Posted 5 years ago #

    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

  3. vurea
    Member
    Posted 5 years ago #

    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.

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    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.

  5. Dgold
    Member
    Posted 5 years ago #

    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.

  6. jberghem
    Member
    Posted 5 years ago #

    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.

  7. vurea
    Member
    Posted 5 years ago #

    while im at it how about cookie sessions?

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

  8. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

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

  9. vurea
    Member
    Posted 5 years ago #

    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/ ?

  10. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

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

  11. vurea
    Member
    Posted 5 years ago #

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

    any other solutions?

  12. Gene
    Member
    Posted 5 years ago #

    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

  13. Gene
    Member
    Posted 5 years ago #

    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.

  14. vurea
    Member
    Posted 5 years ago #

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

  15. vurea
    Member
    Posted 5 years ago #

    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

  16. Gene
    Member
    Posted 5 years ago #

    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.

  17. vurea
    Member
    Posted 5 years ago #

    ah yah i can do that no problem only think i wouldn't know how to do is the custom admin options page that themes come with ><

  18. ronchicago
    Member
    Posted 5 years ago #

    maybe someone can help me as i think my answer is in this thread but not sure which answer applies to me...

    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.

    no, one "theme" (literally) with a section that has a different post layout = different header and sidebar placement though all will use common images, users, etc. ( is there a way to have optional layouts for a post? i.e.,
    option 1 ( default) = header 1, sidebar 1
    option 2 = header 2, sidebar 2,3 ) note: different header meaning different nav menus.

    i guess the range of options lies in between...?

    1) ideally one domain, admin, users, theme AND two post layout options
    2) two domains ( domain.com, domain-search.com ), admins, users, and ONE theme slipping seamlessly back and forth

    a lot of good ideas here and i am not skilled enough to sort out what has just been said.

  19. ronchicago
    Member
    Posted 5 years ago #

    maybe someone can help me as i think my answer is in this thread but not sure which answer applies to me...

    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.

    no, one "theme" (literally) with a section that has a different post layout = different header and sidebar placement though all will use common images, users, etc. ( is there a way to have optional layouts for a post? i.e.,
    option 1 ( default) = header 1, sidebar 1
    option 2 = header 2, sidebar 2,3 ) note: different header meaning different nav menus.

    i guess the range of options lies in between...?

    1) ideally one domain, admin, users, theme AND two post layout options
    2) two domains ( domain.com, domain-search.com ), admins, users, and ONE theme slipping seamlessly back and forth

    a lot of good ideas here and i am not skilled enough to sort out what has just been said.

  20. ronchicago
    Member
    Posted 5 years ago #

    maybe someone can help me as i think my answer is in this thread but not sure which answer applies to me...

    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.

    no, one "theme" (literally) with a section that has a different post layout = different header and sidebar placement though all will use common images, users, etc. ( is there a way to have optional layouts for a post? i.e.,
    option 1 ( default) = header 1, sidebar 1
    option 2 = header 2, sidebar 2,3 ) note: different header meaning different nav menus.

    i guess the range of options lies in between...?

    1) ideally one domain, admin, users, theme AND two post layout options
    2) two domains ( domain.com, domain-search.com ), admins, users, and ONE theme slipping seamlessly back and forth

    a lot of good ideas here and i am not skilled enough to sort out what has just been said.

  21. ronchicago
    Member
    Posted 5 years ago #

    jberghem, there is a way around having two sites with two different users. it is through navigation menus. site #1 is the user site. site #2, hide all site #2 user links. configure site #2 menu to point to site #1 with user-related menu.

  22. jberghem
    Member
    Posted 5 years ago #

    @ronchicago - Well to give you a proper answer, please tell me what it is you are trying to achieve? There are many different ways of doing things, so the question is not only does it work but also is it the simplest way to do it and the least taxing to the server.

    The rage of options are virtually limitless. One needs to differentiate between the range of options that are technically possible (within or outside of WP) and the range of your personal knowledge of XHTML, CSS, PHP, Domain Server administration, etc.

    In my article "2 Degrees of Separation" I explain why it is important to separate the content (XHTML) and the presentation (CSS). In WP you can use the hierarchic structure to create category templates in which you can not only customize the content but also give a completely different design by attaching a different CSS file to it. Of course you can style users differently and use use CSS to hide things. But it's much simpler to have that XHTML you're hiding not be generated there in the first place. Then you don't have to hide it.
    We're still trying to get everyone to stop using (X)HTML for layout and styling purposes. But we shouldn't go overboard and use CSS to control the content on the page. Each computer language is developed for a certain purpose. Sure it's possible to do the same thing in different languages but one is the best one. I could get one of those big trucks to take my house with me on vacation, or I could just take an RV.

    Please do read the complete thread before presenting a work-around. Your suggestion is completely unrelated to vurea's problem I was replying to.

  23. ronchicago
    Member
    Posted 5 years ago #

    jberghem,

    upon reading this thread again, and again, i see the difference in original vs my question. i have also read several VMB threads.

    that said, i wish to have one site with two distinct sections/functions. one user registration.

    the masthead will be the same for both but the nav menus a bit different, hence the need for a header1 & header 2? anyway that is what i have going at present.

    Section one = e-zine, a blog in a magazine format where posts are stories, longer posts, with comments, forum, a sidebar 1.

    Section two = item finder, where posts are shorter, possibly an excerpt, links to this and that, a sidebar 2.

    the conflict = a) big difference in post content between section 1 & 2 and b) how to categorize, wishing same name but residing in different sections.

    note: concept #1 = two categories with same name to keep visitor in the appropriate section. i thought the categories might have slightly different constructions - " buttons " & " buttons> " each with unique ID.

    i currently have 60 categories, 6 parents with 10 children each, for example. which would double categories in concept #1

    note: we are totally in agreement on how to use xhtml, css, etc.

    i am not a programmmer. however, i can now modify this and that but cannot create this and that. i have access to a former student who is pretty good with php and css though does not code with wp in mind. strictly phpmyadmin and on the server, which keeps her solutions out of wp-admin. so that's a problem in my mind at this early stage of development. maybe its not an issue.

    bottom line, i don't know the " structure models " options available. is it simply one blog with one database. two blogs with one db? two domains with one db seamlessly working together. note: only one domain to be bookmarked, seo target.

  24. ronchicago
    Member
    Posted 5 years ago #

    responding to otto's comment. a little more elaboration for me is required...

    Put them both in the same database with different prefixes. Then choose one of them to be the master user table.

    what exactly is " them " ?

  25. jberghem
    Member
    Posted 5 years ago #

    Hmm.. Yes I see now tricky situation.
    Since you say that you're not a hand-coder, we need to find a simple solution.

    Let me first say you don't need two headers, you just don't put the menu in the header.php.

    The problem is that you have so many (sub)categories. You see, sub categories don't choose their parents template. So you'd end up with 50+ category templates.

    You could maybe go for the multi-user WordPress. You create 2 sub blogs which you can style differently, and you still have administrative accounts that work for all sub blogs, i.e. 1 user account. You even have the option to give each of your sub-blogs it's own sub-domain, i.e. blog1.yourdomain.com, blog2.yourdomain.com

    I think that would be a far simpler solution for you than getting someone to code a custom theme for you with a plethora of custom template files to get it just the way you want it. It would be more manageable than two separate WP installs on the same server.

Topic Closed

This topic has been closed to new replies.

About this Topic