Membership headache
-
[ Moved to the Fixing WordPress sub-forum. ]
Hi peeps
I’m still having trouble finding the correct Membership plug in for my site.
This is what I’m after if someone can help.It’s a Membership where Members log in and immediately end up on their own unique, specific page (one page only) that no other Member sees and it contains an editable excel spreadsheet on it that saves immediately upon editing and retains the saved info until they log in next time. So it’s a LIVE editable spreadsheet. I would create one page for each Member that the specific Member gets directed to or lands on, because of their unique username.
1. Members log in to their Membership via a page that just has a Username and Password box on it. Members CANNOT REGISTER THEMSELVES on this page or any page. I DO NOT WANT any type of registration page as I’ll create an account for each Member. Members only become Members because I add them – no one can register at all. This spreadsheet is a budgeting spreadsheet, so it contains sensitive info that needs to be secure and protected for the Member and is specific to each Member individually.
2. The Membership consists of one page only, specific to each Member. It’s not a generic Membership where all Members end up on the same page – the page each Member lands on, houses their own spreadsheet that is unique to them only.
Here’s an example of a login page I’m looking for.
http://sharelord.platinumdiary.com/login/Hopefully this makes sense. I’m a little lost at the moment.
Thanks to Steve for some earlier responses to my query.
Claude
-
This topic was modified 9 years, 3 months ago by
claudesmusicbox.
-
This topic was modified 9 years, 3 months ago by
claudesmusicbox.
-
This topic was modified 9 years, 3 months ago by
claudesmusicbox.
-
This topic was modified 9 years, 3 months ago by
Jan Dembowski.
-
This topic was modified 9 years, 3 months ago by
Jan Dembowski.
-
This topic was modified 9 years, 3 months ago by
-
I’ve never seen a membership plugin that will work quite like that.
What I’d actually recommend is that you find a membership system that will direct users to a single page when they log in, and let that page display the correct spreadsheet to your users. This will need some cusotm programming on yur side, but if you can figure out how to get an Excel spreadsheet to display on a web page and save back to the server you should be fine with doing something like that.
1. Write some code to automatically create a page for the users when you create them (the users). Save the page id in the user-meta.
function create_new_user_budget_page($user_id){ if (!$user_id>0) return; //Get user info $curr_user = get_user_by('ID',$user_id); $title = $curr_user->first_name . ' ' . $curr_user->last_name; if($title == '') $title = $curr_user->nicename; // Create post object $post_args = array( 'post_title' => sanitize_title($title), 'post_type' => 'page', 'post_status' => 'pending', 'post_author' => $user_id ); // Insert the post into the database $user_table_page = wp_insert_post( $post_args ); //Store the page ID in the user meta update_user_meta($user_id,'_table_page_id',$user_table_page); } add_action('user_register','create_new_user_budget_page');2. Use wp_reriect_url action to redirect the users to automatically redirect the users to the page created for them, wheneever they login.
function user_login_redirect( $redirect_to, $request, $user ) { //is there a user to check? if ( isset( $user->roles ) && is_array( $user->roles ) ) { //check for admins if ( in_array( 'administrator', $user->roles ) ) { // redirect them to the default place return $redirect_to; } else { $user_page = get_user_meta(get_current_user_id(),'_table_page_id',true); //retrieve the page created earlier $user_page_url = get_edit_post_link($user_page); return $user_page_url; } } else { return $redirect_to; } } add_filter( 'login_redirect', 'user_login_redirect', 10, 3 );3. WordPress automatically takes care of auto-saving the posts every few seconds, upon editing.
Thanks guys for your help.
Hey shariqkhan2012, I’m not real savvy with code but I understand what you’re saying. Where do I actually put those 2 pieces of code?
I did’t think it would be that hard to redirect members to their OWN specific page upon login that no other member can see. I understand member plug ins that redirect members to pages that all members can see, but I didn’t think it was impossible to direct members to land on their own specific page, unique to their usernames.
The only way I can think it will work (and it’s a dumb way to do it), is this:1. When members log in, they all land on a “Members List” page that all Members can see, that has each member listed alphabetically via their username.
2. I create a separate page for each member, with the title of their page being their username eg ‘claudesmusicbox”. This page is protected by the wordpress ‘password’ setting on each page. I create a unique password for each client which is emailed to the client upon Member account creation.
3. All Members land on the same page with other Member’s usernames on it. If a member tries to view any other members info by clicking on another member’s username, they won’t gain access because it’s protected by a unique password.
4. A Member clicks on his username and is prompted by a password. The member enters his password and gains access to his own page containing a spreadsheet that no other member can see.
So I create member accounts and allocate each member a unique password. No one can register via the site as there’s no registration page. Members only gain access once I consult with them and they come onboard. I think that will work yeah?
If anyone can think of a better way of listing all members on a page other than via their usernames (coz I think it’s a silly way of doing it), please feel free to help.
Then I need to work out how a member logs out once they’ve finished on their page…….-
This reply was modified 9 years, 3 months ago by
claudesmusicbox.
You need to add the code which I gave in the functions.php of your theme file. Or perhaps create it as a plugin.
If you want to create it as a plugin, then follow these steps:
1. Create a directory and give it a suitable name. For eg claudesmusicbox or claudes-music-box or whatever, just ensure that the directory name does not contain any spaces.
2. Inside the directory create a file and rename it to whetever-you-like.php
Again ensure that it does not contain any spaces.
3. Now open the file in a text editor (like Notepad++) and enter the following code:<?php /* Plugin Name: Claudes Membership Plugin Plugin URI: http://www.claudesmusicbox.com Description: Plugin to do some magic on CLaude's website Author: Claude Version: 1.0.0 Author URI: http://www.claudesmusicbox.com */ ?> <?php function create_new_user_budget_page($user_id){ if (!$user_id>0) return; //Get user info $curr_user = get_user_by('ID',$user_id); $title = $curr_user->first_name . ' ' . $curr_user->last_name; if($title == '') $title = $curr_user->nicename; // Create post object $post_args = array( 'post_title' => sanitize_title($title), 'post_type' => 'page', 'post_status' => 'pending', 'post_author' => $user_id ); // Insert the post into the database $user_table_page = wp_insert_post( $post_args ); //Store the page ID in the user meta update_user_meta($user_id,'_table_page_id',$user_table_page); } add_action('user_register','create_new_user_budget_page'); function user_login_redirect( $redirect_to, $request, $user ) { //is there a user to check? if ( isset( $user->roles ) && is_array( $user->roles ) ) { //check for admins if ( in_array( 'administrator', $user->roles ) ) { // redirect them to the default place return $redirect_to; } else { $user_page = get_user_meta(get_current_user_id(),'_table_page_id',true); //retrieve the page created earlier $user_page_url = get_edit_post_link($user_page); return $user_page_url; } } else { return $redirect_to; } } add_filter( 'login_redirect', 'user_login_redirect', 10, 3 ); ?>IMPORTANT: There should be no whitespace (or line break) before the opening <?php or the closing ?> tags
Now to answer your other questions:
2. I create a separate page for each member, with the title of their page being their username eg ‘claudesmusicbox”.
The function create_new_user_budget_page in the code above does exactly that. It creates a page with the user’s name. For eg. for a user with the name John Doe, the page would http://www.claudesmusicbox.com/john-doe (i.e FirstName-LastName)
If you want the page name to be http://www.claudesmusicbox.com/johndoe2017 (i.e username), then you need to change the lines :
$title = $curr_user->first_name . ' ' . $curr_user->last_name; if($title == '') $title = $curr_user->nicename;to
$title = $curr_user->user_login;This will create a page automatically when you create a user. You can also optionally set a password for that by password-protecting the page.
It is important to note, password-protecting a page will prevent unauthorized access only on the frontend, not on the backend.
Depending on the user role (i.e. contributor, editor, author, admin etc) users may (for roles admin and editor) or may not (for roles contributor, author) be able to see other user’s page.
So if you want users to not be able to see other user’s page in the backend, them assign them the role of either contributor or author.1. When members log in, they all land on a “Members List” page that all Members can see, that has each member listed alphabetically via their username.
The function user_login_redirect will take care of that. It wil redirect the users (upn login) to their page only.
So you see that the redirecting and creating pages is already taken care of by the code above.
But what I am really interested in knowing is how do you embed the spreadsheet in the page?
IMPORTANT: There should be no whitespace (or line break) before the opening <?php or the closing ?> tags
I meant to say :
There should be no whitespace (or line break) before the first <?php or after the last ?> tags.-
This reply was modified 9 years, 3 months ago by
Shariq Khan.
Wow! Thx shariqkhan2012 for such a concise answer. I will look at this now and see how I go with it. I sincerely appreciate your insight.
Last time I attempted this, the spreadsheet was the reason I stopped it. You can embed a spreadsheet into a webpage no problem – the trick is having it be ‘LIVE”.
At the moment I do this for myself via Goggle docs. I created the spreadsheet 15 years ago and then shared it with myself via my gmail account. Now I can access that spreadsheet on my phone or on the web via my gmail email account. I can update/amend cells live on the spot and it saves/publishes automatically, immediately. Next time I visit the spreadsheet (whether it’s on my phone or web), the spreadsheet reflects any changes I last made.
Making this happen on a webpage where the spreadsheet is embedded and where members amend/update their own cells and it saves immediately, is the challenge. I’m hoping that in the 6 years I last attempted it, a plug in or a company has a solution. I’ll def let you know how I go!Hi shariqkhan2012. Can you also help with the following?
My url is budgetdingsmart.com.au (please don’t look at it as I’m still working on a theme I like and pages etc, so it’s looking awful until I get onto fixing it).
I want the url where Members login to be: budgetdingsmart.com.au/login
How can I make this page look like: http://sharelord.platinumdiary.com/login/
and remove all the parts on the theme that appear there now?
I just want a log in box as per the url above.Hi shariqkhan2012. I did what you said above and created the folder and file etc but a new page wasn’t automatically created when I created a user.
Does it matter where I create the Directory? I created it in my plugins folder. I did what you said in regards to creating a file .php etc (I do know how to do this) but the Member page didn’t create when I created a new user with a contributor role 🙁
Does it matter what I call the folder? (there’s no spaces as you asked) but I gave it a short encrypted name.
If I want to add the code in my functions.php folder, where exactly do I place the code?-
This reply was modified 9 years, 3 months ago by
claudesmusicbox.
-
This reply was modified 9 years, 3 months ago by
claudesmusicbox.
You need to create the directory inside the wp-contents/plugins directory because it is a plugin. Next you’ll need to activate it just like any other plugin.
I already had the directory inside the folder you stated. I did it in between our last messages.
Sorry to sound stupid, but what am I actually uploading as the plugin – the php file?-
This reply was modified 9 years, 3 months ago by
claudesmusicbox.
Ok shariqkhan2012 I worked it out. Thx again!
Tested and it all works fine as you explained. A page gets created automatically when I create a user and then the page is password protected. I added a logout short-code to the member’s page which redirects them back to my home page after they log out.
Now I just have to figure out the spreadsheet part of it. I’ll let you know.
Thx again!I want the url where Members login to be: budgetdingsmart.com.au/login
How can I make this page look like: http://sharelord.platinumdiary.com/login/You can try a plugin like:
https://wordpress.org/plugins/admin-custom-login/screenshots/
https://wordpress.org/plugins/login-customizer/screenshots/
https://wordpress.org/plugins/custom-login/screenshots/Also have a look at this:
http://www.wpbeginner.com/plugins/how-to-create-custom-login-page-for-wordpress/Now I just have to figure out the spreadsheet part of it. I’ll let you know.
1. If you want an actual spreadsheet, then you will probably need o use on of the plugins that enable embedding google docs into WordPress page.
But it would require providing Google API keys.
So if you need to go this way, then it is better to create a separate google account just for this.2. On the other hand, if you just want to give the users a spreadsheet like look, then probably you could go with a plugin like TablePress that has the ability to export its contents to xls or csv
Thx shariqkhan2012.
I can embed a spreadsheet easily – (I don’t need a plug in to do this) – I just can’t edit the spreadsheet on the spot.
When I log in as a member and arrive at my spreadsheet, I can sort and move cells but I can’t edit it, which is the main component I need for this Membership site to function. I’ve got everything working but this last piece of the puzzle.It’s unfortunate that after all these years, no one has yet to find a solution to making an interactive spreadsheet with editable cells that save. Damn!
Thanks again for your help – it’s been invaluable.
-
This reply was modified 9 years, 3 months ago by
The topic ‘Membership headache’ is closed to new replies.