WordPress Registration Email by Role

Scroll down a little bit, most of it is WordPress default code but you must add everything to your plugin or you might break it! I’ve also added few useful snippets below. Copy-paste them to same plugin. <?php /* * Plugin Name: Emails * Plugin URI: http://www.your-site.com * Description: Different registration email for different roles … Read more

How to add an image from web-link?

This is some specific shortcode to some plugin, that if you just want to paste an image in wordpress editor isn’t necessary. (Also there is not enough info about what this shortcode is about). So there is simple HTML that will simply display link you want as an image, following: <img src=”http://here-goes-some-url-of-your-image” /> Make sure … Read more

Output array into one table cell

Alternatively, make an array of the titles and then use implode… $prerequisites = get_post_meta($post->ID, ‘opl_prerequisites’, TRUE); $titles = array(); foreach( $prerequisites as $prerequisite ){ $titles[] = get_the_title( $prerequisite ); } $output .= ‘<td>’.implode(“,”, $titles).'</td>’;

Create dynamic page content from custom WordPress plugin page

Create a page for this purpose, which you can filter its content later UNLESS you are working other way. Add the page ID to the rewrite rule init function: add_action(‘init’, function() { $page = get_post( 2 ); // replace 2 with page ID add_rewrite_rule( ‘([^/]+)/([^/]+)/?$’, ‘index.php?pagename=” . $page->post_name . “&my_param_1=$matches[1]&my_param_2=$matches[2]’, ‘top’ ); }); Append the … Read more

Disable plugin per user role

You should use the wc_payment_discounts_apply_discount filter. Try something like the following: function remove_privato_discounts() { global $woocommerce; get_currentuserinfo(); global $current_user; if ($current_user->ID) { $user_roles = $current_user->roles; $user_role = array_shift($user_roles); if ( $user_role !== ‘b2b’) { $discount = 0; $woocommerce->cart->discount_total = $discount; return true; // Do not apply discount to privato } } return false; } add_filter( … Read more

How to save additional user data as part of the registration process?

In the function that you’re hooking into user_register, you need to create the user and save the values. First, I’d recommend using wp_insert_user() instead of wp_create_user(). You might do something like this: $userdata = array( ‘user_email’ => $email_address, ‘user_login’ => $user_name, // this is automatically salted ‘user_pass’ => ‘plain_text_password’, ); // this function returns the … Read more

Notepad sticky plugin

You need to create separate tables for store sticky notes and save user sticky notes to that tables , in this way you can manage multiple sticky notes of user. i think this idea will help you.