Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a php/mysql based site with users segregated into different groups... i want to add blogging system to it so that each group has its own blog which can be authored by users who are designated to administer that group and can be read by each user of that group... how can this be done?

share|improve this question
add comment

2 Answers

Is that "php/mysql based site" a self-done script or do you use a finished software. In the latter case, there maybe exists a connector to Wordpress. But Wordpress isn't really pluggable into other CMS'.

One other way I can think of, is into "fooling" Wordpress, by replacing its user tables (using the same database as your website) with views of your user-tables. SO it really works on your users, with their respective rights, while all blogging content would be saved to Wordpress' own tables.

Though, using Wordpress itself as a CMS, and then also using its blogging-features would be the "best" way (if you have a chance to change your underlying system and migrate all the old pages to Wordpress).

share|improve this answer
add comment

I haven't been working with WordPress too much, so there may be someone who can give you more details. But here's what I've come to understand:

If you want to have multiple blogs (one for each group) then you need to EITHER:

  1. Filter the posts according to who is logged in
  2. Operate a multi-site WordPress install

The former could be done as part of the plugin that I will explain later, the latter can be done using WordPress core - although it will not be able to dynamically create these new blogs if a new user group were added.

As far as having users logged into your own website recognized as authenticated in WordPress, you would need a plugin that loads after WordPress's own user authentication. If you load before WordPress's user authentication then you would verify they were logged in and WordPress would immediately over-write this saying that they were not. The init hook would work best for this (http://codex.wordpress.org/Plugin_API/Action_Reference)

add_action('init', 'load_my_user');
function load_my_user(){
    /* Determine the user ID and name of who is logged in*/
    /* You should know how to do this for your website */
    wp_set_current_user($id, $name);
}

If the user does not exist then WordPress should create it, so if user registration is disabled in WordPress (done via the Dashboard) to prevent an ID collision then your users should be able to immediately take advantage of this and log in.

As for filtering the returned posts according to group, I'm not entirely sure how that would work, but I suspect it would involve the pre_get_posts or posts_selection hook. In fact, it may even be possible to do this using WordPress core features. I'm really not clear on this much. But the above should help you at least log in to WordPress with your current user database =)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.