Wiki

Clone wiki

q2a-bulk-content-generator-public / Home

BCG - Bulk Content Generator

Description

BCG is a Question2Answer plugin that allows admins to generate large amounts of content on their sites simply by uploading files (.xls, .xlsx, .ods, among other file formats).

Features

  • Create questions, answers and comments taken from a file
  • All posts can be set an author or be anonymous
  • Questions can be set a category, tags and the Q2A extra value, if configured in the site
  • Answers can be selected
  • Ability to disable notifications on the created posts
  • All posts can be set a particular creation date in the past or it can even be generated randomly
  • Administrators can select what user levels can perform imports
  • Very simple installation
  • Upgrade system support: The plugin will be able to properly upgrade from previous versions
  • Simple setup
  • External users support

Note this plugin is not intended to enqueue and schedule questions posting.

Requirements

These are the technical requirements for the plugin to work properly:

  • PHP version 5.2+
  • PHP extension php_zip enabled
  • PHP extension php_xml enabled
  • Q2A core version 1.7.*, 1.8.*

Installation

  1. Copy the plugin directory pupi-bcg into the qa-plugin directory and enable the plugin.
  2. Navigate to admin/pages and add or edit the Import page.
  3. Make sure that:
    1. The Visible for field matches the user level that is allowed to perform imports.
    2. The URL of link field matches pupi-bcg-import.

Sample usage and screenshots

As the interaction with this plugin is mostly focused on file uploads it is important to understand what the files look like and what impact they have in the site. The files can be in .xls, .xlsx and .ods format. Other formats are supported but these are strongly suggested. These files are all spreadsheets where each row represents a post and columns represent a piece of data or setting related to that post.

File structure

The first row of a file will contain all the headings of the columns so the plugin just ignores it. These are the columns/fields that need to be present in the file exactly in the order they appear below:

  • Id: The Id of a post input by the user. It is just a reference in the file and it is unrelated to the final Id the post will have once created. For example, in order to add a comment to a question, the comment needs to know what question it will be attached to. This means the question will need a way to be identified so that is what this column is used for. This field is strongly tied to the field ParentIdInFile. It must be a number greater than 0 and it must be unique in the column.
  • Type: The type of post. It could be either Q for questions, A for answers and C for comments. No other value is possible.
  • ParentIdInFile: The Id to the post in the file that will be the parent of this post. Questions can not have a parent. However, answers and comments need to have a parent defined in this column that will need to match a question or answer with that same value in the Id column. If this field is filled then ParentIdInSite must be empty. It must be a number greater than 0.
  • ParentIdInSite: The Id to the post in the site that will be the parent of this post. This field is very similar to ParentIdInFile but instead of taking the parent post from the file it takes the parent post from an already existing post in the site. This field requires the post Id, which is a number that can be seen in the URL of a question or answer link, for example, http://yoursite.com/413/how-do-birds-fly. If this field is filled then ParentIdInFile must be empty. It must be a number greater than 0.
  • Title: The title of the question. This should only be filled if the post being created is a question.
  • Content: The content of the post. Applies for questions, answers and comments.
  • Format: The format used to create the post. This value is usually set by editors behind the scenes. For example, the basic Q2A editor and viewer does not support HTML and just uses plain text to display posts. Other editors such as the wysiwyg editor that comes with Q2A (CKEditor) support HTML and other editors such as the markdown editor support markdown format. This means the value set in this field depends on the editor used to display the posts. For the most popular editors, it can be markdown for the markdown editor, html for the CKEditor and an empty field (unfilled) for plain text (which is the default for comments).
  • CategoryId: The category Id for the question. This should only be filled if the post being created is a question. The category Id is a number that can be seen in the URL of a category only when editing categories in the admin section, for example, http://yoursite.com/admin/categories?edit=2. If input category exist then the question will be created under that category. If this field is filled then CategoryUrl must be empty.
  • CategoryUrl: The category slug for the question. This should only be filled if the post being created is a question. The category slug is the piece of text generated from the category name that is URL-friendly. It can be found when editing a category in the admin section or in the URL when displaying the posts under a given category http://yoursite.com/questions/category-slug. If this field is filled then CategoryId must be empty.
  • Tags: The tags for the question. This should only be filled if the post being created is a question. The category tags is a comma-separated list of tags.
  • UserName: The username (or handle) of an already existing user in the site. It applies for all kind of posts. If the username contains special characters it can be taken from the URL itself while viewing their profile, for example, http://yoursite.com/users/john doe. If this field is filled then AnonymousName must be empty.
  • AnonymousName: The display name of a user that will anonymously create the post. It is not necessary for this user to exist. This field can be empty. If this field is filled then UserName must be empty.
  • Notify: Defines whether the author of the post will be notified by email of any updates to it. It can be true, false or empty. If empty, it is assumed to be true for registered users and false for anonymous users. This field can not be set to true when the creating user is anonymous.
  • ExtraValue: The custom extra field that can be added to the ask form. This should only be filled if the post being created is a question.
  • DateTimeFrom and DateTimeTo: This two fields work together to generate a single post creation date. It is very important to note that when these fields hold a date and time value the cells in the spreadsheet must be formatted as a date or a date time. There are different combinations of these two fields that generate different results. Here is a table with them:

    DateTimeFrom DateTimeTo Resulting date
    2012-11-28 14:20:15 2012-11-28 14:20:15
    2012-11-28 14:20:15 2012-11-29 14:20:15 A random date and time between 2012-11-28 14:20:15 and 2012-11-29 14:20:15
    2012-11-28 14:20:15 now A random date and time between 2012-11-28 14:20:15 and the current server time
    now The current server time
    any A random date and time between the input provided while submitting the form with the file and the current server time
  • Selected: Whether the answer is selected or not. Applies only for answers. The user selecting the answer is assumed to be the user who asked the question. The time in which the user selects the answer is defined by a delay set while submitting the form with the file.

To ease the setup of a new file to import it is possible to download a sample file from here. It can be used as a reference. Do not add or remove columns. Do not remove the header row. Just replace the example rows and add new ones.

Import form

The import form can be accesed from the admin/import section or clicking on the Import submenu option in the Admin options.

Here is a screenshot of the file submission form:

import-form.png

This is a short description of the components in the form:

  • The first control of the form is the input for the file to import.
  • Minimum amount of minutes to delay and Maximum amount of minutes to delay are both related to dates set with value any. In this case, posts are given a random date. This might result in a question being posted in a given time and an answer posted just a few seconds later or maybe years later. In order to avoid these timing issues, it is possible to define a range to delay the child posts (answers or comments). These fields control how many minutes a child post will be delayed. For example, if an answer is created on 2012-11-28 14:20:15 then a comment to that answer will be created between 30 and 300 minutes after the question's creation date (between 2012-11-28 14:50:15 and 2012-11-28 19:20:15). Additionally, these ranged delay is also applied when selecting answers. Following the same values as before, an answer will be selected between 30 and 300 minutes after its creation).
  • Posts should be created after is a field used to define the oldest date in which a post (actually, a question) that is set to any in the DateTimeFrom field can be created. Mostly applies to questions as the question's children inherit the same date as the question plus de delays.

Once all fields are filled clicking on the Import button will fire a validation of all data and then the post generation. Once it is finished, a message is displayed specifying the amount of posts that have been created.

It is important to note that some web servers have very small file size limits set. This can result in a file not being able to be uploaded. Some of these errors can be detected by the plugin but it is better to avoid them. This can easily be done by knowing your web server's limits and create the files accordingly (less rows means less file size). Alternatively, it is possible to use zip-compressed file formats such as the .xlsx one, which will result in smaller file sizes.

Uninstall

If you need to uninstall this plugin all you need to do is:

  1. Remove the pupi-bcg directory.
  2. Drop all tables starting with the ^pupi_bcg_ prefix where ^ stands for your Q2A config.php settings (which is qa_ by default).
  3. Remove all rows from the ^options table that start with pupi_bcg_.

Support

Technical support must all go through the issues section on this site and be in English.

  • Bugs: if you find a bug or error in the plugin, create a bug issue detailing the steps needed to be performed in order to reproduce the issue. Provide the steps from scratch, i.e., starting just after a clean Q2A setup. Attaching screenshots might be useful too. Also include your PHP, MySQL, Q2A and plugin versions. Make sure you have no other plugin in the qa-plugin directory while reproducing it.
  • New features: feel free to request features using the issues section. Select the enhancement kind in the combobox and explain in detail the feature and why you consider it would be useful to others.
  • Questions and other technical support: create a task issue explaining the situation in detail.

Administrative (all non-technical) issues should go through private message to my profile in the Q2A site. Make sure to provide your email address.

FAQ

  • Do you give refunds in case I end up not liking the plugin?

    No. The reason for this is that not only this wiki is quite descriptive but also the plugin can be seen and interacted with live in the demo site. You can fully test the plugin before buying.

  • Does this plugin create users in addition to posts?

    No, they should already exist in the system.

  • I added several thousand posts to a file. I tried to import them but the process finishes with a blank page or a server error. What's going on?

    It is likely that you have exceeded the amount of information you can send to your own web server, which is unrelated to this plugin. There are 2 values that work together: one is the file size amount that can be attached to the request and the other is the size amount of the request itself. You should not exceed either of those values. Those values are usually around 2MB. You can either increase those values (or ask your web server administrator to do so) or decrease the file size you upload, i.e., reduce the amount of posts being uploaded.

    Another situation that could lead to a blank page or server error could be the amount of time the web server is allowed to run a script. As a reference, free web hosting plans give around 30 seconds. Increasing that value in the web server should solve the issue.

    Here are some (not necessarily all) links to relevant PHP settings:

    Finally, remember that no matter what you set in your server, your hosting company may be enforcing limits that override those values. Make sure to check with them if they are overriding any of those values or if they are limiting any other aspect that would not allow a bulk upload to finish successfully (for example, bandwidth).

  • Plugin is a bit slow when I try to upload several thousand posts. Is there any way to increase the speed?

    The plugin is slow because it needs to make sure the information being uploaded, linked and referenced is present in the site (e.g., making sure referenced users already exist in the site). That is crucial in order to avoid data errors generated by data not well formatted in the file. This means there is no way to increase the speed.

  • Are bug fixes charged separately?

    No. Bug fixes are already included in the price. New features, however, might not be free.

  • Would you mind doing some customizations to this plugin?

    Sure. Feel free to get in touch as explained in the Support section.

Get the plugin

Click here to buy the plugin using PayPal. Make sure to use the PayPal's email address in which you would like to receive the plugin. You will receive it in the following 48 hs after buying it. Bear in mind the email address will be your client identification in the future, in case any support is needed.

Updated