News:

Wondering if this will always be free?  See why free is better.

Main Menu

Custom fields and filters of post

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

Previous topic - Next topic

davidhs

Quote from: moyack on December 01, 2017, 02:00:28 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:
/* 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:

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

echo '
<div class="cffp_filters">';


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

<span>', $group['name'], '</span>';

you replace by

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:

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

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)

thepitster

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 518
forgot the
';
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

davidhs

Quote from: thepitster 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 518
forgot the
';
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.

moyack

#243
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 :(

davidhs

Quote from: moyack 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 :(
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.

moyack

Quote from: davidhs on March 07, 2018, 04:55:16 PM
Quote from: moyack 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 :(
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.  ;)

davidhs

Quote from: moyack on March 09, 2018, 10:00:41 AM
Quote from: davidhs on March 07, 2018, 04:55:16 PM
Quote from: moyack 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 :(
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:
SELECT *
FROM smf_cffp_fields
WHERE id_group =1 // if your group ID is 1, you can see data with this SQL clause


Quote from: moyack on March 09, 2018, 10:00:41 AM
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.

Quote from: moyack on March 09, 2018, 10:00:41 AM
And dont' forget that I still love with passion this mod.  ;)
Thanks!

And I am sorry very much.

moyack

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

moyack

#248
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.

QuoteImage 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.

davidhs

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:
<?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):

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:
%

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).

:)

moyack

Hi Davidhs!!

Well, this mod is the best of the best, and I just want to show you a system I made to manage service quotations using a mix of Fields Loose and Fields with several values per member.



It works like a charm and I'm impressed how your mod can manage a huge amount of data easily.

But now I have a small issue. I've set in the Fields with several values per member part the possibility to modify and delete the field. The modification is working but the deletion isn't. I press the button "eliminar" (delete) but it doesn't show anything. The only way to delete this field is with moderation. How can I solve this?


davidhs

Quote from: moyack on June 25, 2018, 03:48:47 PMBut now I have a small issue. I've set in the Fields with several values per member part the possibility to modify and delete the field. The modification is working but the deletion isn't. I press the button "eliminar" (delete) but it doesn't show anything. The only way to delete this field is with moderation. How can I solve this?
Hi, I test this now and works. Perhaps problem is permissions of your group... Can you attach image with permission area of this group?

moyack

#252
Here it is...



BTW, i have other questions:


  • I'm needing to access frequenlty into a common filtering of post, and when I set a query, it produces a link like this: http://acmherramientas.com/index.php?board=2.0;a5b559b8=5c893299647aabfd823d7e52b35b1c4c, unfortunately I can't access to the filter parameters in this way and I can't use this link to make the filtering with a link button. is it possible to configure in any way a predefined filter? if not, I recommend to add some support for filtering though the search link, like using http://acmherramientas.com/index.php?board=2.0;cffp_order=field1&asc=1;cffp_field=field2
  • I'm needing to access the edition of some fields in other parts of the page, I've been exploring the Subs-CustomFieldFilterPost.php but I dont' know how to set the parameters to edit or create new fiels in a specific group.

Thanks in advance for your support :)

davidhs

Quote from: moyack on June 26, 2018, 07:40:22 AM
Here it is... [...]
Sorry, all is ok, I do not see any error/bug in my source code. :( Pershaps this is another conflict with SEF mods... :-\
Quote
Quote from: moyack on March 22, 2016, 05:11:08 PM
Just one question: I've added a rate system. one thing I've noticed is that the first rate should be done twice in order to register the score properly.
Quote from: moyack on March 27, 2016, 01:54:34 AM
Quote from: davidhs on March 23, 2016, 12:59:02 PM
In my test forum this works. When I submit a rate, this is registered.  ???  Can you tell me your steps with images?
Sure, here it is:
1. I've created a new topic, in this case is a resource model. I've set some fields so it can describe the topic properly.
    Edit mode...
2. Before the updates to the custom fields, I had to set twice the value in order to get it registered and visible, now when I select into the rating the option in the select box, it doesn't update the score, I've tried many times and in fact it's storing the ratings, but not the value. Check image below
3. Here's the configuration of these fields...
Quote from: moyack on April 04, 2016, 12:36:45 AM
The issue with the group field of type "fields with several values per member" that it was not registering the values submitted by the users was already solved. It was caused by the conflict with a SEF mod which rewrites the standard URLs with nice ones. In my case I use in my forum Search Engine Friendly URL (SEF) Manager from PortaMX and the solution was to add in the "actions to be ignored" field this ones: cffpeditgroup and cffpsearch.
Can you uninstall your SEF mod and test this?




Quote from: moyack on June 26, 2018, 07:40:22 AM
BTW, i have other questions:

1. I'm needing to access frequenlty into a common filtering of post, and when I set a query, it produces a link like this: http://acmherramientas.com/index.php?board=2.0;a5b559b8=5c893299647aabfd823d7e52b35b1c4c, unfortunately I can't access to the filter parameters in this way and I can't use this link to make the filtering with a link button. is it possible to configure in any way a predefined filter? if not, I recommend to add some support for filtering though the search link, like using http://acmherramientas.com/index.php?board=2.0;cffp_order=field1&asc=1;cffp_field=field2
Yes, you can access to filters of message index with cffp_filters variable.
I suppouse you have in message index of board $id_board some filters of group $id_group.
<?php

// $id_group = ID of your group.
// $id_fieldN = ID of fieldN of group $id_group.
// {FIELD_n_DATABASE} is a variable of this mod. It will be replace by fieldname of field n in database.
// There are more variables in help pages of messages template.

$filters = array(
$id_group => array(
'{FIELD_' $id_field1 '_DATABASE}' => $value1,
'{FIELD_' $id_field2 '_DATABASE}' => $value1,

),
);
$params ';cffp_filters=' cffpUrlParamsCompress($filters);
$url $scripturl '?board=' $id_board '.0' $params;

?>


I never tried to access to order filter but it is a variable with name cffp_order_by. Values (options) are two for each field (see source code of your forum page):
cffpfN.column_M asc
cffpfN.column_M desc

N = ID of group
column_M = Fieldname in database (like {FIELD_n_DATABASE})

I suppouse you can use this, but I never tried:
<?php

$params 
';cffp_order_by=' $value;

?>





Quote from: moyack on June 26, 2018, 07:40:22 AM
2. I'm needing to access the edition of some fields in other parts of the page, I've been exploring the Subs-CustomFieldFilterPost.php but I dont' know how to set the parameters to edit or create new fiels in a specific group.
I am sorry, I do not understand... Can you tell me an example? Also you can send to me a more complex example by PM in Spanish and I understand better. ;) (after, you explain here the solution in English).

Americano

I can't moderate the record fields. If a user posts wrong, I can't change.


I can't include registration for other users, so count as if it were my record.

Please, what can I do?

davidhs

Quote from: Americano on July 31, 2018, 10:52:21 PM
I can't moderate the record fields. If a user posts wrong, I can't change.


I can't include registration for other users, so count as if it were my record.

Please, what can I do?
Perhaps your group/fields have a problem with permissions?
Can you attach images with their settings?

Americano


davidhs

Quote from: Americano on August 01, 2018, 06:42:40 PM
Follow the image of my problem
I think I saw your problem...

You want modify group TD (with field Avaliação). Correct?

If you use the "modify quickly" button of bellow of post (with only icon), you can modify only the body of post (neither custom fields, neither attachments,...).

If you want modify more things (for example, custom fields o attachments), you must use Modify button of top of post (with icon and text, near other buttons: Quote, Remove,...).

Americano

Ok! Thank you. I was able to modify it for another user.

But I wanted the administrator could include custom records for other users when they forget to post.

The administrator can even add the record to another user, but it counts the record to the administrator.

In fact, I wanted the record to be computed for the owner of the message and not for the administrator.

davidhs

Quote from: Americano on August 02, 2018, 05:57:36 PM
But I wanted the administrator could include custom records for other users when they forget to post.

The administrator can even add the record to another user, but it counts the record to the administrator.

In fact, I wanted the record to be computed for the owner of the message and not for the administrator.
Sorry, this is not possible. If a user creates a group of fieldls, he is the creator. And if other user modifies values of this group, this another is the modificator.

In setting of a group you can check show/hide user name and data of creation and last modification.

An enhancement for next versions of this mod can be add an option for reattribute groups of fields to other user (similar to reattribute post in SMF 2.0+). This is easy, or very usefull? Really I do not know...  ??? Now you can hide creation/modification data of a group of fields and show only creation data of the post.

Advertisement: