• Services
  • What we do & Sell own
  • Cases
  • We are

Helpdesk

1. Functionality

1.1. Function

The module provides an option to mark content as spam. Site users can complain on profiles, listings or any other dynamic content. Every spam notification refers to certain types of content used by the module. Depending on settings in the admin panel, spam notification can include a reason and user comment. Types of spam notifications and reasons why an object is marked as spam are set up in the admin panel.

1.2. Admin mode

There are lists of spam notifications, content types and spam reasons in the admin panel. The list of content types includes GID, form type, status, send notification, date added and edit option. Content types can be edited only.

Content types can be added or deleted only during the installation with the help of module methods that want to be spammed.

Each type of content can be edited in the following way:

  • Form type:

◦ Button (yes/no)

◦ Drop-down with spam reasons and a text field

  • Send notifications to admin about new spam alerts
  • Status (active/inactive)

Apart from these settings, the database contains a method of reverse callback (module, model, method) to do the following:

  • Delete an object
  • Mark/unmark object as spam
  • View content in a new window
  • Retrieve a block for displaying alert details

Besides, there is statistics for every type of content about spam alerts – total number of alerts and alerts awaiting approval. Statistics is updated each time a new alert is submitted, updated or deleted.

The list of spam alerts is divided into tabs that sort alerts by types of content. Each tab includes name of the user who marked content as spam; alert details received with the help of callback method; spam reason; date added and actions.

The actions are:

  • delete (there is a callback);
  • mark/unmark object as spam (there is a callback);
  • view (there is a callback);
  • delete alert.

If the content object is deleted, the method returns an empty string. Spam module updated the empty string to ‘object is deleted’ message and displays an option to delete the alert.

When a content object is deleted, a callback method is processed – it returns an error or nothing. In case of an error, it is displayed in a browser window, in other way the alert is deleted and a message of a successful action appears.

When a content object is marked/unmarked as spam, the callback method returns a status (marked as spam, unmarked as spam, deleted). Depending on the status, the actions vary:

  • if response includes errors, the errors are added to the end of the error-message;
  • if an object is marked as spam, there is an option to unmark content as spam;
  • if an object is unmarked as spam, there is an option to mark as spam back;
  • if a content object is deleted, the module takes further actions on itself – it may delete the content object along with the spam alert and return a message ‘the module does not provide an option to change the content status’

Spam reasons are displayed in a list view, their order can be changed with the help of drag&drop tool. The following action are available: add new reason, edit reason, delete.

Admin dashboard includes information about number of objects marked as spam or awaiting approval.

1.3. User mode

There is an option to mark content as spam in user mode, if spam feature is enabled for a content object in admin panel. A complaint form is loaded with the help of AJAX-script. The form includes a list of spam reasons and a text area for additional comments. Controller method returns either an error or a notification about successfully completed action. The modules that provide the content display the objects marked as spam.

1.4. Related modules

The module uses the functionality of the following related modules:

  • notifications — sends spam notifications;
  • ausers — permissions of moderators.

1.5. Functionality related to other modules

The module functionality can be used by any module to add the ability to mark content object as spam. To do it, during the installation the module must create a new type of object for spam module. To be able to perform actions, the module should include the method of reverse action. Spam module supports helpers to display an option to mark content as spam. Helper retrieves object id and gid of spam type.

1.6. Specific functionality

No specific functionality.

2. Implementation

2.1. API

API controller (Spam_api) includes two methods:

public function mark_as_spam();

Marks an object as spam. After successful validation of incoming data, spam alert is created and expects a decision of site administrator. Administrator receives a notification about a new spam alert, if notifications are set up in the admin panel.

POST parameters:
$data array – spam object ddetail. Keys of the array: id_object – content object id, id_type – guid of spam type (users, listings, reviews), id_poster – id of user who marked object as spam

public function get_alert_status($id);

Returns spam status of the object with the specified id. ‘Message’ field contains text description of the status.

Parameters:
$id integer — spam alert id