New answers tagged

1

First you need to make group and subgroup. You can use wordpress existing User Role or you can make custom user role (group) by own. Members is a nice plugin to create custom role. For example your main group is "Group1" and subgroup is "Subgroup1". First you need to check current user role (Group of user). After that you can show full content for "Group1"...


0

First, check for get_current_user_id. Then create a log of visits by adding information to a user's metadata with update_user_meta & get_user_meta. On every page hit that you care about you can run a function to determine rate/limit of usage per user. If they break the rules, you can redirect to a page that doesn't contain that logic with wp_redirect.


0

I just want to point out that some people may still have an empty site users table—specifically for their root site. If this problem occurs, the way to fix it issue is by doing the following: Go to the table wp_usermeta Find any entries with the meta_key wp_capabilities Change the meta_key from wp_capabilities to wp_1_capabilities I believe "1" is ...


1

Looks to me you should be seeking a woocommerce purchase completion hook. This would be when you could add that a donation has been made and at what amount, then you could grab any user information, amounted donated and other info you need and save it to your donor table. use this: add_action('woocommerce_order_status_completed', 'save_to_donors',10,1); ...


-1

It really depends on why you want to manage your users. If it's just to have additional content editors or contributors, what comes out of the box will work just fine. If you are meaning to create a membership site where people have to log in to see specific content they paid for I would suggest WooCommerce Membership. It's very easy to use and set up is ...


1

This action hook allows you to access data for a new user immediately after they are added to the database. The user id is passed to hook as an argument. Not all user meta data has been stored in the database when this action is triggered. For example, nickname is in the database but first_name and last_name. The password has already been encrypted when ...


-1

NOTE: This answer looks irrelevant to the OP's question after further analysis of the added/updated function in the question. Im leaving this answer in place and creating a new answer for historical use, since part of the question seems applicable. You could use something like the following to create user meta when users are added to the user table. Put ...


0

Since you can't really do this, I would recommend using the Theme My Login plugin, a very simple member plugin which will just create "log-in", "log-out" and "profile" pages that will fit the customization of your theme. You'll be able to change the order of the fields as you wish in a distinct file that you can add in your child theme, so you won't have any ...


0

You can get current user ID easily using get_current_user_id(). $usersid = get_current_user_id(); $activity = $_POST['activity']; $reason = $_POST['reason']; $explanation = $_POST['explanation']; For your function f2user() you can change your code to this: $current_user = wp_get_current_user(); return $current_user->ID; According to ...


0

You could use the WP User Avatar plugin for this.


1

You are going in wrong direction there is no way to get user role while admin change from back end. You can retrieve the role object for the current user by calling get_role(), but that's an object rather than a string with the role name. function get_user_role($uid) { global $wpdb; $role = $wpdb->get_var("SELECT meta_value FROM {$wpdb->usermeta} ...


7

it's right here in the codex. This is example code, showing how a new user is created: $user_id = username_exists( $user_name ); if ( !$user_id and email_exists($user_email) == false ) { $random_password = wp_generate_password( $length=12, $include_standard_special_chars=false ); $user_id = wp_create_user( $user_name, $random_password, $user_email )...


0

We may need a little more information on the version of WordPress you are running, or at least the interface you are seeing that the new admin is not seeing. Typically, when I troubleshoot WordPress installations and I have to add an administrator, I have full access just like an admin. So, it shouldn't be any different for you. Make sure that the role of ...


0

First remove the category metabox from the post edit screen for this particular role, let's name it onecat-author: if (current_user_can('onecat-author')) { remove_meta_box ('category', 'post', 'normal'); } Next, when the post is saved use the available hook to assign the category: if (current_user_can('onecat-author')) { add_action ('save_post', ...


0

Yes. There are a variety of ways to do this, primarily, we'll need to tackle the wp_delete_user() function. Your first task, and the tricky one, is to identity which accounts are spam, and which are real. This can be quite an adventure if your site gains new users regularly. With the following example, we target two values, the user's email account and ...


2

The function need a array with the parameters! see Codex Also you map the parameter with the value, like parameter 'user_email' => $_POST['user_email']. in your example like this: $user_id = (int) $_POST[ 'ID' ]; // correct ID wp_update_user( array( 'ID' => $user_id, 'user_email' => $_POST[ 'user_email' ] ); // correct ...


0

Finally I used the wp_set_password(); function as the emergency reset script documentation of Wordpress explains, which helped me to set a new password for my admin account.


0

I found an answer here i will give this a try.. Confirmation required on email change


-1

I found out the problem. i used wp_update_user to create the user, instead of wp_create_user. my bad :/


2

This is not a complete answer, but it's an attempt at giving you some direction. Hopefully with the community here we can come up with a solution for you! Firstly, I've been able to replicate your issue: I took your code and placed it in my theme's functions.php for now. I removed the if( $strict ) test I tried registering an 8 character Hebrew name - it ...


0

I always find it way less confusing to get the results from one table and loop them rather than to try to join them like that... eg. global $wpdb; $query = "SELECT post_id FROM wp_postmeta WHERE meta_key='fake_author' AND meta_value='11111'"; $results = $wpdb->get_results($query); foreach ($results as $result) { $query = "UPDATE wp_posts SET ...



Top 50 recent answers are included