0

I'm using Safecracker Registration so I can leverage Channels for my member data. When the member is logged in (in my own UI, not EE's CP), is there a way for me to get the entry id in the Channel that's associated with the member?

My idea is to do a search like:

{exp:channel:entries channel="profiles" author_id="CURRENT_USER"}
   {entry_id}
{/exp:channel:entries}

Presumably, there will only be one entry_id. And although this may work, I'm reluctant to use this approach because I'll need to loop through this exact same channel several times on that page (e.g. in the header, in the footer, etc.) as my templates are broken up into parts for reusability.

I'm hoping for a non-Stash solution at this point. Suggestions?

2 Answers 2

1

Your proposed solution should work fine, it's exactly what I use. What is your issue with using that tag?

An alternative would be to use my Entries plugin, which is free. Stash however is perfect for this. The logic is, you stash the output of that entries tag and output in multiple places in the template. So you run the logic 1 time and output it where it is needed. I can understand not wanting to use Stash if it's a little complicated and verbose.

Here is an example of my Entries add-on. This tag is nestable within other channel entries tags and can even be prefixed. Entries is stable, I use it on every site, I just haven't officially released it yet.

{exp:entries:profile channel="profiles"}
    {entry_id}
{/exp:entries:profile}

https://objectivehtml.com/entries/documentation/tag/profile

2
  • In response to your question, my issue is that I'd be doing this multiple times throughout the page. That's a database call each time, right? Perhaps if I added disable=categories|category_fields|custom_fields|member_data|pagination, it won't be so bad? Jul 2, 2013 at 21:34
  • Well technically, Stash is embracing DRYness. It's not a matter of whether it will slow the page down, but philosophically not repeating yourself. Redundant logic is just that - redundant. Go ahead and do it and see if it works and optimize later. Jul 3, 2013 at 2:09
0

Have you tried:

{exp:channel:entries entry_id="{entry_id}"}
    {entry_id}
{/exp:channel:entries}
3
  • This was still an effort to help which may or may not work in the given situation. Justin has since stepped in to provide an alternative answer which in this case is a better fit for the person asking the question, and I agree. Providing code examples in comments is not really the intention of comments and the idea of SE isn't just to limit to one single answer per question and it's impossible to provide the absolute correct/best answer every time. Help and alternative suggestions are both useful to have.
    – Ian Young
    Jul 4, 2013 at 11:40
  • Hi Ian, the content of my first comment was autogenerated by the review system after your answer was flagged for review, so sorry it was a little terse. The answer was flagged for being (too) short, and I read it perhaps a little quickly, anyway I've deleted my first comment, and will remove this (for neatness) once I'm sure you've read it. Tom
    – Tom Davies
    Jul 5, 2013 at 10:52
  • Hi Tom, no worries. I maybe should have provided a bit more of an explanation with it but at that point was just looking to get a point to start from before editing the answer. Much appreciated. :)
    – Ian Young
    Jul 5, 2013 at 11:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.