Paypal API and WordPress

Try working through the source code of a plugin such as PayPal Framework. From your question, the WP side is fairly trivial, but you should study general PayPal tutorials to understand the API, for example, here’s the first search result from Google for PayPal API tutorial: Using PayPal’s IPN with PHP Also some additional helpful … Read more

Plugin creation – how to add user rights?

Here how register a role specifically for a plugin and add plugin specific capabilities to selected core roles function my_plugin_install() { // add a new role for plugin with some capabilities add_role(‘my_plugin_role’, ‘My Plugin Role’, array( ‘manage_my_plugin’ => true, // plugin specific capability ‘read’ => true // core capability )); // add plugin capabilities for … Read more

How to get a users list by who created them?

I’ve found it. /*** Adding extra field to get the the user who creates the another user during ADD NEW USER ***/ function custom_user_profile_fields($user){ if(is_object($user)) $created_by = esc_attr( get_the_author_meta( ‘created_by’, $user->ID ) ); else $created_by = null; ?> <h3>Extra profile information</h3> <table class=”form-table”> <tr> <th><label for=”created_by”>Created By</label></th> <td> <input type=”text” class=”regular-text” name=”created_by” value=”<?php echo $created_by; … Read more

Get and display a user’s profile info?

You could create a custom template page for this purpose and take advantage of the appropriate class provided by WordPress itself: WP_User_Query Eg: // Create the WP_User_Query object $wp_user_query = new WP_User_Query(array ( ‘role’ => ‘Manager’, ‘order’ => ‘ASC’, ‘orderby’ => ‘display_name’ )); // Get the results $managers = $wp_user_query->get_results(); // Looping managers if (!empty($managers)) … Read more

Check role of Username then echo something if administrator [closed]

@terminator answer might work but there’s no need to create an array and use array_intersect I think since you’re only looking for one role. This might be more comprehensible: $current_user = wp_get_current_user(); $roles = (array) $current_user->roles; if (in_array(‘administrator’, $roles) { /* echo whatever */ } Don’t forget to check that ‘administrator’ is acutally the role … Read more

how to remove some permissions from a shop “manager role” in woocommmerce?

This is treading very close to being off-topic as it asks specifically about a particular plugin, but the answer is quite generic: You can remove the capabilities you don’t need. function remove_cap_wpse_186316(){ remove_cap( ‘yourwoorole’, ‘yourwoocap’ ); remove_cap( ‘yourwoorole’, ‘yourwoocap1’ ); } add_action( ‘admin_init’, ‘remove_cap_wpse_186316’ ); The above is code is for demonstration/experimentation only. Note the … Read more

How can I promote a user to a network administrator?

You might use grant_super_admin() To add an admin by user ID you can use grant_super_admin. Simple put grant_super_admin in your theme’s functions.php file (usually in /wp-content/themes/CURRENT THEME NAME/functions.php). You’ll need to put the ID of the user as a variable, the example below we’re using the user ID of 1. grant_super_admin(1); https://drawne.com/add-super-admin-wordpress-network/ Or Some variation … Read more