The attached add-on files may be out of date. Please visit Devot-ee for the latest versions.
Hi,
I would like to present to your attention a new plugin called “Members”. Its purpose is similar to Yoshi Melrose’s Member Info plugin - to display info about individual members based on each member’s id number.
There are two main differences between my plugin and that of Yoshi:
1) Members plugin adopts entirely different style - it uses variable pairs for every member within exp:members tag instead of simply tag pairs for every member. This allows more control over parsing order because it is possible to wrap with exp:members tag other ExpressionEngine tags.
2) Members plugin can output the values both from fields of exp_members table and from member profile custom fields; Member Info plugin deals only with fields of exp_members table.
PARAMETERS:
1) date_format - Optional. Allows you to specify how the output of the date variables’ should be formatted. Default value is “F %j%S, %Y”. About date formatting see here.
2) localize - Optional. Allows you to specify if the date should be localized. Possible values are “yes” and “no”. Default is “no”.
3) change_y - Optional. Allows you to specify what should be outputted in case variable’s value is “y” (this value means “yes”).
4) change_n - Optional. Allows you to specify what should be outputted in case variable’s value is “n” (this value means “no”).
VARIABLE PAIRS
1) {single_member id="9"}{/single_member} - this variable pair should be used to wrap single variables. No single variable outside this variable pair will be parsed by exp:members tag!
Parameter “id” of the {single_member}{/single_member} variable pair is required. This parameter allows you to specify id number of the individual member.
If you need to output member data of currently logged in user, use “logged_in_user_id” as the value of “id” parameter: {single_member id="logged_in_user_id"}{/single_member}
SINGLE VARIABLES
As a single variable can be used any field name of the table exp_members with “m_” added at the beginning. Also as a single variable can be used the name of any member profile custom field with “m_” added at the beginning. For example since exp_members table has such fields as “email” and “group_id” we can use such single variables as {m_email} and {m_group_id}.
The only exception is this: the value of “password” field of the table exp_members will not be outputted by {m_password} variable; empty string will be outputted instead.
Conditionals are supported for all single variables.
USAGE
Say, you need to output the values of the fields “username”, “last_visit”, “notify_by_default” from the table exp_members and the values of member profile custom fields “contacts” and “preferred_language” for the members having member id 7 and 11. To achieve this you can use the code as this:
{exp:members date_format="%D, %F %d, %Y - %g:%i:%s" localize="yes" change_y="yes" change_n="no"}
{single_member id="7"}
Username: {m_username}
Last visit: {m_last_visit}
Notify: {m_notify_by_default}
Contacts: {m_contacts}
Preferred language: {m_prefered_language}
{/single_member}
{single_member id="11"}
Username: {m_username}
Last visit: {m_last_visit}
Notify: {m_notify_by_default}
Contacts: {m_contacts}
Preferred language: {m_prefered_language}
{/single_member}
{/exp:members}
Changelog:
-1.3 // Added “logged_in_user_id” as possible value of “id” parameter. -1.2 // Fixed bug - global variables interfering with plugin’s variables. -1.1 // Added support for conditionals. -1.0 // Initial release.
I have released version 1.1 of Members plugin.
In this release support for conditionals was added. Now you can use any single variable inside conditionals. For example, this code is now possible:
{exp:members}
{single_member id="7"}
Username: {username}
{if email!=""}Email: {email}{/if}
{/single_member}
{/exp:members}
I have released version 1.2 of Members plugin.
In this release serious bug - ExpressionEngine’s global variables interfering with plugin variables - was fixed.
In order to prevent global variables interfering with plugin’s variables I adopted following solution: to prefix “m_” string to every single variable.
For example, since there are fields “email” and “group_id” in exp_members table, single variables {m_email} and {m_group_id} are now available for use in Members plugin.
Is it possible for the Plugin to be aware of the currently logged in member_id for the single_member variable pair? For example, would this work:
{exp:members}
{single_member id="{member_id}"}
Username: {username}
{/single_member}
{/exp:members}
If the Plugin doesn’t natively allow this, could PHP be used?
Hi Ryan,
It seems that using EE global variables or tags it is impossible to achieve what you need.
But after enabling PHP it is possible, of course.
You should enable PHP in your template and the value of “PHP Parsing Stage” should be “Input”.
Then add in your template the code:
<?php
global $SESS;
$logged_in_user_id = $SESS->userdata['member_id'];
?>
{exp:members}
{single_member id="<?php echo $logged_in_user_id; ?>"}
Username: {username}
{/single_member}
{/exp:members}
When I will release a new version of Members plugin, it will be enhanced so that no PHP will be needed in order to retrieve member data of logged in user.
Cheers.
I released version 1.3 of Members plugin.
In this release “logged_in_user_id” was added as possible value of “id” parameter. Use it to retrieve member data of currently logged in user:
{exp:members date_format="%D, %F %d, %Y - %g:%i:%s" localize="yes" change_y="yes" change_n="no"}
{single_member id="logged_in_user_id"}
Username: {m_username}
Last visit: {m_last_visit}
Notify: {m_notify_by_default}
Contacts: {m_contacts}
Preferred language: {m_prefered_language}
{/single_member}
{/exp:members}
Hi Laisvunas, could you be so kind and tell me, if I can work with your plugin in the following situation:
I have a single entry page and I´d like to have the EE contact form nextz to the entry, so that users can contact the author of the respective article directly.
The users should type in their question/request, hit the send-button and the contact form will send a mail directly to the author. So much for the theory.
In order to achive this i need to put the author´s email-address into “recipients”. See code below
{exp:email:contact_form user_recipients="false" recipients="[email protected]" charset="utf-8"}
Each author has to be logged in and registered before he can write. So the author´s email-address is available in the authors member profile data.
Can I uses your plugin to pull the email-adress from the user profile and have it placed into the email contact form?
It´s a bit tricky, since the single_entry tag must be dynamically. It´s the member ID of the person, who wrote the arcticle that the single entry page contains… 😉
Bonus: I´d like to also show 3 other custom fields of the member profile as part of the single entry page.
Thanks awa Can i achive this with
Hi awa,
It seems that you should use the code as this:
{exp:members date_format="%D, %F %d, %Y - %g:%i:%s" localize="yes" change_y="yes" change_n="no" parse="inward"}
{single_member id="member_id_number"}
{exp:email:contact_form user_recipients="false" recipients="{m_email}" charset="utf-8"}
{/single_member}
{/exp:members}
Hi Laisvunas- I came across this plugin, but am not 100% sure if this is what I’m looking for. I am trying to modify a forum template that displays the Member List. Instead of displaying the standard columns for ICQ, AOL, etc; I want to display some custom profile fields. I tried (without luck) to just use the short name for those fields like so:
{if country}
{country}
{/if}
That obviously didn’t work, as it just out that code instead of actually outputting the country name.
I think this is where your plugin comes in… Is that correct? If so, how would I do that?
If the field is in the table exp_members, then you can use Members plugin to output its contents.
If you need to output contents of some field from the table exp_members inside a forum template that displays the Member List, then you must to run forum templates through full EE template engine.
Hi Laisvunas,
I have an EE site set up for my church, with a list of members with some custom fields (telephone number, address, etc.).
Is there a way to use your plug-in to create a printable list?
Like this:
Member 1 Name, email, home phone, cell phone, address Member 2 Name, email, home phone, cell phone, address Member 3 Name, email, home phone, cell phone, address … etc.
Have a great day!
Hi deedubya,
it seems that it can be done by using together Members plugin with Loop Plus plugin.
{exp:loop_plus start="1" end="100" increment="1" parse="inward"}
{exp:members date_format="%D, %F %d, %Y - %g:%i:%s" localize="yes" change_y="yes" change_n="no"}
{loop_area}
{single_member id="{loop_count}"}
{m_username}, {m_homephone}, {m_cellphone}, {m_address}
{/single_member}
{/loop_area}
{/exp:members}
{/exp:loop_plus}
As suggested, I’m using the following:
{exp:loop_plus start="1" end="500" increment="1" parse="inward"}
{exp:members date_format="%D, %F %d, %Y - %g:%i:%s" localize="yes" change_y="yes" change_n="no"}
{loop_area}
{single_member id="{loop_count}"}
{if m_username!=""}{m_username}, {m_address_1}{/if}
{/single_member}
{/loop_area}
{/exp:members}
{/exp:loop_plus}
…it partially works, however I get this line repeated over and over at the top of the display before it begins to output member data:
Notice: Undefined index: username in /xxxx/xxxx/xxx/xxxx/admin/plugins/pi.members.php on line 143
Any ideas what I did wrong? I’m on EE 1.6.8. Also, what’s the best way to handle large skips in user ID numbers. 1, 3, 200, 211, 212, 243… etc.
Thanks!!
Hi deedubya,
Grab version 1.3.1 - in it I suppressed the error message.
Also, what’s the best way to handle large skips in user ID numbers. 1, 3, 200, 211, 212, 243… etc.
If you know id numbers of the members you want to display, then use NB Cycle plugin together with Members plugin.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.