WordPress.org

Support

Support » Plugins and Hacks » [Resolved] How Co-Authors Plus stores information in the database

[Resolved] How Co-Authors Plus stores information in the database

  • kylehardgrave
    Member

    @kylehardgrave

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mohammad Jangda
    Participant

    @batmoo

    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.

    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.

    kylehardgrave
    Member

    @kylehardgrave

    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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] How Co-Authors Plus stores information in the database’ is closed to new replies.