Hi @topod,
Do you want to import data from a site with Paid Member Subscriptions plugin to another site with Paid Member Subscriptions plugin? Or are you using another plugin on the old site?
Thread Starter
tpo
(@topod)
Hi madalinaruzsa!
No, the problem is that I need to move users from a site that wasn’t made in WordPress and I only have the data for the users that I’ve listed above in the file.
Thanks!
Hi @topod,
Unfortunately, importing/exporting subscriptions is not currently possible with our plugin, but I have added your request to our development list, so it might be implemented in a future version, but we can’t estimate when that may be.
Note 1: A workaround would be to export the user from the old site to the new site -> then the user will need to log into their account -> after which they can go to the Register page from where they can subscribe to a subscription plan.
Note 2: Or another workaround would be to export the user from the old site to the new site -> and as an admin from the WordPress Dashboard -> Paid Member Subscriptions -> Members page -> you can assign subscription plans to the users. You can read more about this here: https://www.cozmoslabs.com/docs/paid-member-subscriptions/member-management/#Add_New_Member
Note 3: Or you can modify the database. The databases that you need to import are wp_pms_member_subscriptionmeta, wp_pms_member_subscriptions, wp_pms_paymentmeta, wp_pms_payments. But it is rather a complex job so if you are not used to working with databases my advice would be to ask for a developer’s help.
Thread Starter
tpo
(@topod)
Hi madalinaruzsa,
thank you very much for your comprehensive reply!
I understand that this can’t be imported directly through your plugin, and I also understand that because you can’t address all the different scenarios. It’s understandable, that’s why I’m trying to find another way.
To your notes:
ad 1/ The big negative in this proposal is that some users in the original database has a paid membership until some date in the future. By importing only name and password without membership, such users would lose their already paid membership.
ad 2/ This is something I would need, but the current solution is very cumbersome because there is only one user to set up in one step. If I have several hundred of those users, it would take an inefficiently long time. But I could imagine something like this being set up via a workaround in SQL statements in classic PHP. I would define there in arrays the data about the users that I have from the original site (username, email address, membership start date, membership end date, membership type) and then through some simple foreach would start adding to the database via SQL statements. All I need for this is a description of the SQL commands that are used to add memberships via this tool: https://www.cozmoslabs.com/docs/paid-member-subscriptions/member-management/#Add_New_Member so that I can add them to that foreach. I guess my idea would be that I would first import users with data via WP All Import, and then add membership information to those users via the aforementioned foreach. This could be paired either by email or by username. In a nutshell it would look something like this (just a very rough sketch):
<?php
/* array: email, date_from, date_to, membership_level */
$memberships = array (
array("member1@email.com","2023-10-20","2024-10-20","gold_membership"),
array("member2@email.com","2023-10-25","2024-10-25","silver_membership"),
...... ((( and so on )))
);
((( here will be a script that I will create that will pair the emails from the previous array with the user ID numbers from the "wp_users" table for the purposes of the "user_id" column in the "wp_pms_member_subscriptions" table )))
foreach () {
INSERT INTO ...... ((( here will be the SQL statements which will insert the membership details into the database )))
}
?>
Thank you very much for the reply!
A.
Hello @topod,
I don’t have any specific SQL commands to share, you simply need to look at the database table with subscriptions *_pms_member_subscriptions and follow the structure. Not all the columns are necessary, you only need basic ones like: user_id, subscription_plan_id, start_date, expiration_date, status
I would suggest you to add a subscription manually through the interface and then look at the row that is added in the table I mentioned. You need to do the same thing.
Users are linked with their user_id so you need to have that in your data instead of email.
Regards.