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
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}
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
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.
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!
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.
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?
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}
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.