Custom fields and filters of post

Started by davidhs, February 21, 2014, 01:53:17 PM

Previous topic - Next topic

davidhs

#80
Thanks for your warning. I will see Karma Post Rating and I will rewrite my mod if it is possible.

NOTE: I do not find download link for Karma Post Rating. :(

kak2z

About the modifications you have written to the PM.

Новости и слухи Дом 2. Популярные рецепты в рубрике Что приготовить


digger

#83
Some suggestions:

1) Can you add the ability to filter numbers and dates by range?
>х, <y

2) If there is a field with list of items, can you add an option to show in filter only those items that used in this board?
e.g. cities

davidhs

Quote from: digger on November 18, 2014, 05:09:17 AM
Some suggestions:

1) Can you add the ability to filter numbers and dates by range?
>х, <y

2) If there is a field with list of items, can you add an option to show in filter only those items that used in this board?
e.g. cities
I do not know. I will see. Thanks.

davidhs

Quote from: digger on November 18, 2014, 05:09:17 AM
Some suggestions:

1) Can you add the ability to filter numbers and dates by range?
>х, <y

2) If there is a field with list of items, can you add an option to show in filter only those items that used in this board?
e.g. cities
Done.




New version:
1.2     2014-12-16
------------------
! Error in JavaScript code.
! Errors in PHP code.
! SMF 2.0.x: allowedTo('approve_posts') must be used instead of $context['can_approve_posts'].
! Entered values by the user in text box of a combo box with multiple selection can not be duplicated.
! Column width with only one field, in lists of moderation.
! Fields of type select box, radio buttons or checkboxes must have options.
! Empty option of select box must have the label "All" only in filters.
+ SMF 1.1.x: Implemented a generic form of displaying lists, similar to SMF 2.0.x.
+ SMF 1.1.x: Implemented database functions, similar to SMF 2.0.x.
+ Field in administration panel to indicate if quick input field will be show when data are modified.
+ Field in administration panel to add a long description in a custom field.
+ Field in administration panel to add a description in a search field.
+ Field in administration panel to add a long description in a search field.
+ Field in administration panel to indicate if creation date will be show on posted records.
+ Field in administration panel to indicate if last modification date will be show on modified records.
+ Field in administration panel to indicate if only one value per member in groups of type "fields with several values per member" is allowed.
+ Field in administration panel to indicate if is allowed selecting the operator with which apply the filter.
+ Field in administration panel to indicate if one or more filters are hidden under a tag.
+ Field in administration panel to show in filter only those items that used in the current board, if filter is a field with list of items.
+ Fields in administration panel to show statistics in groups of type "fields with several values per member".
+ Permission in administration panel to indicate if a field is used to sort the message index.
+ PHP function in "Show enclosed within text" to display statistics for the group of a message.
+ PHP function in templates to display statistics for the group of a message.
* Reorganization of the fields in the administration panel.
* The filter with text button allows to search loose words (separated by spaces) and/or literal phases (encloused in double quotes).
* The dates of create/modify of a group (left) and actions on a group (right) are shown on the same line.
* The date of create of groups of type "fields with several values per member" are also displayed on WAP.
* When display data posted by users in the groups of type "fields with several values per member", the background color alternates for readability.
* Forum parameter "Number of posts per page in a topic page" is used in lists of moderation.
* Forum parameter "Number of search results per page" is used in lists of search in custom fields.
* If users can not search for posts and topics then they can not search in custom fields.
* The areas with data of groups of type "fields with several values per member" can be displayed unexpanded, expanded or forever expanded.
* The field "Filter the message index" in administration panel is replaced by permissions.
+ SMF compatibility: 1.1 to 1.1.20 and 2.0.9.
@ SMF 1.1.x: List for each group of type "record" are not show on member profile.
@ SMF 1.1.x: There is not Moderation Center, but the global moderators can to control the content posted by users in the groups of type "fields with several values per member".

MESWEB

Nice work!
Quote from: MESWEB on July 21, 2014, 10:25:06 AM
Quote from: davidhs on July 20, 2014, 06:42:58 PM
Do you not found keys "[ ]" on your keyboard? In each country or language is different.

Questions
1. You don't understand me  ;D. I need to add "[ ]" automatic. Example - when You select "Windows XP" from drop down list then subject looks like " [ Windows XP ] "
2. When I first write subject and next select from drop down list then subject is gone. Is there any chance to change this?
3. Is it possible to force a user to chose from drop down list? If he does not select then warning message popup should be displayed.

In Board index there are box with list (I create selectable different items) default of this box is "any" but when I create new message there is no choice to select "any". How can change this?

davidhs

Quote from: MESWEB on December 19, 2014, 08:05:37 PM
In Board index there are box with list (I create selectable different items) default of this box is "any" but when I create new message there is no choice to select "any". How can change this?
This should work.  ??? Can you attach images? Image of setting of your custon field and image of new message where this field is used.

MESWEB

There is a board index with list box default value is "wszystkie"
http://obeznany.pl/index.php?board=75.0

In attachment You see no "Wszystkie" when message is creating.

davidhs

Quote from: MESWEB on December 20, 2014, 04:02:11 PM
There is a board index with list box default value is "wszystkie"
http://obeznany.pl/index.php?board=75.0

In attachment You see no "Wszystkie" when message is creating.
It is correct.

You have a group, Telefony LG, with only one field, Model. Model is a field of type "Select box" with only one option, G3, and this option is the default value of field.

Option G3 of field Mode is the default option. This means that when you create a post with group Telefony LG, the field Mode takes the default value (G3). You can not select an empty option on this field because in settings you are selected "Not empty value".

In filters type "select box" default option is always All. In message index (or board index), is displayed a filter Model with options All (Wszystki in Polish) and the options of the field (in this case only one, G3). Filters are used for see all posts (when you select Model=All=Wszystki) or see post with one model (when you select Model=G3 you will see only posts of model G3).

In order to test this mod you should add more options to field Model (i.e. L3, L4,...) and create posts with different models.

Option All is not a real option of the field Model. Only will be displayed on filters and means "return list with any model". You could add an option Any to field Model but... Does this make sense?

Note: Your are not using the latest version of this mod (1.2). You should update, it has many enhancements! :)

MESWEB

I can't update. Errors:
5.6
5.9
5.10

Can You help me? Here is my file.

davidhs

Quote from: MESWEB on December 20, 2014, 07:19:15 PM
I can't update. Errors:
5.6
5.9
5.10

Can You help me? Here is my file.
First you must uninstall previous version. Can you uninstall without errors?

MESWEB

I can't uninstall coz this errors is showing after uninstall action.

davidhs

Quote from: MESWEB on December 21, 2014, 08:36:02 AM
I can't uninstall coz this errors is showing after uninstall action.
Ok. You should uninstall before other/s mod/s (installed after my mod).

Have you a mod like "best answer"?
1. Uninstall "best answer"
2. Uninstall my mod (if errors attach MessageIndex.php again, perhaps you need uninstall more mods first)
3. Install "best answer"
4. Install my mod (if errors install first my mod and after install "best answer")

MESWEB

Uninstalling Best Answer showing errors too. Can You make better installation file to avoid situation like this?

davidhs

Quote from: MESWEB on December 21, 2014, 03:59:19 PM
Can You make better installation file to avoid situation like this?
Sorry, it is not possible. There are many mods and I can not see all. :(

I suppouse you can not uninstall Best Answer.

Can you modify the file MessageIndex.php of your server? If yes, we can try a manual uninstall of my mod. You are agree?

You say to me the version of my mod (1.0 or 1.1) and check that there is only errors in the file MessageIndex.php when try uninstall
Quote from: MESWEB on December 20, 2014, 07:19:15 PM
5.6
5.9
5.10

MESWEB

I have version 1.1 and when I uninstall with errors what I should do?

Westwegoman

From what I am experiencing, Global Topics also affects this mod if it was installed after. Global Topics is also giving me errors on uninstall so, I'm going to try to work around mine when I get the time.

davidhs

Quote from: MESWEB on December 21, 2014, 04:53:30 PM
I have version 1.1 and when I uninstall with errors what I should do?
There is a problem. Perhaps you can not install this mod (in automatic mode) after install Best Answer, but it can be install with errors and then do manual edit.

Steps for uninstall my mod:

1. Uninstall with errores (without delete tables!)

2. Open MessageIndex.php and modify:

2.1. Fix error 6. Before line 414, search

LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = {int:current_board} AND lmr.id_member = {int:current_member})'). ' LEFT JOIN {db_prefix}best_answer AS `ba` ON `t`.`id_topic` = `ba`.`id_topic`' . /* BEGIN MOD CustomFieldFilterPost */ (empty($context['cffp_filters']['sql']) ? '' : '
' . $context['cffp_filters']['sql']['from']) . /* END MOD CustomFieldFilterPost */ '
WHERE ' . ($pre_query ? 't.id_topic IN ({array_int:topic_list})' : 't.id_board = {int:current_board}') . (!$modSettings['postmod_active'] || $context['can_approve_posts'] ? '' : ' AND (t.approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR t.id_member_started = {int:current_member}') . ')') /* BEGIN MOD CustomFieldFilterPost */ . (empty($context['cffp_filters']['sql']) ? '' : '
AND ' . $context['cffp_filters']['sql']['cond']) /* END MOD CustomFieldFilterPost */ . '
ORDER BY ' . ($pre_query ? 'FIND_IN_SET(t.id_topic, {string:find_set_topics})' : (!empty($modSettings['enableStickyTopics']) ? 'is_sticky' . ($fake_ascending ? '' : ' DESC') . ', ' : '') . $_REQUEST['sort'] . ($ascending ? '' : ' DESC')) . '

and replace by

LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = {int:current_board} AND lmr.id_member = {int:current_member})'). ' LEFT JOIN {db_prefix}best_answer AS `ba` ON `t`.`id_topic` = `ba`.`id_topic`' . '
WHERE ' . ($pre_query ? 't.id_topic IN ({array_int:topic_list})' : 't.id_board = {int:current_board}') . (!$modSettings['postmod_active'] || $context['can_approve_posts'] ? '' : '
AND (t.approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR t.id_member_started = {int:current_member}') . ')') . '
ORDER BY ' . ($pre_query ? 'FIND_IN_SET(t.id_topic, {string:find_set_topics})' : (!empty($modSettings['enableStickyTopics']) ? 'is_sticky' . ($fake_ascending ? '' : ' DESC') . ', ' : '') . $_REQUEST['sort'] . ($ascending ? '' : ' DESC')) . '


2.2. Fix error 9. Before line 583, search

// BEGIN MOD CustomFieldFilterPost
$id_msg_array[] = $context['topics'][$row['id_topic']]['first_post']['id'];
$context['cffp']['data_msg_topic'][$row['id_first_msg']] = array(
'sticky' => $context['topics'][$row['id_topic']]['is_sticky'] ? 1 : 0,
'locked' => $context['topics'][$row['id_topic']]['is_locked'] ? 1 : 0,
'id_msg' => $context['topics'][$row['id_topic']]['first_post']['id'],
'first_msg' => 1,
'subject' => $context['topics'][$row['id_topic']]['subject'],
);
// END MOD CustomFieldFilterPost
determineTopicClass($context['topics'][$row['id_topic']]);

and replace by

determineTopicClass($context['topics'][$row['id_topic']]);


2.3. Fix error 10. After lines of error 9, search

$smcFunc['db_free_result']($result);

// BEGIN MOD CustomFieldFilterPost
// Load custom post fields.
cffpLoadValueOfFieldsByMsg($id_msg_array);
foreach ($context['topics'] as $t => $topic)
{
cffpLoad($topic['first_post']['id'], $topic['first_post']['member']['id'], 'message_index');
cffpLoad($topic['first_post']['id'], 0, 'message_index_member');
$context['topics'][$t]['first_post']['cffp']['message_index'] = $context['cffp']['message_index'];
$context['topics'][$t]['first_post']['cffp']['message_index_member'] = $context['cffp']['message_index_member'];
}
// END MOD CustomFieldFilterPost

and replace by

$smcFunc['db_free_result']($result);



3. The End. :)

Now try install version 1.2. There are errors?

MESWEB

Quote from: davidhs on December 21, 2014, 06:38:01 PM

1. Uninstall with errores (without delete tables!)

2. Open MessageIndex.php and modify:

2.1. Fix error 6. Before line 414, search

LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = {int:current_board} AND lmr.id_member = {int:current_member})'). ' LEFT JOIN {db_prefix}best_answer AS `ba` ON `t`.`id_topic` = `ba`.`id_topic`' . /* BEGIN MOD CustomFieldFilterPost */ (empty($context['cffp_filters']['sql']) ? '' : '
' . $context['cffp_filters']['sql']['from']) . /* END MOD CustomFieldFilterPost */ '
WHERE ' . ($pre_query ? 't.id_topic IN ({array_int:topic_list})' : 't.id_board = {int:current_board}') . (!$modSettings['postmod_active'] || $context['can_approve_posts'] ? '' : ' AND (t.approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR t.id_member_started = {int:current_member}') . ')') /* BEGIN MOD CustomFieldFilterPost */ . (empty($context['cffp_filters']['sql']) ? '' : '
AND ' . $context['cffp_filters']['sql']['cond']) /* END MOD CustomFieldFilterPost */ . '
ORDER BY ' . ($pre_query ? 'FIND_IN_SET(t.id_topic, {string:find_set_topics})' : (!empty($modSettings['enableStickyTopics']) ? 'is_sticky' . ($fake_ascending ? '' : ' DESC') . ', ' : '') . $_REQUEST['sort'] . ($ascending ? '' : ' DESC')) . '

and replace by

LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = {int:current_board} AND lmr.id_member = {int:current_member})'). ' LEFT JOIN {db_prefix}best_answer AS `ba` ON `t`.`id_topic` = `ba`.`id_topic`' . '
WHERE ' . ($pre_query ? 't.id_topic IN ({array_int:topic_list})' : 't.id_board = {int:current_board}') . (!$modSettings['postmod_active'] || $context['can_approve_posts'] ? '' : '
AND (t.approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR t.id_member_started = {int:current_member}') . ')') . '
ORDER BY ' . ($pre_query ? 'FIND_IN_SET(t.id_topic, {string:find_set_topics})' : (!empty($modSettings['enableStickyTopics']) ? 'is_sticky' . ($fake_ascending ? '' : ' DESC') . ', ' : '') . $_REQUEST['sort'] . ($ascending ? '' : ' DESC')) . '


2.2. Fix error 9. Before line 583, search

// BEGIN MOD CustomFieldFilterPost
$id_msg_array[] = $context['topics'][$row['id_topic']]['first_post']['id'];
$context['cffp']['data_msg_topic'][$row['id_first_msg']] = array(
'sticky' => $context['topics'][$row['id_topic']]['is_sticky'] ? 1 : 0,
'locked' => $context['topics'][$row['id_topic']]['is_locked'] ? 1 : 0,
'id_msg' => $context['topics'][$row['id_topic']]['first_post']['id'],
'first_msg' => 1,
'subject' => $context['topics'][$row['id_topic']]['subject'],
);
// END MOD CustomFieldFilterPost
determineTopicClass($context['topics'][$row['id_topic']]);

and replace by

determineTopicClass($context['topics'][$row['id_topic']]);


3. The End. :)

Now try install version 1.2. There are errors?

This 2 errors are not that same like my errors. I uninstall with errors and delete manual my errors. So guess what i found after uninstall this mod? Lot of codes  CustomFieldFilterPost in message.index.php.

I have errors with install 1.2:
5.4
5.5
5.8
5.10
5.14
5.15

You should repair installation file that would be better for everyone.

SMF installation is a piece of ****** example:
error 5.4 find:
$d;sort=' . $_REQUEST['sort'] . (isset($_REQUEST['desc']) ? ';desc' : ''), $_REQUEST['start']
Smf installation can't find this line. Why? I open message in Notepad++ an paste this code so what they found? This fu...king line. I don't understand why SMF install can't find line which one has been found in other programs.

Advertisement: