Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Q&A Code Questions

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

  • Options
    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.

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    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.

Sign In or Register to comment.