Feature Member Plugin - I may not be doing the right search
Posted: 15 July 2005 01:21 PM   [ Ignore ]  
Summer Student
Total Posts:  12
Joined  06-30-2005

I’m looking for a feature member plugin to use with ExpressionEngine so that a random username, picture and small snippet of information could be placed on a main page everytime it was viewed.  I know this simple little thing has to have been implemented already but I’ve yet to come across it.  Could someone point it out to me please?

Regards,
  Jerry

Profile
 
 
Posted: 15 July 2005 02:49 PM   [ Ignore ]   [ # 1 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1338
Joined  02-12-2003

I’ve never heard of a plugin that does this.

Jamie

Profile
 
 
Posted: 15 July 2005 05:20 PM   [ Ignore ]   [ # 2 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  9853
Joined  06-19-2002

It would probably be rather easy to do using the {exp:query} tag.  Maybe something like:

{exp:query sql="SELECT screen_name AS user_screen_name, photo_filename, bio FROM exp_members ORDER BY rand() LIMIT 1"}

<p>Name: {user_screen_name}</p>

<
p>Photo: <img src="/images/member_photos/{photo_filename}" /></p>

<
p>Bio: {bio}</p>

{/exp:query}

 Signature 

Chris Curtis
chriscurtis.org

Profile
 
 
Posted: 15 July 2005 06:11 PM   [ Ignore ]   [ # 3 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1397
Joined  01-15-2005
Chris Curtis - 15 July 2005 05:20 PM

It would probably be rather easy to do using the {exp:query} tag.  Maybe something like:

{exp:query sql="SELECT screen_name, photo_filename, bio FROM exp_members ORDER BY rand() LIMIT 1"}

<p>Name: [color=red]EE lover[/color]</p>

<
p>Photo: <img src="/images/member_photos/{photo_filename}" /></p>

<
p>Bio: {bio}</p>

{/exp:query}


The code you provided is being phrased as logged in user’s name.
Strange and risky! Is that because you’re a super admin?

 Signature 

EE Duration Tags | {view_count_total}

Profile
 
 
Posted: 15 July 2005 06:27 PM   [ Ignore ]   [ # 4 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23751
Joined  05-20-2002

LOL- it’s showing my name for me!  Think it’s conflicting with a global.  Try something like:

{exp:query sql="SELECT screen_name AS alt_screen_name, photo_filename, bio FROM exp_members ORDER BY rand() LIMIT 1"}

{alt_screen_name}


yada yada

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 15 July 2005 09:25 PM   [ Ignore ]   [ # 5 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  9853
Joined  06-19-2002

Just the forum interpreting the code for some reason.  rob1‘s suggestion is a good one, though.  I went ahead and updated my example to change the variable name.

 Signature 

Chris Curtis
chriscurtis.org

Profile
 
 
Posted: 18 July 2005 08:43 AM   [ Ignore ]   [ # 6 ]  
Summer Student
Total Posts:  12
Joined  06-30-2005

Chris that about did it, thank you.  This software is fun to work with.

Profile
 
 
Posted: 19 July 2005 08:41 AM   [ Ignore ]   [ # 7 ]  
Summer Student
Avatar
Total Posts:  11
Joined  07-19-2005

That code works great!

How would I do the same thing if I wanted to profile a specific member instead of a random member?

Also how would I profile the author of an article on a permalink page?

Profile
 
 
Posted: 19 July 2005 10:46 AM   [ Ignore ]   [ # 8 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  9853
Joined  06-19-2002

I think the Member Info Plugin should do what you want, Cindy.

For a specific member, you can just hard-code the member ID in the Plugin tag.

For the author on a specific entry, just put the plugin tag inside your {exp:weblog:entries} tag and use the {author_id} variable to set the member ID.

 Signature 

Chris Curtis
chriscurtis.org

Profile
 
 
Posted: 19 July 2005 02:34 PM   [ Ignore ]   [ # 9 ]  
Summer Student
Avatar
Total Posts:  11
Joined  07-19-2005

That did the trick. Thanks Chris.

Profile
 
 
Posted: 19 July 2005 02:41 PM   [ Ignore ]   [ # 10 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  33276
Joined  05-14-2004

Wiki’d

 Signature 
Profile
MSG
 
 
Posted: 10 August 2005 01:05 PM   [ Ignore ]   [ # 11 ]  
Summer Student
Avatar
Total Posts:  11
Joined  07-19-2005

Those two methods worked fine but now I want to profile the currently logged in user.

screen_name and photo_{member_id}.jpg work well for Name and Photo but how do I display the Bio? Is it a variable or a query or what?

Also I want to limit how much of the Bio is displayed to about 180 characters with a link to a page with the full profile. Is this possible?

Thanks so much!

Profile
 
 
Posted: 10 August 2005 04:08 PM   [ Ignore ]   [ # 12 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  9853
Joined  06-19-2002

You should be able to use the Member Info plugin still and just use the {member_id} global variable to supply the current user’s ID.

As for limiting the Bio display, try the “word limiter” or “Filter HTML” plugins.  You may need to worry about the parse order of the plugins when you nest them.

 Signature 

Chris Curtis
chriscurtis.org

Profile
 
 
Posted: 11 August 2005 08:37 AM   [ Ignore ]   [ # 13 ]  
Summer Student
Avatar
Total Posts:  11
Joined  07-19-2005

Chris I am starting to bang my head on the desk. I am using this code with no luck:

<strong>{exp:pd_memberinfo field='screen_name'}{member_id}{/exp:pd_memberinfo}</strong><br>

<
strong>Bio:</strong> {exp:pd_memberinfo field='bio'}{member_id}{/exp:pd_memberinfo}

If I hard code the member ID the code works or if I just have the member_id tag by itself it will return the correct number. But when I put the two together I get a blank.

Can you think of what I need to look at to fix this?

Profile
 
 
Posted: 11 August 2005 11:48 AM   [ Ignore ]   [ # 14 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  9853
Joined  06-19-2002

Hmm, I bet the Plugin is getting parsed before the {member_id} Global Variable is populated with a value.

You can get around this using some PHP if you want.  You’ll need to set your Template to enable PHP parsing and specify “input” parsing.  Then at the top of your Template you can add something like:

<?php

global $SESS;

$member_id = "";
$member_id = $SESS->userdata['member_id'];

?>


Then, when you need to use the Member Info plugin, echo the member ID out:

{exp:pd_memberinfo field='screen_name'}<?php echo $member_id; ?>{/exp:pd_memberinfo}

 Signature 

Chris Curtis
chriscurtis.org

Profile
 
 
Posted: 12 August 2005 07:06 AM   [ Ignore ]   [ # 15 ]  
Summer Student
Avatar
Total Posts:  11
Joined  07-19-2005

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

Profile
 
 
Posted: 16 September 2005 05:16 PM   [ Ignore ]   [ # 16 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  133
Joined  01-25-2004

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?

Profile
 
 
Posted: 02 October 2007 09:33 AM   [ Ignore ]   [ # 17 ]  
Summer Student
Avatar
Total Posts:  6
Joined  12-11-2003

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}
<img src="{avatar_url}" alt="{screen_name}" />
{if:else}
<img src="/images/spacer.gif" width="60" height="60">
{/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.

Profile
 
 
Posted: 09 January 2008 07:01 PM   [ Ignore ]   [ # 18 ]  
Lab Assistant
RankRank
Total Posts:  125
Joined  04-23-2005

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!

 Signature 

Carlyn
http://www.motivationtomove.com

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 66467 Total Logged-in Users: 24
Total Topics: 84859 Total Anonymous Users: 15
Total Replies: 455330 Total Guests: 173
Total Posts: 540189    
Members ( View Memberlist )