New answers tagged

1

The best place to add this would be in the plugin's activation hook. You can either call the dynamic activate_{$plugin} hook, or better yet use the provided register_activation_hook method. Using your code example above - something like this would be what you're looking for: register_activation_hook( __FILE__, function() { $role = get_role( 'editor' );...


1

It's not a good idea to modify plugins if you can help it, as the plugin may be upated and you will lose your changes and need to redo them. Fortunately, that is not necessary in this case anyway, as you can the filter active plugins option instead. You will need the plugin slug for this: add_filter( 'option_active_plugins', 'custom_plugin_load_filter' ); ...


0

Maybe they've already solved this issue. But, now I just wrote this and I decided to share it. <?php //Get role name by user ID if( !function_exists('get_user_role_name') ){ function get_user_role_name($user_ID){ global $wp_roles; $user_data = get_userdata($user_ID); $user_role_slug = $user_data->roles[0]; return ...


0

For the time being, I am manually going into the users section in dashboard and converting the accounts to the player account type


0

The hook wp_ajax_{action} is for logged-in users and wp_ajax_nopriv_{action} for non logged-in users. For example in your functions.php file, add_action( 'wp_ajax_your_ajax_action', 'your_ajax_function_callback' ); // logged-in users add_action( 'wp_ajax_nopriv_your_ajax_action', 'your_ajax_function_callback' ); // logged-out users function ...


0

I just allowed all users to show in the 'Author' selection: add_filter( 'wp_dropdown_users_args', 'add_subscribers_to_dropdown', 10, 2 ); function add_subscribers_to_dropdown( $query_args, $r ) { $query_args['who'] = ''; return $query_args; }


0

I have added this code to enable everyone to add files function allow_own_attachments( $user_caps, $req_caps, $args, $UserObj ) { if ( empty($args[2]) ) { return $user_caps; // nothing to check } $post = get_post( $args[2] ); // post_id was passed here if (is_object($post)){ //check if $post is an object. If it is't checked the code throws this ...


Top 50 recent answers are included