How to get the user role for the current logged in user in Wordpress
Quick and easy way of getting the current role in a Wordpress Setup 1 2 $current_user = wp_get_current_user(); $current_user_role = ($current_user->roles);
Quick and easy way of getting the current role in a Wordpress Setup 1 2 $current_user = wp_get_current_user(); $current_user_role = ($current_user->roles);
I’ve recently started working on a custom module in Drupal 6 and I really disliked the idea to use built in functions for tables and/or to use embedded html into my module. So I’ve made a simple system on having a view like system in Drupal 6. Create a new module, and in the module folder create a directory called views (for eg:). Add the following function in your module...
In case you wanted for example to change all your MyISAM tables into InnoDB , and you didn’t want to go over the tables one by one, you can do the following queries. First check that you’re doing it on the proper database. 1 2 3 4 USE information_schema; SELECT TABLE_SCHEMA, TABLE_NAME FROM TABLES WHERE TABLE_SCHEMA = "your_db_name"; If it returns what you need you can then run: 1 2 3 SELECT CONCAT("ALTER TABLE `", TABLE_SCHEMA,"`....
Add this to your template file: 1 2 3 4 5 6 7 8 9 10 11 12 13 function YOUR_THEME_NAME_preprocess_views_exposed_form(&$vars, $hook) { //this is important // only alter the required form based on id if ($vars['form']['#id'] == 'views-exposed-form-where-to-buy-page-1') { // Change the text on the submit button $vars['form']['submit']['#value'] = t('Search'); // Rebuild the rendered version (submit button, rest remains unchanged) unset($vars['form']['submit']['#printed']); $vars['button'] = drupal_render($vars['form']['submit']); } }
Quick and easy way on how to get ubercart’s form output for a node. 1 $output .= drupal_get_form('uc_product_add_to_cart_form_'. $node->nid, $node);
If you ever wondered how to change the page.tpl.php for a custom content type you’ve found out that by default Drupal 6 doesn’t know how to do it. It’s “fixed” easily by adding the following code: 1 2 3 4 5 6 7 8 9 10 11 /** * Override or insert PHPTemplate variables into the templates. */ function phptemplate_preprocess_page(&$vars) { // Add per content type pages if (isset($vars['node'])) { // Add template naming suggestion....
Ok so i’ve hit this nasty php error T_PAAMAYIM_NEKUDOTAYIM that sounded like a language from another planet for me (found out that it’s Hebrew for “missing double dots”) The problem is that with static class functions you can’t do dynamic loading (or at least it didn’t work for me) So while this 1 2 3 $module = $_GET['module'] $stuff = new $module(); $stuff->data; works, you can’t do 1 $module::data() even if the name of the module is the name of the class....
Ok so this is my first interview so please be gentile :). For those of you that don’t know Exaile is the default music player in the yet to be released Xfce version of Foresight Linux. Alexandru: ok. first question. So tell me a bit about yourself. (this isn’t really a question no ? :)) but we have to start the “interview” somehow) Adam: Well, my name is Adam Olsen. I grew up in Utah and have lived...