[TH] Custom Fields [Deleted]

I want to use this to add a field to the Articles in the Library addon.
This is to create a "Contents" box top and optionally bottom too of all pages in a multi-page Article.
When I have it figured out - with help here and Jon - I'll post it up here and on Library.

FIRST I cant see how to get this dang thing STARTED! I reproached Jon saying he should put a get started note in his RM Description and he says no one reads them except me! I'm sure that's not true.

Attempting ... I checked the images for this addon and they start with Users/ Custom User Fields/ Create New Field.
Basic Info tab:
Display Location:
  • Personal
  • Contact Details
  • Preferences
    These fields will never be displayed on a user's profile.
I dont want it on any of those - I want it on an Article. I get it that I put the new field ID in the Library node.
But what do I do with those 3 options above?

Have no idea what the "Choice Fields" tab is about?

General Options tab - User editable. I only want my Library editors (one of my usergroups) to be able to edit this field.
Just checking it wouldn't be accessible to edit for other users if this is ticked?

Placement. I want this field to display both above and below a multi page Article?
(Not a single page Article, so it needs to activate at Page 2.)

Duplication. I want this field to duplicate ANY ADDITIONAL info inserted on ANY page of a multi-page Article into the similar Contents boxes on the other Pages.
Why? When I create a Contents list for an Article it looks like this:

PAGE 1: Introduction including X and Y.
PAGE 2: Celts and Romans. The prehistoric period.
PAGE 3. The Reality of Conquest.
PAGE 4. The Princes. From Arthur to Llewellyn.

- each links to the page. At present I have to get the URL for each page separately and paste it into the URL link in the Contents list.
Then I have to copy/paste the whole thing on to every page separately.
Then if I update by adding a Page .... I have to add that URl to the list AND Copy/ paste it to all the other Pages. Since some of my Articles can be anything from 5 to 20 pages .... and growing .... URRRGH
So I want to add Contents info to any Page and it automatically duplicates the same addition to all the other Contents boxes for this multipage Article.
 
First thing first, before trying to explain further : fields that can be displayed in Articles are not User Fields, they are Thread Fields set at yourdomain.com/admin.php?thread-fields/

If I understand your requirement, you want User Fields from the author of the article to display in the article pages? I looked quickly into it and I'm affraid this will require a couple of code lines, because author's fields are not loaded into the view params.

For your other questions:
- Choice fields are different from Text fields: they appear under the shape of checkboxes, combo boxes, etc., where a user can select a value, but cannot input anything.
- With Waindigo addon, you are indeed able to restrict a field edition to selected groups.
- I think Article Fields only appear on the first page of articles. This behaviour can be modified, though it needs quite more code customization.

For reference, see this example : http://kosminea.fr/library-articles/seuls.24/
The blue table on top of the article is made only of Custom Thread Fields. It only appears on the first page of an article.
But you can also find a customized bottom section that adds info about the author, especially the Twitter account that is a User Field, and a short paragraph "Le mot de l'auteur" that is a Custom User TextField, set by the author into its personnal details panel. But this required code modifications.
 
Hi there,

Is there a way to get the custom fields above the post box when a user creates a new thread? Currently it sits below it and I would like it to sit above it. I can't seem to find the template to move it above.

Thanks.

Can this be done?
 
Can this be done?
Answer:
Actually just used a conditional inside thread_create like:

<xen:if is="{$forum.node_id} !== 74">
regular thread create
<xen:else />
custom thread create removing poll/open/stick options rearranging the hook area to go below the title to allow:

Title -> Custom Fields -> Regular text editor
</xen:if>

It's a bit limited since users still have to type something into the editor(until I figure it out otherwise) but it works :)

It will be added as an option in a future version of this add-on.
 
Would be willing to make a healthy donation for the next version with those features of being able to move stuff around above the editor etc like Russ did, I could use this for a project a friend has coming up.
 
Would be willing to make a healthy donation for the next version with those features of being able to move stuff around above the editor etc like Russ did, I could use this for a project a friend has coming up.
Sounds good. This is one of my favourite add-ons, so I'd really like to see it get better and better. Please drop me a PM.
 
Hi, I am using PHP Callback to verify value entered. Can you tell me how to make it required? i don`t see a option like it and also i get a blank page in Advanced Options Tab is that Normal?
 
Hi, I am using PHP Callback to verify value entered. Can you tell me how to make it required? i don`t see a option like it
When you edit one of the nodes that you have created a thread field for, go to the Thread Fields tab and you can set the required thread fields there.

and also i get a blank page in Advanced Options Tab is that Normal?
Yes. If you have debug mode enabled, you will see options there.
 
Thanks for the information.

I tired that it works great but if i post a wrong code in it, i have set a custom error code to be displayed but it shows the default message that it is a required field. Also i want this to be required for members only i.e. admins can post as blank value. How can i do that?
 
Thanks for the information.

I tired that it works great but if i post a wrong code in it, i have set a custom error code to be displayed but it shows the default message that it is a required field. Also i want this to be required for members only i.e. admins can post as blank value. How can i do that?
You would have to throw an error through your custom validation code and set it as not required.
 
I tried that but it is not working.

I tried to pass the $value from 3 tests like this
Code:
        if ( !isset($value)  || empty($value) || $value == "")
        {
            $error = 'Fill in something';
            return false;
        }

but it is not taking this code. can you help?
 
Yes i am doing that. The error field works if the validation goes false(when set not required) but this code don`t work at all. I am also clueless why is that happening.
 
I am creating a custom code to check if user is allowed to get support by checking the item purchase code with evento api. here is the code for it

Code:
<?php
 
class CodeThrust_Evento_Validate
{
 
    public static function validate($field, &$value, &$error)
    {
 
        if ( !isset($value)  || empty($value) || $value == "")
        {
            $error = 'Fill in something';
            return false;
        }
        else
        {
            //Perform validation here
 
            if(true)
            {
 
                return true;
            }
            else
            {   
                $error = 'Please enter a Valid Code.';  // this erro message works
                return false;
            }
        }
    }
}
 
I am creating a custom code to check if user is allowed to get support by checking the item purchase code with evento api. here is the code for it

Code:
<?php
 
class CodeThrust_Evento_Validate
{
 
    public static function validate($field, &$value, &$error)
    {
 
        if ( !isset($value)  || empty($value) || $value == "")
        {
            $error = 'Fill in something';
            return false;
        }
        else
        {
            //Perform validation here
 
            if(true)
            {
 
                return true;
            }
            else
            { 
                $error = 'Please enter a Valid Code.';  // this erro message works
                return false;
            }
        }
    }
}
Looks like the validation script is never called if $value is blank. Turns out this is exactly the same as how Custom User Fields (which is part of XenForo core) behaves, so this is not a bug with this add-on.
 
Oh thanks

But if we mark this as required even then we are shown the same message even if we set a custom one. Like if you check the above code and if change the value to false in validation if statement. It still gives us a default Custom text required warning.
 
Top Bottom