1

On my WordPress homepage I would like to have a table that can auto-update based on database changes at a given time period. I am trying to find the best solution to this problem, weather I code it myself, or install a plugin.

Example scenario My WordPress site has a table with 2 rows. My database has been updated with (n) users. At a particular time, I would like my table on WordPress to update.

1 Answer 1

1

qwip,

There is one way to update your custom table while wordpress users table in action and for that you require to code with custom function which is called while some action perform by user. You can handle it by add_action().

There are several action act by wordpress for user(viz. user_register, deleted_user, etc).

See below code example for that:

//The code below that you can add to the Theme Functions file
//For user register action perform then change custom table fields.

add_action('manage_users_columns','custom_modify_user_columns');
function custom_modify_user_columns($user) {
   //update query stuff here
   $wpdb->update( $table, $data, $where, $format = null, $where_format = null );
}

Above code is example for, you can use that structure as per your requirement.

I set some wordpress user action reference URL which would be helpful to you.

Help Reference URL:

  1. user_register
  2. show_user_profile
  3. deleted_user

Hope this helps you.

Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.