• Resolved rogerw

    (@rogerw)


    I posted this question in the Help & Troubleshooting section but it seems it should be here instead.

    Iam looking to install WP for a member area of a site (subscription-based), wanting only premium members to have access to the blog. Permission levels currently exist in a MySQL database for the Member Area (site is run by PHP), with certain pages viewable to different member levels.

    Will I be able to have WP check permission levels from that existing database or will I need to set up an additional MySQL database and attempt to “mirror” permission levels in order to filter only the premium members?

    I want only the premium members of the service to gain access to the blog, and have it automatically updated (cron) when members cancel or new ones sign up.

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    It would be possible to write a plugin or edit the blogs theme in such a way that it would check your existing database for the proper user permissions before displaying anything.

    It’s hard to be any more specific than that. You’d need somebody who knows PHP, databases, SQL, WordPress to at least some degree, and your existing site structure.

    Thread Starter rogerw

    (@rogerw)

    Thx Otto for your input!

    My programmer knows PHP, databases, SQL and existing site structure in and out, but isn’t familiar with WP (not a blogger I guess!). Thought I’d check here to find the missing link (WP help) so that he can get to work on this.

    Good to know you think it’s possible though. So you’re sayin’ there’s a chance!….

    The search continues.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Ahh. Okay. Basically, he’s going to write a WordPress Plugin. Doesn’t have to be a fancy one.

    When this plugin executes, it’s going to do the following:
    a) Check that the user is able to see the blog (however he wants to check on that), and
    b) If not, display something other than the blog (like a “you must be a premium member” page) and then exit();. Exiting early like this will prevent the blog from continuing past that point.

    Since plugins get loaded and run before any of the blog actually gets displayed, this will effectively limit access to the blog.

    Writing a plugin is easy. It’s basically just PHP with a special comment at the top of it. Tell him to look here for how to write a plugin: http://codex.wordpress.org/Writing_a_Plugin

    Thread Starter rogerw

    (@rogerw)

    Otto,

    Thanks so much! THAT is what I needed to know. Looking forward to passing this along and I sure appreciate your help! One day I’ll pay it forward if I get some know-how 😉

    What about limiting certain posts, say, by Category, to only those persons who have subscribed to the blog AND have paid for the subscription-based content. I’m thinking the plugin would also have to:

    a) Check the user to see if they have also subscribed to the pay area (can this be done during logon and saved as a session variable?)

    b) Check during the “For Each” in the comments.php file (I think that’s where it is) to check each post to see if it is in that pay area and that the user subscribes to that area. If it’s a pay post and the user is not subscribed, the post can be skipped or not set as a link or something…

    That’s a little more complicated but would that integrate the pay site in with the blog instead of creating a 2nd blog for the pay site?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Integrate WP with existing database’ is closed to new replies.