Advertisement:

Author Topic: Custom fields and filters of post, 1.0 (SMF 2.0-2.0.7)  (Read 2241 times)

Offline davidhs

  • Full Member
  • ***
  • Posts: 563
  • Gender: Male
Custom fields and filters of post, 1.0 (SMF 2.0-2.0.7)
« on: February 21, 2014, 01:53:17 PM »
Link to Mod



Custom fields and filters of post

ABOUT...

Custom fields and filters of post, 1.0
© 2014 by davidhs


This work is licensed under a Creative Commons Attribution 3.0 Unported License.

DESCRIPTION

Allows to add different groups of custom fields to forum posts and filters for fields of posts.

A group of fields can be of type:
  • Fields loose: Its fields are added to a post to provide extra information. In seeking data into fields loose of a post is gets a list of posts.
  • Record: It is a set of fields that represents an independent entity of the post. In seeking data into fields of a record is gets a list of records. The post body can not be left empty but a post with record does not need body. If the user will add a record and the post body is empty, the system writes a period (".") on it and the user does not need to write anything.
  • Fields with several values per member: It is set of fields where several members can insert different values. This can be used for members to make comments or valuations about the post. If these fields are located in just the first post of a topic can be displayed as belonging to the topic.
  • Filters: This is a special type of group without fields. Used to enable a set of predefined filters that can be used on topics and posts.

The available predefined filters are:
  • Boards.
  • Subject.
  • Start of the subject.
  • First character of the subject.
  • Date of topic / Date posted.
  • Date of last reply / Date posted.
  • Posted by.
  • Topic with new posts / New.
  • Sticky.
  • Locked.
  • Replies.
  • Poll.

The actions to be performed on a group of custom fields are: view, add, modify, delete and move.

Furthermore other actions are possible using custom fields:
  • Filter the message index.
  • Search in fields of posts, getting a list of posts.
  • Search in fields of records, getting a list of records.

Administration panel

The administration panel has the list of groups of custom fields, which allows to add new groups, modify or delete existing groups, add, modify or delete fields in a group and define templates to display those fields in a post and in message index.

     

     

Viewing posts with custom fields

When viewing a complete post (on a topic, in recent posts or profile) are displayed its groups (which are enabled when post is create or modify). Groups of type "loose fields" and "record" are shown above the post body, whereas groups of type "fields with several values per member" are shown below, unless was selected "Show as group of fields of the topic" and then is displayed at the beginning and/or end of the topic. If a group has template for posts the fields are displayed according to the template, if has not are displayed with its name and content.

In lists of posts (message index, unread post and replies) are displayed groups with fields visible in message index (according to permissions). If a group has template for message index the fields are displayed according to the template, if has not are displayed with its name and content.

Modifying values on custom fields

In a topic, posts with groups of type "fields with several values per member" have buttons for the user to post new values, and modify or remove existing ones.

For all other groups ("fields loose" and "record"), at create or modify the post are displayed allowed groups. The groups of type "loose fields" always have their fields visible, whereas the groups of type "record" have a checkbox to show or hide their fields.

Moving a group of custom fields to another post

A group of fields may have to be allocated to another post, for example before removing the post where is the group.

If user has allowed to move a group, when viewing a topic that group will have buttons to move to the first post from the topic or another post (or another topic if the group is of type "fields with several values per member" and have selected "Show as group of fields of the topic").

Filter the message index

If the property "Filter the message index" of a field is selected and the user has permission to view the field, a button is displayed in the message index to filter topics by that field.

Type of filter button depends on the type of field:
  • The filter for text or large text fields is a text button in which enter the search string, or a select box to get data with that field empty or non-empty.
  • Fields of type select box, combo box, radio buttons or checkboxes have by filter a text button, a select box or a combo box in which enter or select the search string, or a select box to get data with that field empty or non-empty.
  • For fields of type boolean the filter is a select box with values "Yes" and "No".

If the user can modify a field, that field may be empty and its filter is a select box or combo box, he will see an option in the list to get data with that field empty.

Also, with a group of type "filters" can be added predefined filters.

The filters can be of the same group or different groups of fields.

Next to filters there is a button to activate the filters that have been given some value. As a result is obtained the messages index with topics whose first post matches all active filters.

Search in fields

Under the option "Search" from the menu forum the search pages are located, showing the groups and their fields on which user have search permission.

Groups of type "loose fields", "fields with several values per member" and "filters" can be in several search pages, and each page contain several groups, with the only condition that the groups on a page must be permitted on a common set of posts. As a search result a list of posts is obtained.

For each group of type "register" with search permission have one page. As a result a list of records is obtained with the columns indicated at defining the fields.

In both cases the buttons used in each search field follow the same rule as in the filters.

EXAMPLE

Suppose we have a forum where different programs that exist to create a forum are discussed and we want to have a set of file cards with the features of each program. You can write the file cards of each forum in messages or using this MOD to create the file cards.

First we create a board where you write messages that will contain file cards of forums (we call it "Records of forums").

Next we create several types of groups of custom fields in the administration panel of the MOD:
  • Forum: Group of type "record" to save features of forum (name, abbreviation, developer(s), version,...). We give search permission on the group so that create a search page of forums. Some properties of the group can be defined to create filters on the message index and search page. Other are defined to be displayed in the list of records result of the search.
         
  • CMS: Group of type "fields loose" with a single field to indicate if a message contains data from an independent forum or belonging to a content management system (CMS). We give search permission to the group to be created a search page of posts and define its field to create filters on the message index and search page.
  • Filters: Group of type "filters" to use predefined filters in message index and search page. To display we give permission to the group.
  • Comments: Group of type "fields with several values per member" that will allow users to give their reviews about each forum without creating any reply in the topics that contain the file cards of each forum. The group will be displayed at the end of all pages of the topic and will have two fields: "I like it!" and "Comment".

The structure is already done. We now create file cards of forums. Go to the board "Records of forums" and create a new topic. If we are to write about a content management system we enable the "CMS" field. To create the file card of a forum we enable the checkbox "Forum" and fill fields of file card.

This image shows the file card that we created. We also see that there are two user comments about this forum.

Once you have created all the file cards in the index of board "Records of forums" you see some fields next to the post subject and filters above the listing.

To search posts go to "Search > Search posts", where groups and fields with permission to search are displayed.

To search file cards of forums go to menu "Search > Search records of type Forum", where the fields on which you can filter the list of file cards of forums are displayed.

SMF COMPATIBILITY

  • SMF 2.0 to 2.0.7.

LANGUAGES

  • english, english_british.
  • spanish, spanish_es, spanish_latin.

If you want help translating it into other languages, you can add the translation in this topic.

DOWNLOAD

Link to MOD

MANUAL INSTALLATION

See http://wiki.simplemachines.org/smf/Manual_installation_of_mods

SUPPORT AND COMMENTS

In English: http://www.simplemachines.org/community/index.php?topic=518886.0
In Spanish: http://www.simplemachines.org/community/index.php?topic=515911.0

CHANGE LOG

Code: [Select]
Legend:   ! Fixed   + Added   - Removed   * Changed   @ Note

1.0     2014-02-20
------------------
@ This work is licensed under a Creative Commons Attribution 3.0 Unported License http://creativecommons.org/licenses/by/3.0/
+ Groups of custom fields loose in forum posts, to provide extra information.
+ Groups of custom fields in forum posts, called records, that represents an independent entity of the post.
+ Groups of custom fields in forum posts, with several values per member. They may be seen as belonging to the post or to the topic.
+ Groups of predefined filters that can be used on topics and posts.
+ Predefined filters: Boards, Subject, Start of the subject, First character of the subject, Date of topic / Date posted, Date of last reply / Date posted, Posted by, Topic with new posts / New, Sticky, Locked, Replies, Poll.
+ Actions to be performed on a group of custom fields: view, add, modify, delete, move.
+ Filter the message index using custom fields.
+ Search in custom fields of posts, getting a list of posts.
+ Search in custom fields of records, getting a list of records.
+ Support of WAP.
+ Administration panel.
+ SMF compatibility: 2.0 to 2.0.7.
+ Languages: english, english-utf8, spanish_es, spanish_es-utf8, spanish_latin, spanish_latin-utf8.
« Last Edit: February 21, 2014, 03:15:16 PM by davidhs »

Offline kamili34

  • Jr. Member
  • **
  • Posts: 227
  • Gender: Male
  • noob
    • pilarki.org
Re: Custom fields and filters of post, 1.0 (SMF 2.0-2.0.7)
« Reply #1 on: February 21, 2014, 03:35:11 PM »
Got error on this

Code: [Select]
Znajdź: [Zaznacz]


'unapproved_posts' => $row['unapproved_posts'],
);

Dodaj Po: [Zaznacz]


// 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



Tried manually edited but when do this cant brose boards. :/

Offline davidhs

  • Full Member
  • ***
  • Posts: 563
  • Gender: Male
Re: Custom fields and filters of post, 1.0 (SMF 2.0-2.0.7)
« Reply #2 on: February 21, 2014, 04:16:29 PM »
Other mod (i.e. mod X) modified these lines and my mod can not install here. :(

Your file have this on line 598
Code: [Select]
'unapproved_posts' => $row['unapproved_posts'],
'description' => $row['description'],

);
and my mod expects this
Code: [Select]
'unapproved_posts' => $row['unapproved_posts'],
);

If you can,
1. uninstall mod X,
2. install my mod and
3. install mod X.

If you can not uninstall mod X or you do not know which it is, you can
1. install my mod with this error and
2. modify your MessageIndex.php, line 598,
after
Code: [Select]
'unapproved_posts' => $row['unapproved_posts'],
'description' => $row['description'],

);
write
Code: [Select]
// 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

Offline kamili34

  • Jr. Member
  • **
  • Posts: 227
  • Gender: Male
  • noob
    • pilarki.org
Re: Custom fields and filters of post, 1.0 (SMF 2.0-2.0.7)
« Reply #3 on: February 21, 2014, 04:24:37 PM »
Works. I put it in wrong place after 'unapproved_posts' => $row['unapproved_posts']. Now with your advice is ok. :) Thanks

Offline sardonick007

  • Semi-Newbie
  • *
  • Posts: 27
Re: Custom fields and filters of post, 1.0 (SMF 2.0-2.0.7)
« Reply #4 on: February 28, 2014, 09:52:25 PM »
This is SO brilliant!
One question. When using "record" option, the mod puts a . (period) in the body when there is no body. However, if WYSIWYG is toggled ON by default, this does not work. Is there a way for the . to be entered while the WYSIWYG is toggled on?

This mod is replacing all my forms and multiple pages into one page of selectable forms!!!! AWESOME!

Offline sardonick007

  • Semi-Newbie
  • *
  • Posts: 27
Re: Custom fields and filters of post, 1.0 (SMF 2.0-2.0.7)
« Reply #5 on: February 28, 2014, 11:39:32 PM »
Also, when I use the "print" button on the post, only the post body prints. None of the fields do. Is there a workaround for this? I'm really digging into this mod, it's better than I imagined with only a few little bumps.

Offline davidhs

  • Full Member
  • ***
  • Posts: 563
  • Gender: Male
Re: Custom fields and filters of post, 1.0 (SMF 2.0-2.0.7)
« Reply #6 on: March 01, 2014, 06:48:11 AM »
One question. When using "record" option, the mod puts a . (period) in the body when there is no body. However, if WYSIWYG is toggled ON by default, this does not work. Is there a way for the . to be entered while the WYSIWYG is toggled on?
I do not use the WYSIWYG mode and did not think about this. :( I will see.

Now, You must put a ".".

Also, when I use the "print" button on the post, only the post body prints. None of the fields do. Is there a workaround for this? I'm really digging into this mod, it's better than I imagined with only a few little bumps.
Same. I do not use the print option and did not think about this. :( I will see.

Offline sardonick007

  • Semi-Newbie
  • *
  • Posts: 27
Re: Custom fields and filters of post, 1.0 (SMF 2.0-2.0.7)
« Reply #7 on: March 01, 2014, 01:16:00 PM »
One question. When using "record" option, the mod puts a . (period) in the body when there is no body. However, if WYSIWYG is toggled ON by default, this does not work. Is there a way for the . to be entered while the WYSIWYG is toggled on?
I do not use the WYSIWYG mode and did not think about this. :( I will see.

Now, You must put a ".".

Also, when I use the "print" button on the post, only the post body prints. None of the fields do. Is there a workaround for this? I'm really digging into this mod, it's better than I imagined with only a few little bumps.
Same. I do not use the print option and did not think about this. :( I will see.

Thank you for your response! I appreciate the effort. Even now it's an excellent script and very useful to me.

Offline sardonick007

  • Semi-Newbie
  • *
  • Posts: 27
Re: Custom fields and filters of post, 1.0 (SMF 2.0-2.0.7)
« Reply #8 on: March 01, 2014, 03:58:16 PM »
As I'm using this more now, I also wanted to make sure you knew that you cannot view the information in Tapatalk, only the subject and body. For those using Tapatalk to view the boards they would not see the information in the records.

So for me, the current observations are:
Does not show up on print or when using "send topic" (only subject and body sends)
Does not automatically put a . (period) in the subject when using "Record type" if the body is toggled to WYSIWYG
Does not show information if using Tapatalk

I hope this is helpful because this is such a useful mod for my business.

Offline margarett

  • Support Specialist
  • SMF Hero
  • *
  • Posts: 9,252
  • Gender: Male
Re: Custom fields and filters of post, 1.0 (SMF 2.0-2.0.7)
« Reply #9 on: March 01, 2014, 04:51:32 PM »
It is actually "normal" that custom information isn't displayed in Tapatalk. They use a custom set of Sources files, meaning that the custom edits to SMF's own files aren't displayed in mobiles. That's not an issue with this mod, more with the way Tapatalk was built...
Bruno Alves a.k.a "margarett"

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Offline sardonick007

  • Semi-Newbie
  • *
  • Posts: 27
Re: Custom fields and filters of post, 1.0 (SMF 2.0-2.0.7)
« Reply #10 on: March 01, 2014, 04:54:53 PM »
It is actually "normal" that custom information isn't displayed in Tapatalk. They use a custom set of Sources files, meaning that the custom edits to SMF's own files aren't displayed in mobiles. That's not an issue with this mod, more with the way Tapatalk was built...

Yea, I see that. It's not that big a deal really, since speeds are good enough to use the phone/tablet browser. That was just one of the things I experienced and figured I'd mention. It's really the one thing on my list that is not very important, maybe it'd be nice, but it's not a deal breaker.

Offline davidhs

  • Full Member
  • ***
  • Posts: 563
  • Gender: Male
Re: Custom fields and filters of post, 1.0 (SMF 2.0-2.0.7)
« Reply #11 on: March 02, 2014, 06:49:23 AM »
This MOD works in WAP mode but Tapatalk.... I do not know this :(

Is this Tapatalk? http://tapatalk.com/activate_tapatalk.php?plugin=smf
I do not found in SMF MODs section.

I will see.

Offline sardonick007

  • Semi-Newbie
  • *
  • Posts: 27
Re: Custom fields and filters of post, 1.0 (SMF 2.0-2.0.7)
« Reply #12 on: March 02, 2014, 12:37:56 PM »
Yes, that's it. However the mod works fine in WAP mode as you said. Tapatalk is just a bonus, nothing major. Printing and seeing the content in announcements, send topic,  and emails would be more important than Tapatalk since mobile web is easy to use and works fine.

Offline LadyAngel

  • Semi-Newbie
  • *
  • Posts: 37
  • Gender: Female
    • Sim Fans UK
Re: Custom fields and filters of post, 1.0 (SMF 2.0-2.0.7)
« Reply #13 on: March 17, 2014, 07:48:06 AM »
Thank you so much for this mod - I think it's just become my new favourite!  ;D

Offline sardonick007

  • Semi-Newbie
  • *
  • Posts: 27
Re: Custom fields and filters of post, 1.0 (SMF 2.0-2.0.7)
« Reply #14 on: April 03, 2014, 04:51:19 PM »
One question. When using "record" option, the mod puts a . (period) in the body when there is no body. However, if WYSIWYG is toggled ON by default, this does not work. Is there a way for the . to be entered while the WYSIWYG is toggled on?
I do not use the WYSIWYG mode and did not think about this. :( I will see.

Now, You must put a ".".

Also, when I use the "print" button on the post, only the post body prints. None of the fields do. Is there a workaround for this? I'm really digging into this mod, it's better than I imagined with only a few little bumps.
Same. I do not use the print option and did not think about this. :( I will see.

Have you had any luck with these items? Is there a plan for a future update that might address this? Thanks again for a great mod.

Offline LadyAngel

  • Semi-Newbie
  • *
  • Posts: 37
  • Gender: Female
    • Sim Fans UK
Re: Custom fields and filters of post, 1.0 (SMF 2.0-2.0.7)
« Reply #15 on: April 03, 2014, 05:19:48 PM »
I love this mod, I really do, but there's one thing I would change - it would be faster and more efficient if the admin could mass add multiple options at once, say in a text field, rather than having to add the options one by one.

Offline davidhs

  • Full Member
  • ***
  • Posts: 563
  • Gender: Male
Re: Custom fields and filters of post, 1.0 (SMF 2.0-2.0.7)
« Reply #16 on: April 04, 2014, 06:49:25 AM »
it would be faster and more efficient if the admin could mass add multiple options at once, say in a text field, rather than having to add the options one by one.
Where? When a field with options is created (i.e radio/check buttom)?

Offline LadyAngel

  • Semi-Newbie
  • *
  • Posts: 37
  • Gender: Female
    • Sim Fans UK
Re: Custom fields and filters of post, 1.0 (SMF 2.0-2.0.7)
« Reply #17 on: April 04, 2014, 06:55:16 AM »
Yes, that kind of thing. Instead of having to input each option at a time, I'd like to be able to paste a column of options, it would just save time. :)

Offline davidhs

  • Full Member
  • ***
  • Posts: 563
  • Gender: Male
Re: Custom fields and filters of post, 1.0 (SMF 2.0-2.0.7)
« Reply #18 on: April 04, 2014, 08:26:03 AM »
I will see on next update. :)

Offline LadyAngel

  • Semi-Newbie
  • *
  • Posts: 37
  • Gender: Female
    • Sim Fans UK
Re: Custom fields and filters of post, 1.0 (SMF 2.0-2.0.7)
« Reply #19 on: April 04, 2014, 09:19:00 AM »
I will see on next update. :)
Lovely, thanks for considering it :)