How to add array [closed]

You don’t need array to do this. The following code will be worked. You have to just add other username also inside if condition with or operation. if (‘plugins.php’ === $pagenow ||’update-core.php’ === $pagenow ) { // wp_safe_redirect( home_url() ); // Now check the current user $user = wp_get_current_user(); if ( $user->user_login == ‘Remo’ || … Read more

How limit user connection?

There is no foolproof method to do this, and I would note that you will not be able to cache pages for performance if you try this Force The User to Only be able to open a single page, no tabs, no other devices/browsers This isn’t possible, and the few measures that try to do … Read more

Get registered user’s country or IP

You can’t know the country / IP / etc. of any user: the admin could create any number of users, and before each of those users log in, there is no way for WP to know their IP even after an user logs in, you can’t be sure he/she would log in from the same … Read more

How to delete a particular row in a database table

Yes, you can use wpdb to delete the record in the custom table. Something like this in the wordpress function. require_once (‘../../../../wp-load.php’); if (!empty($_POST[‘id’])) { global $wpdb; $table=”table_name”; $id = $_POST[‘id’]; $wpdb->delete( $table, array( ‘id’ => $id ) ); }

Front-End User Profile

UPDATE: As mentioned in the comments, you might want to learn how you do things like create meta boxes and do a file upload in WordPress without using a framework like CMB2 first. However, as a seasoned WordPress developer, I have found that using CMB2 greatly increased my productivity. I highly recommend using CMB2 to … Read more

Front end register with custom fields

With the help of something @TurtleTread said, I managed to get it working. My code was fine except had to change two things. I removed the custom field from my $user_data, and added this after right after wp_insert_user — add_user_meta($user_id, ‘broker_email’, $b_email); Here’s my final code in my functions.php file — add_action(‘template_redirect’, ‘register_a_user’); function register_a_user(){ … Read more

How to expire user registration?

You would need to do a Cron. Get all user who where registered before 6 months ago and change their role to something else. in this example i have user ‘expired’ but you would need the create this role before you could use it. add_action(‘wp’, function() { if ( !wp_next_scheduled( ‘check_for_expired_users’ ) ) { wp_schedule_event( … Read more