ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Search param not working

June 18, 2012 11:06am

Subscribe [3]
  • #1 / Jun 18, 2012 11:06am

    GlennJ

    65 posts

    I’m trying to do this, but it won’t work. If I hardcode the email then it runs fine and the {email} value is correct.

    {exp:channel:entries channel="contacts" limit="10" search:contact_email="={email}"}

    Any ideas??

  • #2 / Jun 19, 2012 1:37pm

    Shane Eckert

    7174 posts

    Hello GlennJ,

    I am sorry to hear you are running into this problem.

    Can you try this and see if it works?

    {exp:channel:entries channel="contacts" limit="10" search:contact_email="{email}"}

    Thank you,

  • #3 / Jun 20, 2012 5:05am

    GlennJ

    65 posts

    I have tried that and no luck unfortunately. It seems like the {email} parameter isn’t passed early enough to be included. If I make an entry have the value of “{email}” it matches!

    Using the following code works, but it’s not secure for my purpose

    {exp:channel:entries channel="contacts" limit="10" search:contact_email="={segment_3}"}
  • #4 / Jun 21, 2012 7:27am

    GlennJ

    65 posts

    Anyone? Could really do with some help on this…

  • #5 / Jun 21, 2012 12:55pm

    Shane Eckert

    7174 posts

    Hey GlennJ,

    You are right. I am sorry about not catching that. The Parse Order lists email as being parsed last. Doh!

    Can you tell me what you are trying to accomplish? Maybe I can help you think of another way to get there.

    Please let me know.

    Cheers,

  • #6 / Jun 21, 2012 1:03pm

    GlennJ

    65 posts

    OK, here goes!

    We have a system externally which contains emails from clients and we want to show this in their website account areas. I used a plugin which enables me to connect to ExpressionEngine via SOAP to enter new channel entries into EE, however I can only do this as one specified user.

    So what I get is a channel of data all with the author of an admin. I have a custom field which stores the client’s email address.

    So, I need to pull out the entries from this channel where the logged in user’s email matches this custom field.

    I can’t think of another way to do it, as there’s no other way of me importing the data. Of course ideally the author of each entry would be set to the user, but as mentioned I can’t do it.

    I’ve even created a custom plugin to grab the email address in a different way, but this made no difference.
    My only thought now is to make a custom plugin that searches the exp_channel_data table on the specific field and returns the matching ID’s, which I can then pump into channel:entries.

    But open to other ideas!

    Thanks

  • #7 / Jun 21, 2012 1:30pm

    GlennJ

    65 posts

    I tried my plugin idea to return the entry id’s… they output to screen fine, but when I pump them into channel:entries I still get nothing!

    {exp:fieldsearch channel_id="10" field_id="96" userinfo="email"}
    
    
    {exp:channel:entries entry_id="{exp:fieldsearch channel_id="10" field_id="96" userinfo="email"}"}
                  
                  <h5>{title}</h5>
    <p>              {body}<br />
                  <hr><br />
                                <br />
    {/exp:channel:entries}

    Losing the will to live… LOL

  • #8 / Jun 21, 2012 1:44pm

    GlennJ

    65 posts

    OK, modified my custom plugin and it works a treat. Still feels a bit like a hack, but it’s programmed correctly so isn’t really. I just feel there must be a simpler way of doing it…

    This is what I did…

    {exp:fieldsearch channel_id="10" field_id="96" userinfo="email" parse="inward"}
    
                  {exp:channel:entries entry_id="{search_results}"}
                  
                  <h5>{title}</h5>
    <p>              {body}<br />
                  <hr><br />
                                <br />
                  {/exp:channel:entries}<br />
                      <br />
    {/exp:fieldsearch}

  • #9 / Jun 21, 2012 5:18pm

    Shane Eckert

    7174 posts

    Hey GlennJ,

    Nice work. It does not look hacky to me. You got something to work that is pretty complicated. Nice.

    Is there anything else I can help with?

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases