Simple Membership Plugin › Forums › Simple Membership Plugin › Extraction of logged in memebers information
- This topic has 11 replies, 2 voices, and was last updated 1 month ago by
admin.
-
AuthorPosts
-
September 25, 2026 at 12:05 pm #32352
cowiz
ParticipantHello. Please i wish to know how i can extract individual info for a logged in user because currently, all the info for a logged in user are generated by a single membership tag. Are there other tags for logged in user email, expiration date, account status etc? or must i procceed otherwise
September 26, 2026 at 4:32 am #32353admin
KeymasterIf you want to show individual details of the logged-in member (instead of the combined block shown by the login form), you can use the Show Member Info addon. It gives you a shortcode that outputs one field at a time, for example:
[swpm_show_member_info column=”email”]
[swpm_show_member_info column=”account_state”]
[swpm_show_member_info column=”expiry_date”]
[swpm_show_member_info column=”membership_level_name”]You can place each one anywhere on a page. The full list of supported fields is on the addon page:
https://simple-membership-plugin.com/simple-membership-addon-show-member-info/For the expiry date only, the core plugin also has this shortcode:
[swpm_show_expiry_date]
If you need the data in custom PHP code instead, you can use:
if ( SwpmMemberUtils::is_member_logged_in() ) { $member_id = SwpmMemberUtils::get_logged_in_members_id(); $email = SwpmMemberUtils::get_member_field_by_id( $member_id, 'email' ); }If I’ve misunderstood what you’re trying to do, please give a little more detail on where you want this information to appear or be used.
September 26, 2026 at 6:02 pm #32354cowiz
ParticipantIf i am using the [swpm_show_expiry_date] tag, can i customize the appearance the that date? For example if i want the date to be the previous day at 11:59PM, so instead of september 6, 2026 let it be something like september 5, 2026 at 11:59pm
September 27, 2026 at 4:56 am #32355admin
KeymasterThe [swpm_show_expiry_date] shortcode doesn’t currently have an option to change the date that way. It shows the expiry date in the format set under Settings -> General -> Date Format, but it can’t move it to the previous day or add a time.
We’ve added two new filter hooks to this shortcode, and they will be included in the next release of the plugin (v4.8.4). Once you’ve updated, you can add the following code to show the expiry date as the previous day at 11:59pm:
add_filter( 'swpm_show_expiry_date_value', function( $expiry_date, $expiry_timestamp ) { if ( $expiry_timestamp == PHP_INT_MAX ) { return $expiry_date; // No expiry. } return date_i18n( 'F j, Y', $expiry_timestamp - DAY_IN_SECONDS ) . ' at 11:59pm'; }, 10, 2 );You can add it using a plugin like Code Snippets, or in your child theme’s functions.php file. For example, an expiry date of September 6, 2026 will then show as “September 5, 2026 at 11:59pm”.
Please note this code will only work after you update to the new version v4.8.4. I am aiming to release this version within the next few days.
September 28, 2026 at 5:03 pm #32356cowiz
Participanti am having problems with these simple membership shortcodes:
[swpm_show_member_info column=”email”]
[swpm_show_member_info column=”account_state”]
[swpm_show_member_info column=”expiry_date”]
[swpm_show_member_info column=”membership_level_name”]
when i am not logged in, it says “user in not connected” but the moment i log in, the place becomes emptySeptember 29, 2026 at 4:53 am #32357admin
KeymasterThis is most likely a copy-and-paste formatting issue. When shortcodes are copied from the forum, the straight double quotes (“) often get converted into curly quotes (” or “). The shortcode then can’t recognise the field name, so it outputs nothing when you are logged in.
Please delete the existing shortcodes and type them again manually using straight quotes. For example:
[swpm_show_member_info column="email"] [swpm_show_member_info column="account_state"] [swpm_show_member_info column="expiry_date"] [swpm_show_member_info column="membership_level_name"]If you use the block editor, add them inside a Shortcode block. If you use the classic editor, paste them while in the Text tab, not the Visual tab. This keeps the quotes from being reformatted.
The addon documentation also has a tip about this:
https://simple-membership-plugin.com/simple-membership-addon-show-member-info/#tip-for-copying-and-pasting-the-shortcodeIf it still shows empty after that, please let me know the following:
1) Whether the logged-in account is an actual member account (not just a WordPress admin user without a member record).
2) Whether you use any caching plugin. If you do, try excluding that page from caching.
https://simple-membership-plugin.com/understanding-the-impact-of-caching-on-membership-sites/September 29, 2026 at 1:51 pm #32359cowiz
ParticipantIt is working now, but i don’t like the fact that for a visitor it writes “the user is not yet logged in”. I thought it will provide a much cleaner way to have user information than the current login form. I thought the areas on which it is placed will be empty or maybe not take space until the user is logged in and the information finally appears
September 30, 2026 at 5:27 am #32360admin
KeymasterThe Show Member Info shortcode is designed to show a message when nobody is logged in. To hide those fields completely from visitors, you can try the following:
Wrap them in the section protection shortcode from our free Partial Protection addon.
Install and activate the addon:
https://simple-membership-plugin.com/apply-partial-section-protection/Wrap your member info shortcodes like this:
[swpm_protected visible_to="logged_in_users_only" do_not_show_protected_msg="1"] Email: [swpm_show_member_info column="email"] Account Status: [swpm_show_member_info column="account_state"] Expiry Date: [swpm_show_member_info column="expiry_date"] Membership Level: [swpm_show_member_info column="membership_level_name"] [/swpm_protected]With this, visitors who are not logged in won’t see anything in that area: no labels, no message, and no empty space. Once a member logs in, the information appears.
As before, please type or paste the shortcode in a Shortcode block (or the Text tab of the classic editor) so the quotes stay straight.
October 7, 2026 at 3:49 pm #32361cowiz
ParticipantHello. Please when i create a member’s account,the placeholder for the password tag in the email sent to the user displays “For security, passwords are not sent by email. Use the password reset option on the login page if needed”. Meanwhile it used to show the user’s password before
October 8, 2026 at 4:19 am #32362admin
KeymasterThis is expected behavior in the latest version. Starting with v4.8.4, the plugin no longer includes passwords in registration or activation emails, including accounts created from the admin side. This is a security improvement, because emails are not a safe place to store passwords. Existing email templates that use the {password} tag now show a short note instead, telling the member to use the password reset option if needed.
To make the email read cleanly, you can update the template:
1) Go to Simple Membership -> Settings -> Email Settings.
2) In the registration complete email (and the email activation email, if you use it), remove the line that contains {password}.
3) Add a line telling the member how to sign in, for example: “You can log in here: {login_link}. If you don’t know your password, use the ‘Forgot Password’ option on the login page to set a new one.”
If you create accounts manually and want the member to use a password you chose, please share it with them through a separate, secure channel. Otherwise, the member can simply set their own password using the password reset option.
October 18, 2026 at 10:31 am #32390cowiz
ParticipantPlease i wish to know if there is a way i can intercept the information of the membership creation form during member creation such that i can build a custom solution that will allow me to sent a custom email to the created uer ?
October 19, 2026 at 5:01 am #32391admin
KeymasterYes, you can do this with an action hook. The plugin fires a hook right after a member account is created, and it passes the submitted form data to your function.
Since you create accounts from the admin dashboard, use this one:
swpm_admin_end_registration_complete_user_dataFor members who register themselves using the front-end registration form, the equivalent hook is:
swpm_front_end_registration_complete_user_dataBoth pass an array of the member’s data (user_name, email, first_name, last_name, membership_level, account_state, etc.). Here is an example that sends a custom email when you add a member from the admin side:
add_action( 'swpm_admin_end_registration_complete_user_data', 'my_custom_new_member_email' ); function my_custom_new_member_email( $member_info ) { $to = $member_info['email']; $first_name = isset( $member_info['first_name'] ) ? $member_info['first_name'] : ''; $subject = 'Welcome to our site'; $body = "Hi " . $first_name . ",\n\n"; $body .= "Your account has been created. Your username is: " . $member_info['user_name'] . "\n\n"; $body .= "You can log in here: " . wp_login_url() . "\n"; wp_mail( $to, $subject, $body ); }If you need the member’s ID (for example, to look up more details), you can get the record by email:
$member = SwpmMemberUtils::get_user_by_email( $member_info['email'] ); $member_id = $member->member_id;You can add the code using a plugin like Code Snippets, or in your child theme’s functions.php file.
If you don’t want the plugin’s default email to go out as well, uncheck this option:
Simple Membership -> Settings -> Email Settings -> “Send Email to Member When Added via Admin Dashboard”
Then only your custom email will be sent.
-
AuthorPosts
- You must be logged in to reply to this topic.