We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Custom Fields in {exp:weblog:entries /}

Development and Programming

Mark Huot's avatar
Mark Huot
587 posts
17 years ago
Mark Huot's avatar Mark Huot

Post away, thanks UltraBob

       
UltraBob's avatar
UltraBob
186 posts
17 years ago
UltraBob's avatar UltraBob

Here is the best guidance I can figure out quicky. (I don’t know why the syntax highlighting engine doesn’t the comments at the end)

Find this (about line 2375):

/** ----------------------------------------
        /**  Do we need pagination?
        /** ----------------------------------------*/
        
        // We'll run the query to find out
        
        if ($this->paginate == TRUE)
INSERT THIS RIGHT [b]BEFORE[/b] THAT LINE:
// -------------------------------------------
                // 'build_sql_query' hook.
                //  - Rewrite, or add to the sql query
                //
                    global $EXT;
                    if (isset($EXT->extensions['build_sql_query']))
                    {
                        $sql = $EXT->call_extension('build_sql_query', $sql, $this);
                        if ($EXT->end_script === TRUE) return;
                    }
                //
                // -------------------------------------------

FIND THIS (about line 500):

$sql = "SELECT rel_id, rel_parent_id, rel_child_id, rel_type, reverse_rel_data
                FROM exp_relationships
                WHERE rel_child_id IN ('".implode("','", array_keys($this->reverse_related_entries))."')
                AND rel_type = 'blog'";

INSERT THIS RIGHT AFTER THAT LINE:

// -------------------------------------------
                // 'build_reverse_sql_query' hook.
                //  - Rewrite, or add to the sql query
                //
                    global $EXT;
                    if (isset($EXT->extensions['build_reverse_sql_query']))
                    {
                        $sql = $EXT->call_extension('build_reverse_sql_query', $sql, $this);
                        if ($EXT->end_script === TRUE) return;
                    }
                //
                // -------------------------------------------

The second one seems to actually be first in mod.weblog.php now unless I stuck something in the wrong place (very possible). I hope this helps. Finally, may I suggest that we start up a custom entries extension cookbook page on the wiki? People could put their example queries up there, as there seems to be quite a bit of confusion as to how to effectively use this extension. It seems like more examples would help.

       
Mark Huot's avatar
Mark Huot
587 posts
17 years ago
Mark Huot's avatar Mark Huot

thanks UltraBob. I’ve checked your placements and they seem to be correct. The extension’s comments have also been updated.

       
Adam George's avatar
Adam George
283 posts
17 years ago
Adam George's avatar Adam George

Is it possible to test if the custom field is not NULL?

       
UltraBob's avatar
UltraBob
186 posts
17 years ago
UltraBob's avatar UltraBob

I think testing for field=”>” does the trick

       
Adam George's avatar
Adam George
283 posts
17 years ago
Adam George's avatar Adam George

Hmm, I wish you were right, but sadly it appears not :(

       
UltraBob's avatar
UltraBob
186 posts
17 years ago
UltraBob's avatar UltraBob

Can only say “works for me”

       
roger2000's avatar
roger2000
1 posts
17 years ago
roger2000's avatar roger2000

I am just trying this extension for my old EE 1.5 site. After checking out this thread a bit, it works fine now. IT’s GREAT.

But I discovered that when I change a field in the weblog to a “RELATIONSHIP” field, it returns no records. I am sure that I only change a field to “RELATIONSHIP” before that it’s working and returning what I want.

Can anyone help ? Or how can I deal with a relationship field where I want to display a value according to the current weblog field ?

Roger.

       
Adam George's avatar
Adam George
283 posts
17 years ago
Adam George's avatar Adam George

I have just upgraded to 1.6, and this extension no longer seems to work. Has anyone else experienced this or know a workaround?

Thanks

       
UltraBob's avatar
UltraBob
186 posts
17 years ago
UltraBob's avatar UltraBob

Like I said it work for me, but I think I gave you misleading advice last time, I said you could search for custom_field_name=”<” when what I meant is custom_field_name=”>” Does that make a difference?

       
Adam George's avatar
Adam George
283 posts
17 years ago
Adam George's avatar Adam George

Hmmm, I can’t see the difference!

Actually, I had this extension working fine for other things, but It all stopped working after I upgraded to 1.6… …oh - haha, had to re-do mod.weblog.php now works again, but I still can’t achieve the results described above. I would try your updated suggestion Bob, but I can’t tell the difference between the two 😊

       
UltraBob's avatar
UltraBob
186 posts
17 years ago
UltraBob's avatar UltraBob

either I’m going a bit off my rocker or the forum has been turning my brackets around. Here’s trying again. custom_field_name=”>”

update: Yes I think I found a forum bug, it is turning my greater than into a less than on output. let’s try it in code form:

custom_field_name=">"

Seems to be ok when wrapped in code.

       
Adam George's avatar
Adam George
283 posts
17 years ago
Adam George's avatar Adam George

Thanks, will try 😊

       
MtnX's avatar
MtnX
28 posts
17 years ago
MtnX's avatar MtnX
I have just upgraded to 1.6, and this extension no longer seems to work. Has anyone else experienced this or know a workaround? Thanks

I was having the same problem… had to disable the extension, add the code to the upgraded mod.weblog.php, upload the new version of CUSTOM FIELDS IN TAGS, and reenable. It didn’t work until I tried the enable/disable routine.

Great extension!

       
Adam George's avatar
Adam George
283 posts
17 years ago
Adam George's avatar Adam George

Hey thanks UltraBob, that works 😊

       
First 7 8 9 10 11 Last

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.