Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product

In this Discussion

Please upgrade to 2.3 here. The 2.2 and earlier branches are no longer being updated.

Q&A Code Questions

This discussion is related to the Q&A addon.

I am looking at the following section of code:

      Gdn::SQL()->Replace(
         'ActivityType',
         array('AllowComments' => '0', 'RouteCode' => 'question', 'Notify' => '1', 'Public' => '0', 'ProfileHeadline' => '', 'FullHeadline' => ''),
         array('Name' => 'QuestionAnswer'), TRUE);
      Gdn::SQL()->Replace(
         'ActivityType',
         array('AllowComments' => '0', 'RouteCode' => 'answer', 'Notify' => '1', 'Public' => '0', 'ProfileHeadline' => '', 'FullHeadline' => ''),
         array('Name' => 'AnswerAccepted'), TRUE);

What exactly do these two sections do?

Comments

  • rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one" NY ✭✭✭

    @Rangerine - I'm away from my desk so I'm answering on my phone from my faded memory just to give you some pointers even though I don't know the specific answer without further looking it up... You should be aware that Vanilla (actually Garden, the core on top of which Vanilla is coded) uses the SQL object to build various queries and then execute them. That's called the query builder. It is also possible to issue SQL directly. When you use the query builder you need to ensure that you don't interfere with a SQL query that was prepared earlier for another process to execute, so clone the SQL object and reset it. There's a discussion in which I asked about figuring out the columns of a table and the feedback contain good explanations.

    hgtonight
  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    You can learn a lot when looking at the code:
    https://github.com/vanilla/vanilla/blob/master/applications/dashboard/settings/structure.php#L482-490

    Those 2 sections create (or update) the ActivityType table. You can create custom activities that will be shown in your forums /activities list or only in the activities of a user. They can be commentable or not. Look at the table GDN_ActivityType for examples.

    With a simple Notify => 1 you can make use of Vanillas notification mechanism. If you don't want that the regarding user is notified, choose Notify => 0.

    You can change some values of this table in your test installation and see what happens. Only newly created activities will be affected, though.

    hgtonight
Sign In or Register to comment.