Auto blog creation in a WordPress multisite environment - wordpress

I'm looking for a way to have users register on a multisite setup and have a blog automatically created for them... no, not the way the standard ms registration system handles it. I want to get rid of the second step in the process completely. They register as 'user', and a blog is automatically created at http://my.site.com/user for them.
Followup question... anyone know of a way of automatically pruning the multisite platform? IE, users who don't login for 'x' timeframe (or after a certain time period has elapsed) automatically have their site deleted.

Just make one pure copy of Wordpress files and database layout just after wordpress instalation. When you will have it, after user complete registration just copy files from original directory like "_original_wordpress" to "username_dir", and create new database or just add tables with username_ prefix in them. Also you have to cofigure config.php or whatever there is in wordpress that contains database data.
As for 2nd problem - use CRON. Write script in PHP that lists all users who was last active before month ago, delete tables from database in MySQL and dir "/username/" and it's gone :) And so that it would be executed regulary, just put it in CRON like every day once?
Well thats just one of the way to solve any of your problems but it look very simple.

Related

Is it possible to create duplicate wordpress site by a new user?

im stacked with the question. Example, i have wordpress site at domain name site.com. I wanna to new users, after registration users can create duplicate of main site with replace prebuilt variable. Duplicate version must have view like site.com/nickname-of-user.
Main question: how i can make this with easily way? Maybe exist a ready solution. Maybe most effective use another cms?
This is a lot of function, that should be in a site. Example, affilate program for users registration, paid access for this site, etc.
Which cms is better for this tasks? Thank you for ur answers
Users can create new sites using sub-directories using WordPress Multisite (https://wordpress.org/support/article/create-a-network/)
There is also a plugin called BlogTemplates (https://github.com/wpmudev/blogtemplates) that would allow your users to create a clone of a site upon sign up. It is not being maintained but it is still functional.

Wordpress user is able to login but can't find it in the database

So, I have an admin user on Wordpress, I can login, I can post, update, install plugins, etc.
But when I try to find my user name, or email on the database wordpress is using (in wp-config file), I'm not able to locate it. and mine is not the only user I'm not able to find in the database.
Now,I got to this discovery, because our wordpress site was hacked not long ago, I'm going through the files, and I see some random code on the top of index.php or other files.
I clean and get rid of this code, and files too ! ( aindex.php, ajax-index.php. etc.)
At some point in the middle of the night, some files is creating this files, and inserting this random code again. SO I need to do this everyday in the morning, otherwise the wordpress admin doesn't work. Any insight on this too, will be very appreciate it.
Anyway, it is possible that whoever hacked the site, is making wordpress to store new users on an external database ?
Thanks, any help will be appreciate it.
Note I'm using: Wordfence, WP security, Cerber Security, Defender, iThemes Security to help scan the files.
In relation to your first point, users are not stored in wp-config.php. They are stored in the database - you can access the database via your domain.com/phpmyadmin (depending on the database manager you're using).
Within the database tables you will find wp_users and wp_usermeta where the information you are looking for will be stored.
You can have a look at this page for some more information.

Using same database for multiple wordpress websites

I want to use the same database for multiple WordPress sites. The products should be same in both sites but front end differs.
Is there any way i can accomplish this? So that i can save fhe database of products and just use to create another site without wasting time to upload products.
I don't think it is possible to use One Database for Multiple Wordpress setup on different Domains because Wordpress Database stores SITE URL in wp_options and wp_posts frequently.
And there is no option to switch SITE URL dynamically.
One option I can think of is running a script that executed daily in CRON, script clones everything from one database to another AND also update URLs in the database dynamically.
That should copy all the content you add in one database to another.
Let me know if you have more concerns. Thanks.
This wouldn't be possible unless you were to change the prefix of the tables for one WP install, but then you still wouldn't have the same content on both sites.
Maybe try out WordPress Multisites, I think this might help you in this instance.

Wordpress Password Expiration - Change value or Create a plugin?

One of our Wordpress websites have hundreds of users...when a new user is created, the link is sent to them that expires within a 24h period.
Now, I see that we can change that by changing the a value within the Core of Wordpress: /wp-includes/users.php
Now, would it be better to change the value directly via FTP or create a plugin?
TLDR;
Never edit core files. Go the plugin route instead.
Every time you update WordPress, all core files are replaced by the new ones so editing its code directly is never a good idea: all changes made to it will be lost. Instead, make use of the many action/filter hooks WordPress offers to alter its behavior - this is the safest way to go as upgrades won't overwrite your modifications.
In your case, the password_reset_expiration filter hook is what you're looking for.

Export all WordPress settings except for contents

I need to clone one of my WordPress websites with all databases and plugin settings in order to create a 1/1 copy of the whole theme, backend and functionalities except for contents. I don't want to export posts, pages, media files, comments and every other post type or so, but custom fields, posts database structure etc.
Are there any plugin to do this?
Or what queries do I have to run via SQL to do this?
Thanks
I've done many similar things, and honestly this would probably be the most time-efficient for you unless you have thousands of posts/pages or something.
Install BackUpWordPress and create a backup of all your files and the database.
Extract the sql file from that archive. Do a search/replace to swap out URLs if the domain name is changing. Then import it into your new database.
Upload the entire zip file onto your web server.
Extract it.
Manually delete all site content from the WordPress backend. Again, unless you have many thousands of posts and pages, this doesn't really take all that long. You can use screen options to display more than 10 or 20 pages/posts at a time for bulk deletion, but I wouldn't recommend going much higher than 100.
That's it! Sometimes brute force is the fastest way. Don't make things more complicated than they have to be.

Resources