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

Feature Member Plugin - I may not be doing the right search

Development and Programming

Cindy the merciless's avatar
Cindy the merciless
5 posts
19 years ago
Cindy the merciless's avatar Cindy the merciless

Yes, that’s it! I have it working just the way I want now. Thanks Chris.

       
ismschism's avatar
ismschism
5 posts
19 years ago
ismschism's avatar ismschism

I have a related question: how can I display the most recent weblog entry by random author? So rather than bio I’d like to querry for title, summery etc. for a specific weblog, in addition to author screen name and photo.

Here’s how I’m showing author photo

{exp:weblog:entries weblog="example" limit="1" orderby="date"}
<img src="http://example.com/ee/images/member_photos/{exp:pd_memberinfo field="photo_filename"}{author_id}{/exp:pd_memberinfo}" width="{exp:pd_memberinfo field="photo_width"}{author_id}{/exp:pd_memberinfo}" height="{exp:pd_memberinfo field="photo_height"}{author_id}{/exp:pd_memberinfo}" alt="" />
{/exp:weblog:entries}

Pretty clunky, but the best I could figure. Is there a better way?

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

I was looking for a way to display entries by random authors and found this thread. I didn’t know that EE allows us to nest exp:weblog tags inside exp:query tags but I gave it a try anyway. Now it looks like it’s doing what I need.

First I use SQL to query for random usernames from the exp_members table checking if they have entries using the last_entry_date column, then I just use the username tag inside the exp:weblog tag.

{exp:query sql="SELECT username FROM exp_members WHERE group_id='17' AND last_entry_date > 0 ORDER BY rand() LIMIT 3"}

{exp:weblog:entries weblog="sl_main" status="not closed" dynamic="off" disable="pagination|trackbacks" username="{username}" limit="1"}

{if avatar}
{avatar_url}
{if:else}
/images/spacer.gif
{/if}

{title}
{exp:word_limit total="15"}
{body}
{/exp:word_limit}

{/exp:weblog:entries}


{/exp:query}

I’m surprised that EE can handle this. Even if it isn’t an elegant solution, EE seems to figure it out.

       
ovation01's avatar
ovation01
42 posts
17 years ago
ovation01's avatar ovation01

This is a great tip. Thanks everyone.

One question (as I am a n00b with queries)…

How can you make the query return ONLY members whose data are NOT empty? Specifically, I only want to display members who have data in both “bio” and “avatar_filename”. I’ve tried the !=”” route, but no luck.

Thanks!

EDIT

I figured it out. I was using double quotes (!=”“) instead of single quotes (!=”). Duh!

       
1 2

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.