WordPress.org

Ready to get started?Download WordPress

Forums

Co-Authors Plus
[resolved] How Co-Authors Plus stores information in the database (4 posts)

  1. kylehardgrave
    Member
    Posted 3 years ago #

    I'm trying to transfer a blog from Drupal to WordPress, and I'm using Co-Authors Plus to handle multiple authors. However, for transfering the MySQL databases, I cannot figure out where Co-Authors Plus stores its authors information. Could someone explain to me how Co-Author's Plus handles authors in its database management, and what table (in the WP database) they're in, etc.?

  2. Mohammad Jangda
    Member
    Plugin Author

    Posted 3 years ago #

    They're stored as terms. Each user has an associated term in the author taxonomy based on their username.

    SO if my username was kylehardgrave, I would have a term for the author taxonomy called kylehardgrave. To add authors to posts, you just assign their associated terms to the post. If you're going to do a bulk import, you can probably use the add_coauthors function, e.g.

    $post_id = 1;
    $authors = array( 'kylehardgrave', 'anotheruser' );
    global $coauthors_plus;
    $coauthors_plus->add_coauthors( $post_id, $authors );

    Hope that helps.

  3. Jamil Jonna
    Member
    Posted 3 years ago #

    Hello, can you explain exactly how you'd use this function? I that you'd run something like the following:

    function add_my_coathor() {
    $post_id = 1;
    $authors = array( 'kylehardgrave', 'anotheruser' );
    global $coauthors_plus;
    $coauthors_plus->add_coauthors( $post_id, $authors );
    }

    But where exactly do you run it? I've used the INSERT INTO and WHERE commands in MySQL to perform this kind of modification but I don't understand how you'd run a PHP function. Do you just need to include it functions.php once?

    Also, what if I want to remove the previous author first? By default, my bulk imported posts have an admin is the author.

  4. kylehardgrave
    Member
    Posted 2 years ago #

    Thanks Mohammad, that helps.

    Jamil, you could either write a PHP script and run it by accessing it from the browser or by setting it up to run when you hit a button. You could also just use the info to help you write your SQL statements.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic