1. REGISTRATION REQUIREMENTS:

    Register with your xenforo.com Username then start a conversation at xenforo.com w/Bob and provide the following:
    1. Your XenForo License Validation Token
    2. The Domain Name associated with the License
    NOTE: Your account will be validated once ALL requirements are verified/met. Thank you for your patience.

Implemented Category Option: Article Image Required

Discussion in 'AMS Closed Suggestions' started by Bob, Jan 6, 2017.

  1. Bob

    Bob Developer Staff Member

    As per title, there is a new Category Option "Article Image Required". This is a SUB Option to the existing Article Options: "Allow Articles to be created" (as it only applies to the create process).

    Default is disabled (as it is a sub option), so you will need to Enable this for all your categories that you want to force this on.

    Selection_671.png

    When the "Article Image Required" is enabled and you try to create an Article without an IMAGE attachment, it will throw an error message.

    Selection_670.png

    NOTE: YES, there is a query you can run to SET this option for Categories that the "Allow Articles to be Created" is Enabled.

    Code:
    UPDATE xf_nflj_ams_category SET article_image_required = '1' WHERE allow_articles = '1'
     
  2. Bob

    Bob Developer Staff Member

    IMPORTANT DEVELOPER NOTE: The Article DataWriter has some CHANGES that effect INSERTS.

    There is a CONSTANT (const DATA_REQUIRE_ARTICLE_IMAGE) that is used to set a TRUE or FALSE on (default is TRUE if nothing is passed in).

    This is used during the create article process to tell the datawriter to check during Pre Save whether or not the Article contains an uploaded IMAGE. Here is an example of how I am using it (passed in before Pre Save().
    PHP:
    $writer->setExtraData(NFLJ_AMS_DataWriter_Article::DATA_REQUIRE_ARTICLE_IMAGE$category['article_image_required']); 

    There is another CONSTANT (const OPTION_ENFORCE_REQUIRE_ARTICLE_IMAGE) this is used to set a TRUE or FALSE on (default is TRUE is nothing is passed in).

    This is used in situations where an image might be required, but you don't want to force it because of IMPORTING or CONVERTING or other types of DYNAMIC Article creation (from RSS Feeds). This will override the PreSave check allowing the article to be created without an image even when the category requires it.
    PHP:
    $articleDW->setOption(NFLJ_AMS_DataWriter_Article::OPTION_ENFORCE_REQUIRE_ARTICLE_IMAGEfalse);

    If you have Addons that deal with Article Creation, you should probably let your Developer(s) know about this!