Advertisement:

Author Topic: Custom fields and filters of post  (Read 92040 times)

Offline davidhs

  • Sr. Member
  • ****
  • Posts: 966
  • Gender: Male
Re: Custom fields and filters of post
« Reply #240 on: December 01, 2017, 03:32:40 PM »
Let me give you a gift: In the upper part, where users can filter the topics, I added some CSS to make it looks more organized when there's a lot search parameters. Probably you can do it better than mine :D

Check the code in the attached file :)
If all your WC3 Maps are in only one board is better use filter (as you do). Search page is better when you have records in more than one boards (with search page you can find records in various boards in only one result list). I supose you saw this. ;)

I like your theme in filters :)

You did added CSS styles in template file (function template_cffp_show). You do not must modify CustomFieldFilterPost.template.php because your changes be lost in next uninstall/install new version. :'( Instead to do this, try add your own style in YOUR_FORUM/Themes/YOUR_THEME/css/index.css. 8)

If you open this file you see the CSS of my mod for default theme:
Code: [Select]
/* BEGIN MOD CustomFieldFilterPost */
/* You do not modify this CSS style. Add your style before line "BEGIN MOD CustomFieldFilterPost" */
div.cffp_post,
div.cffp_member,
div.cffp_search
{
padding: 0.5em;
overflow: hidden;
}
div.cffp_post div.cffp_data,
div.cffp_member div.cffp_data,
div.cffp_search div.cffp_data
{
}
div.cffp_post dl.cffp_data > dt,
div.cffp_member dl.cffp_data > dt,
div.cffp_search dl.cffp_data > dt
{
float: left;
padding: 0;
margin: .5em 0 0 0;
font-weight: bold;
clear: both;
}
div.cffp_post dl.cffp_data > dd,
div.cffp_member dl.cffp_data > dd,
div.cffp_search dl.cffp_data > dd
{
float: left;
padding: 0;
margin: .3em 0;
}
div.cffp_post dl.cffp_data > dt,
div.cffp_member dl.cffp_data > dt
{
width: 20%;
}
div.cffp_post dl.cffp_data > dd,
div.cffp_member dl.cffp_data > dd
{
width: 78%;
}
div.cffp_search dl.cffp_data > dt
{
width: 40%;
}
div.cffp_search dl.cffp_data > dd
{
width: 58%;
}
form#cffp_edit_group .roundframe,
form#cffp_search .roundframe
{
padding: 0 12%;
}
div.cffp_post .moderatorbar,
div.cffp_member .moderatorbar
{
margin: 0;
}
div.cffp_post ul.quickbuttons,
div.cffp_member ul.quickbuttons
{
}
div.cffp_member div.cffp_member_data_fields
{
background-color: #fff;
padding: 10px;
}
div.cffp_member div.cffp_member_data_fields div.cffp_member_data_fields
{
padding: 0;
}
div.cffp_member div.cffp_member_fields
{
}
div.cffp_member div.cffp_member_fields span.botslice
{
clear: both;
}
div.cffp_member div.cffp_member_new_title
{
margin: 10px 0px;
}
div.cffp_member > fieldset legend a,
div.cffp_member div.cffp_member_data > fieldset legend a,
div.cffp_member div.cffp_member_new_title a
{
color: #444;
text-decoration: none;
}
div.cffp_member div.cffp_member_data_fields,
div.cffp_member div.cffp_member_new_fields
{
}
form#cffp_search div.cffp_column
{
margin: 0;
padding: 0;
width: 50%;
}
form#cffp_search div.cffp_column div.cffp_search
{
padding: 0 12px;
}
form#cffp_search div.cffp_roundframe
{
padding: 0 24%;
}
div.cffp_message_index
{
}
div.cffp_message_index_member
{
border-top: 1px solid #c4c4c4;
}
div.cffp_message_index span.cffp_group_name,
div.cffp_message_index_member span.cffp_group_name
{
font-weight: bold;
margin-right: 1em;
}
div.cffp_message_index div.cffp_data,
div.cffp_message_index dl.cffp_data,
div.cffp_message_index dl.cffp_data > dt,
div.cffp_message_index_member div.cffp_data,
div.cffp_message_index_member dl.cffp_data,
div.cffp_message_index_member dl.cffp_data > dt
{
display: inline !important;
}
div.cffp_message_index dl.cffp_data > dt,
div.cffp_message_index_member dl.cffp_data > dt
{
float: none !important;
padding: 0 !important;
margin: 0 !important;
width: auto !important;
font-weight: normal !important;
clear: none !important;
}
div.cffp_message_index dl.cffp_data > dd,
div.cffp_message_index_member dl.cffp_data > dd
{
display: inline-block !important;
float: none !important;
padding: 0 !important;
margin: 0 1em 0 0 !important;
width: auto !important;
}
div.cffp_message_index_member .moderatorbar
{
margin: 0;
}
div.cffp_message_index_member div.cffp_member_fields
{
border-bottom: 1px solid #c4c4c4;
}
form#cffp_filters
{
margin-top: 1em;
}
form#cffp_filters div.cffp_filters span
{
font-weight: bold;
margin-right: 1em;
}
form#cffp_filters div.cffp_filters a
{
margin-right: 1em;
}
form#cffp_filters div.cffp_filters,
form#cffp_filters div.cffp_filters dl,
form#cffp_filters div.cffp_filters dt
{
display: inline;
}
form#cffp_filters div.cffp_filters dd,
form#cffp_filters div.cffp_filters_button
{
display: inline;
margin-left: 0;
margin-right: 1em;
}
ul.quickbuttons li.move_button
{
background: url(../images/icons/quick_move.gif) no-repeat 0 0;
}
div.cffp_member_stats
{
padding: 0 12%;
}
div.cffp_message_index_member_stats
{
padding: 5px 0;
}
div.cffp_stats
{
width: 100%;
}
div.cffp_stats > dl.stats > dt
{
text-align: left;
}
div.cffp_stats_average
{
max-width: 392px;
width: 100%;
padding: 0;
}
div.cffp_stats_average span
{
font-weight: bold;
}
div.cffp_stats_average_bar
{
padding: 0;
height: 16px;
}
div.cffp_stats_average_bar div
{
background: #6294CE url(../images/bar_stats.png) repeat-x -4px;
padding: 0;
height: 16px;
}
div.cffp_top_posters_left
{
float: left;
width: 49.5%;
}
div.cffp_top_posters_right
{
float: right;
width: 49.5%;
}
/* END MOD CustomFieldFilterPost */

You do not must modify this code because you will have errors in uninstall :o, but you can write here your own style:
Code: [Select]
/* Here you can add your style */
your style...

/* BEGIN MOD CustomFieldFilterPost */
/* You do not modify this CSS style. Add your style before line "BEGIN MOD CustomFieldFilterPost" */
original style...
/* END MOD CustomFieldFilterPost */

For example, in CustomFieldFilterPost.template.php, line 3560
Code: [Select]
echo '
<div class="cffp_filters">';


if ($group['show_group_name_filter'])
echo '

<span>', $group['name'], '</span>';
you replace by
Code: [Select]
echo '
<div class="cffp_filters" style="display: inline-flex; padding: 0">';

if ($group['show_group_name_filter'])
echo '
<span style="float: left; padding: 5px 10px 0 0">', $group['name'], '</span>';

You can add this to css file instead of modify template:
Code: [Select]
form#cffp_filters div.cffp_filters
{
display: inline-flex !important;
padding: 0 !important;
}
form#cffp_filters div.cffp_filters span
{
float: left !important;
padding: 5px 10px 0 0 !important;
}
Also you can try add style with
Code: [Select]
form#cffp_filters div.cffp_filters dl
form#cffp_filters div.cffp_filters dd
form#cffp_filters div.cffp_filters dt
instead of replace dl/dd/dt tags with div's ;)



In filter section also you can add a button "Sort" and order your board by "Minumum Players" or "Score".
Modify a field and check permissions Sort 8)

Offline thepitster

  • Semi-Newbie
  • *
  • Posts: 28
  • Gender: Male
    • ALLRiPPED
Re: Custom fields and filters of post
« Reply #241 on: December 07, 2017, 02:21:34 PM »
when I updated to the newer version this popped up in the error_log again:
Code: (error_log) [Select]
syntax error, unexpected 'thank_list' (T_STRING), expecting ',' or ';' in ./Themes/default/Profile.template.php on line 518forgot the
Code: [Select]
';on line 517 of Profile.template.php, like so:
Before:
Code: (Profile.template.php(517)) [Select]
<!-- END MOD CustomFieldFilterPost -->After:
Code: (Profile.template.php(517)) [Select]
<!-- END MOD CustomFieldFilterPost -->';that way we don't end up at a blank page trying to view any profile.

Using SMF 2.0.15

Offline davidhs

  • Sr. Member
  • ****
  • Posts: 966
  • Gender: Male
Re: Custom fields and filters of post
« Reply #242 on: December 07, 2017, 03:00:07 PM »
when I updated to the newer version this popped up in the error_log again:
Code: (error_log) [Select]
syntax error, unexpected 'thank_list' (T_STRING), expecting ',' or ';' in ./Themes/default/Profile.template.php on line 518forgot the
Code: [Select]
';on line 517 of Profile.template.php, like so:
Before:
Code: (Profile.template.php(517)) [Select]
<!-- END MOD CustomFieldFilterPost -->After:
Code: (Profile.template.php(517)) [Select]
<!-- END MOD CustomFieldFilterPost -->';that way we don't end up at a blank page trying to view any profile.

Using SMF 2.0.15
Perhaps you have another mod and both mods modify same code...

I need see your code. Attach here your Profile.template.php.

Offline moyack

  • Semi-Newbie
  • *
  • Posts: 34
  • Gender: Male
  • Bootstrap FTW!!
Re: Custom fields and filters of post
« Reply #243 on: March 07, 2018, 03:22:32 PM »
Hi davidhs:

As always, I'm doing awesome stuff with your mod but now I have an issue: I was working with a fields group which were initially "loose field" and then I've changed to "fields with several values per user" because I wanted to make them modifiable without editing the post. I've set it and then the field group didn't show anymore in the post. Then I tried to change it back but unfortunately it keeps hidden from then posts and in the message index.

I've searched in the database but it seems legit with no error. Is there a field in the database which is keeping in conflict? Is there any information you'll need to see? I'd show you the database fields via PM.

EDIT: It seems all the information from that group has been deleted... That's a bug that should be revised. Now I've lost too many fields stored for 2 years :(
« Last Edit: March 07, 2018, 03:38:17 PM by moyack »

Offline davidhs

  • Sr. Member
  • ****
  • Posts: 966
  • Gender: Male
Re: Custom fields and filters of post
« Reply #244 on: March 07, 2018, 04:55:16 PM »
Hi davidhs:

As always, I'm doing awesome stuff with your mod but now I have an issue: I was working with a fields group which were initially "loose field" and then I've changed to "fields with several values per user" because I wanted to make them modifiable without editing the post. I've set it and then the field group didn't show anymore in the post. Then I tried to change it back but unfortunately it keeps hidden from then posts and in the message index.

I've searched in the database but it seems legit with no error. Is there a field in the database which is keeping in conflict? Is there any information you'll need to see? I'd show you the database fields via PM.

EDIT: It seems all the information from that group has been deleted... That's a bug that should be revised. Now I've lost too many fields stored for 2 years :(
First, if you want edit a group of fields always you need edit its post.

A group type "fields with several values per user" has one value for each user. This group can be used for get opinion of users about the content of post. It is not used for add fields to a post.

You can convert a group type "loose fields" to "record" (and vice versa) without losing data because both types have only one value in one post.

But if you convert a group type "loose fields" or "record" to "fields with several values per user" (and vice versa), data of this group are deleted because they are not compability with new type. You are convert a group with only one value to a group with many values.

Do you have backup of your database? If yes you can restore data of your group (I can guide you in the process).
Else, this is not possible. I am sorry.

Offline moyack

  • Semi-Newbie
  • *
  • Posts: 34
  • Gender: Male
  • Bootstrap FTW!!
Re: Custom fields and filters of post
« Reply #245 on: March 09, 2018, 10:00:41 AM »
Hi davidhs:

As always, I'm doing awesome stuff with your mod but now I have an issue: I was working with a fields group which were initially "loose field" and then I've changed to "fields with several values per user" because I wanted to make them modifiable without editing the post. I've set it and then the field group didn't show anymore in the post. Then I tried to change it back but unfortunately it keeps hidden from then posts and in the message index.

I've searched in the database but it seems legit with no error. Is there a field in the database which is keeping in conflict? Is there any information you'll need to see? I'd show you the database fields via PM.

EDIT: It seems all the information from that group has been deleted... That's a bug that should be revised. Now I've lost too many fields stored for 2 years :(
First, if you want edit a group of fields always you need edit its post.

A group type "fields with several values per user" has one value for each user. This group can be used for get opinion of users about the content of post. It is not used for add fields to a post.

You can convert a group type "loose fields" to "record" (and vice versa) without losing data because both types have only one value in one post.

But if you convert a group type "loose fields" or "record" to "fields with several values per user" (and vice versa), data of this group are deleted because they are not compability with new type. You are convert a group with only one value to a group with many values.

Do you have backup of your database? If yes you can restore data of your group (I can guide you in the process).
Else, this is not possible. I am sorry.i
Fortunately I had a backup, old but usable. But I suggest to add in a next version at least a warning about this situation in order to avoid issues like this.

And dont' forget that I still love with passion this mod.  ;)

Offline davidhs

  • Sr. Member
  • ****
  • Posts: 966
  • Gender: Male
Re: Custom fields and filters of post
« Reply #246 on: March 10, 2018, 10:12:55 AM »
Hi davidhs:

As always, I'm doing awesome stuff with your mod but now I have an issue: I was working with a fields group which were initially "loose field" and then I've changed to "fields with several values per user" because I wanted to make them modifiable without editing the post. I've set it and then the field group didn't show anymore in the post. Then I tried to change it back but unfortunately it keeps hidden from then posts and in the message index.

I've searched in the database but it seems legit with no error. Is there a field in the database which is keeping in conflict? Is there any information you'll need to see? I'd show you the database fields via PM.

EDIT: It seems all the information from that group has been deleted... That's a bug that should be revised. Now I've lost too many fields stored for 2 years :(
First, if you want edit a group of fields always you need edit its post.

A group type "fields with several values per user" has one value for each user. This group can be used for get opinion of users about the content of post. It is not used for add fields to a post.

You can convert a group type "loose fields" to "record" (and vice versa) without losing data because both types have only one value in one post.

But if you convert a group type "loose fields" or "record" to "fields with several values per user" (and vice versa), data of this group are deleted because they are not compability with new type. You are convert a group with only one value to a group with many values.

Do you have backup of your database? If yes you can restore data of your group (I can guide you in the process).
Else, this is not possible. I am sorry.i
Fortunately I had a backup, old but usable.
Good news.

Do you need help?
- 1st Do backup now.
- 2st Change again type of you group to loose data or record (I think record is best in your case).
- 3nd Restore only data of your group:
Code: [Select]
SELECT *
FROM smf_cffp_fields
WHERE id_group =1 // if your group ID is 1, you can see data with this SQL clause

But I suggest to add in a next version at least a warning about this situation in order to avoid issues like this.
Yes, of course. I had noted this.

And dont' forget that I still love with passion this mod.  ;)
Thanks!

And I am sorry very much.

Offline moyack

  • Semi-Newbie
  • *
  • Posts: 34
  • Gender: Male
  • Bootstrap FTW!!
Re: Custom fields and filters of post
« Reply #247 on: March 10, 2018, 06:53:39 PM »
Don't worry, I've fixed the things with your suggestions and everything works as before. The missing part will be done by hand.

Thanks for your help and as always: THE BEST MOD EVER!!!!!

HUGS!!!

Offline moyack

  • Semi-Newbie
  • *
  • Posts: 34
  • Gender: Male
  • Bootstrap FTW!!
Re: Custom fields and filters of post
« Reply #248 on: March 27, 2018, 01:24:25 PM »
Hi!!

It's me again :)

Well, I was just creating a product catalogue with your mod, but when I try to insert data, it allows to fill the data, but it doesn't save it in the database and I can't edit the post to refill the information.

Quote
Image 1: When you insert a new topic, it seems to work...


Image 2: When you see the post, nothing is added and in the database, the data has not been inserted:(

I've checked the settings but I can't find why it doesn't work. Attachments included.

Added the settings so far of this field group: FireShot Capture 1... to FireShot Capture 6.

POSTDATA: this site should implement a spoiler tag to improve presentation.
« Last Edit: March 27, 2018, 01:52:50 PM by moyack »

Offline davidhs

  • Sr. Member
  • ****
  • Posts: 966
  • Gender: Male
Re: Custom fields and filters of post
« Reply #249 on: March 27, 2018, 04:04:56 PM »
I think your problems is this:

You are selected Yes option in Show in sticky topics and Show in locked topics select box. The options of these select box means:
- Yes - Show ONLY in sticky/locked topics
- No - Show ONLY in NOT sticky/locked topics
- All - Show in ALL topics (sticky/locked and not sticky/locked)

This is the reason of your problem:
- When create a new post (topic), the system do not know if your topic will be sticky/locked or not, and you can fill your custom fields.
- When you save this post, system see it is not sticky/locked, and then remove your group of fields (because your group of field only can be added in sticky/locked topics).

Perhaps you should select option No in both cases.



I have some comments (can be usefull):

1. You has defined your "Catalogo de productos" as type loose fields (campos sueltos). I think your group is really a record (Registro).

2. Name of this group can be "Producto" instead of "Catalogo de productos" (when you add a topic in forum "Productos para la venta" you want add one product (not a catalogue of products). A catalogue of products have various products (really your forum "Productos para la venta" is your catalogue. ;)

3. Your field "Imágenes" have this format: attach1,attach2,attach3,... You can use the setting Show enclosed within text (Mostrar dentro del texto) with PHP code in orden to split names of file and show images of each file:
Code: [Select]
<?php

$attach 
'{INPUT}';
$attach_array explode(','$attach);
foreach (
$attach_array as $att)
echo '<img src="...">'// Show image of $att.

?>

4. Your field "Precio base" show prices in euros... I supouse. You can add euro sign with the setting Text next (Texto posterior):
Code: [Select]
Euro sign will be added after input button and after number.

5. Also you can use this in your field "Descuento" in order to show % after input button and after number:
Code: [Select]
%
6. I suppose you have many marks to write in your field "Marca del producto" and you do not know name of all in this moment, and new marks can be created. Instead use radio buttons you can use a combo box (cuadro combinado). This button have a text button (you can write a new mark) and a select box (you can select one ark added before).

:)