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

jerryodom's avatar
jerryodom
1 posts
19 years ago
jerryodom's avatar jerryodom

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

       
Jamie Poitra's avatar
Jamie Poitra
409 posts
19 years ago
Jamie Poitra's avatar Jamie Poitra

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

Jamie

       
Chris Curtis's avatar
Chris Curtis
17 posts
19 years ago
Chris Curtis's avatar Chris Curtis

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"}

Name: {user_screen_name}

Photo: /images/member_photos/{photo_filename}

Bio: {bio}

{/exp:query}
       
EE lover's avatar
EE lover
50 posts
19 years ago
EE lover's avatar EE lover
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"}

Name: [color=red]EE lover[/color]

Photo: /images/member_photos/{photo_filename}

Bio: {bio}

{/exp:query}

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

       
Robin Sowell's avatar
Robin Sowell
13,158 posts
19 years ago
Robin Sowell's avatar Robin Sowell

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

       
Chris Curtis's avatar
Chris Curtis
17 posts
19 years ago
Chris Curtis's avatar Chris Curtis

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.

       
jerryodom's avatar
jerryodom
1 posts
19 years ago
jerryodom's avatar jerryodom

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

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

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?

       
Chris Curtis's avatar
Chris Curtis
17 posts
19 years ago
Chris Curtis's avatar Chris Curtis

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.

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

That did the trick. Thanks Chris.

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
19 years ago
Lisa Wess's avatar Lisa Wess

Wiki’d

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

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!

       
Chris Curtis's avatar
Chris Curtis
17 posts
19 years ago
Chris Curtis's avatar Chris Curtis

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.

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

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>


<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?

       
Chris Curtis's avatar
Chris Curtis
17 posts
19 years ago
Chris Curtis's avatar Chris Curtis

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}
       
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.