How to add shortcut to Xfce (ubuntustudio)? - xubuntu

I went to
Settings => Setting Manager => Window Manager => Shortcuts
I can modify exist keyboard shortcuts, however, there's no Add option. I googled only found out that there's + (Add) button on Shortcut tab. Is there something wrong with my Xfce? or how could i add a shortcut, say open File manager, to Xfce?
Thanks.

I find solution myself:
Settings => Settings Manager => Keyboard => Applicatin Shortcuts => Add
I hope this might be useful to new Xfce users as well.

Related

Wordpress: why is one of my users unable to edit other author's posts?

I have a wordpress website with several different authors and two admins, of which I am one. I have attempted to promote one of my authors to an editor and then an admin so she can edit other authors posts. But it isn't working. She can edit her own posts, but when she goes to edit somebody else's post she can't change anything, preview button is disabled.
I and the other admin are able to edit others posts with no problems.
What do I need to do to allow my new editor to edit posts from other authors?
Edit: I should mention that I tried the User Role Editor plugin to see if that would improve things, but it says my editor user should have the right permissions to preview, save and publish other people's posts.
Edit: Another thing I should have mentioned is that I installed the 'Hide My WP' plugin to block hackers -- and that appears to be the source of my problems. I put details into my answer below.
Wordpress summary of roles:
Super Admin – somebody with access to the site network administration features and all other features. See the Create a Network article.
Administrator – somebody who has access to all the administration features within a single site.
Editor – somebody who can publish and manage posts including the posts of other users.
Author – somebody who can publish and manage their own posts.
Contributor – somebody who can write and manage their own posts but cannot publish them.
Subscriber – somebody who can only manage their profile.
Adding special role.
First make sure you are using a child theme. In your function.php file put this piece of code.
//Add a custom user role
$result = add_role('userx', __('UserX'),
array(
'read' => true,
'edit_posts' => true,
'edit_pages' => true,
'edit_others_posts' => true,
'create_posts' => true,
'manage_categories' => true,
'publish_posts' => true,
'edit_themes' => false,
'install_plugins' => false,
'update_plugin' => false,
'update_core' => false
)
);
Note: If permission aren't working, It's maybe because the codes that handle permissions are modified. To make it easier and solve the problem, look for a plugin like User Role Editor and install it.
I figured out the problem so I figured I'd share it here for future sufferers. It turns out that the security on my 'Hide my WP' plugin was turned up too high, I turned off the IDS firewall for frontend+backend and made it 'frontend' only. Voila, all of my users are able to edit posts again!

Button links not redirecting prospect theme wordpress

I recently installed prospect theme and i am having tons of trouble as most things aren't customizable directly from the options interface. You can see a demo here:
http://themes.wpbusinessbundle.com/prospect/
So i'm trying to add buttons, which when i add them look fine, but don't redirect anywhere (redirects to the same page with #). I know it's because of something missing that needs to ''pull'' the link I include in the html when i write/insert the button but can't figure out where to modify it in the css or how.
Any help is appreciated. Btw, Calls to action work but I cannot change their color or their size so that's not much good.
From observation of the PHP, the shortcode for a button should be arranged to match:
"extract(shortcode_atts(array(
'link' => '#',
'target' => '',
'variation' => '',
'size' => '',
'align' ...."
What this means is the button shortcode that the visual editor makes will have to be manually edited to look something like this for example:
[button link="http://google.com" variation="blue" size="large"] TEST [/button]
I'm using the theme myself and I've had to edit a lot of the.. questionable code ;P.
Hope this helps.

Allow a non-site administrator access to clear-cache through administrator menu, Drupal 6

I have a site-editor user role with custom permissions. Currently they can access some actions in the admin menu, but they cannot access clear-cache.
I want to expose just that option to the non-administrator (site-editor) user role. I can't find an option that granular in the permissions.
I've found some alternative options, but they involve coding, custom pages, etc. I want a pure drupal GUI option (if any exists). Not: http://drupal.org/node/152983
The reason is that site-editors enter content, but I'm caching panels and views. I need them to be able to clear the cache so they can see the changes they've made.
If you really don't want to create a custom module, there is handbook page on creating a page to clear your cache that includes a snippet to add to a page using the PHP Input format and a refinement in the comments. Keep in mind, using the PHP Input Format is usually discouraged.
It wouldn't take many minutes to create a custom form with a clear-cache button that you can give your editors access to.
The function you need to call to clear the cache is drupal_flush_all_caches
I'm not sure how this option differ from a pure drupal GUI. They are built the same way after all.
Alternatively, you could write a bit of custom code, to clear your panels/views cache when content is created or edited, which would remove this need.
use the flush page cache module?
http://drupal.org/project/flush_page_cache
You can specify what to flush and permit specific roles
If you are using admin_menu, the flush cache ability is given to the 'administer site configuration' permission, which is way bigger than needed. I am thinking of creating a small module that simply does the following:
<?php
function flusher_menu_alter($items) {
$items['admin_menu/flush-cache']['access arguments'] = array('flush cache');
}
function flusher_permission() {
return array(
'flush cache' => array(
'title' => t('Flush the cachce'),
'description' => t('This allows non admins to flush the cache'),
);
);
}
How's that sound?
Check the new CacheFlush module for clearing cache with different roles also you can create presets for clearing the cache just you need helping to save time on development process.

Creating "ON/OFF News Links" functionality for a block created with View Module

I'm a drupal newbie who needs some advice...
I have a news list block at homepage, created with View Module. It is listing all added news' title and link. Everything is cool so far. Now I need to add an ON/OFF option at admin side for homepage news block. When the setting is ON, it will work as it is. When it is OFF, only the titles will be listed with no linking to news detail page.
So, now where should I add this ON/OFF option? I have only add/edit/delete pages for each news, there is no common news page to add such option. Should I create an admin page with such ON/OFF option in? Also I think I need to create a db table to keep this ON/OFF status. and controlling this value at homepage block, if it is 1 or 0, and displaying links according to db value :/
it looks too long way
Create db table
Create an page with ON/OFF option in
add php codes to update db for admin's choice
get the db value in homepage block to display links, etc.
is there any shorter, better way to do what I need?
Appreciate helps so much!!! Thanks a lot!!
You definitely don't need to create any database tables for something like that. If you want a basic admin page, you will need to write a simple module though. First follow this quick start guide for setting up a basic module. (Note: You don't need to add those database queries in your .install file)
Once you have your module enabled...
1) In your mynewmodule.module file, add a menu entry to tell Drupal where your admin page can be accessed:
function mynewmodule_menu() {
return array(
'admin/settings/mynewmodule' => array(
'title' => 'My New Module',
'description' => 'Change settings for news display.',
'page callback' => 'drupal_get_form',
'page arguments' => array('mynewmodule_admin_form'),
'acces callback' => 'user_access',
'access arguments' => array('administer site configuration'),
),
);
}
2) Also in your mynewmodule.module file, add a function to create the form you just referenced in the menu entry:
function mynewmodule_admin_form() {
$form = array();
$form['mynewmodule-on-off-switch'] = array(
'#type' => 'checkbox',
'#title' => t('Enable news links'),
'#description' => t('Control whether news items are linked to stories'),
'#default_value' => variable_get('mynewmodule-on-off-switch', 1),
);
return system_settings_form($form);
}
3) Clear your cache to make Drupal recognize your admin page (you need to clear any time you make changes to mynewmodule_menu()). You can clear it here: admin/settings/performance
4) Visit admin/settings/mynewmodule to see your admin form. The way it works is when you save the configuration, Drupal will save a variable called "mynewmodule-on-off-switch" (same name as the array key in the form) to the variables table in the database. You can get this value anywhere by using variable_get().
create a form at admin/settings/on-off-switch.
on the form submit function, variable_set('on/off switch', $value) (try using booleans for the value).
then on the view theme, check for variable_get('on/off switch', $default_value) before printing the links.
Drupal's weakness, IMHO, is the sheer number of admin settings to configure to get a site up, and you don't want to be adding to that.
What I would do is to have the view expose two different blocks, one with the full view, one with the abbreviated view. Then all the configuration can be done through the block interface, which will be much more flexible in the long run. By, for example: using wildcards or php code for block visibility; showing different views to users with different roles; allowing visitors to control which view they see; exposing the two views to the theming engine more cleanly; and integration with any other module that works with blocks.

How do I empty Drupal Cache (without Devel)

How do I empty the Drupal caches:
without the Devel module
without running some PHP Statement in a new node etc.
without going into the database itself
Effectively, how do you instruct an end user to clear his caches?
When you are logged as an admin (obviously, not every user of the site has to power to clear the cache), there should be a page in "Administer > Site Configuration > Performance".
And, at the bottom of the page, there should be a button (something like "Clear cached data") to clear the cache
As far as I remember, there's no need for Devel to do that, and you really don't need to go to the database, nor run some home-made PHP code.
As a reference, you can take a look at How to Clear Drupal Server-side cache
You can also use the Drush module, which allows you to use the command line to execute popular Drupal commands, like "drush cron" or "drush cache clear".
If you want to clear the cache from a module, you can use the following code.
drupal_flush_all_caches();
I have the easiest solution for that. Install admin_menu module (actually not only for this purpose, once you have installed this module, you wont regret it for sure, link: http://drupal.org/project/admin_menu). Ok, then on a newly appeared top dropdown menu hover your favicon and dropdown menu will appear, and you will see: Flush all caches menu. One click - one flush. Moreover you can flush all caches together or select what to flush: Pages, menu, themes etc. Try and you will never go back )
It would be awesome if you could just GET the behavior by hitting:
http://drupal.local./admin/settings/performance?op=Clear%20cached%20data
but you can't.
However I do want to note the URL for short-cutting through the admin menu (use the latter part):
http://drupal.local. /admin/settings/performance
On-demand clearing can be done in Administer > Site Configuration > Performance.
You should setup the cron job to run every hour (or whatever interval to your liking).
When cron is run on Drupal, all caches are cleared and rebuilt without the need for a human to manually do it.
If this question pertains to theming, you should disable the caching mechanisms (css/js aggregation) and you won't have to clear the cache data when you make changes.
HERE YOU GO:
I had to de-install the "devel" module (it was incompatible with Special Menu Items, which I needed worse), so I made my own.
Anywhere you see MODULENAME replace it with the name of your module.
STEP 1:
Add to any module (preferably one of your custom modules) in the HOOK_MENU, before the "return $items" line:
// short cut for flushing the caches:
$items['flush-cache'] = array(
'type' => MENU_CALLBACK,
'title' => t('Flush the cache'),
'description' => 'MODULENAME Custom Cache Flush',
'page callback' => 'MODULENAME_flush_cache',
'access callback' => TRUE,
);
STEP 2:
Now, in the same module file, where it's not "inside" any other function, add:
/** Page callback **/
function MODULENAME_flush_cache() {
drupal_flush_all_caches();
return 'Caches were flushed.';
}
Now, you can just go to the URL "/flush-cache" on your site to flush the cache. (After you flush the cache one last time the old way.)
STEP 3:
If you want it REALLY convenient, add the following to your page.tpl.php file. You can put it pretty much anywhere between <body> and </body>. NOTE: $my_is_test is a variable I use that's TRUE on my test system, and FALSE in production. If you don't have something like that, replace it with TRUE or FALSE to turn it on or off:
<?php if ($my_is_test): ?>
<a style="text-align:left; position:absolute; right:2px; top:20px;" href="<?=$base_path?>flush-cache" onclick="this.innerHTML = '<b><blink><big>Wait...</big></blink></b>';">flush</a>
<? endif; ?>
And voila! You have a "flush" link at the top-right corner of every page you can click on. Feel free to change the "right" and "top" amounts (or change "right" to "left" or "top" to "bottom" to put it wherever you like it. This link positioning only works on modern browsers, but it's only for you, so it shouldn't be a problem, right?
I found the following at: http://www.drupalgardens.com/content/clear-all-caches-not-working
There's another layer of caching around the site which "clear all
caches" does not affect, you're right. That's the layer that stores
the content for anonymous users.
If you want to bypass the cache for testing purposes, you can add a
junk query string to the end of your site path. For example, if you
wanted to bypass the cache on example.drupalgardens.com/foo you could
visit example.drupalgardens.com/foo?bar=baz or any other random text
set up like ?xxxxx=xxxxx.
This helped me, because I have had issues where clearing the cache under Configuration > Performance didn't seem to help.
The above code is for Drupal 6.
For Drupal 7 the flush-cache module would be as follows:
<?php
/**
* Implementation of hook_menu()
*/
function flush_cache_menu() {
$items = array();
$items['flush-cache'] = array(
'type' => MENU_NORMAL_ITEM,
'title' => t('Flush the cache'),
'description' => 'Flush all website caches to make sure it updates to relect '.
'your recent changes.',
'page callback' => 'flush_cache_custom_callback',
'access callback' => user_access('flush cache'),
);
return $items;
}
/**
* Implementation of hook_permission()
*/
function flush_cache_permission() {
return array(
'administer my module' => array(
'title' => t('flush cache module'),
'description' => t('Content admin flush cache.'),
),
);
}
/**
* Function that flushes the cache
*/
function flush_cache_custom_callback() {
drupal_flush_all_caches();
return 'Caches were flushed.';
}
Note: that you then flush it by going to:
sitename.com/flush-cache
Make sure you give them permission on the permission page. Clear cache once the "normal" way if the permission doesn't appear after turning the module on.
This is preferable when you don't want your client to get access to the admin menu but you still want them to be able to flush the cache.
The following module creates a menu item that is accessible only to users with the permission "flush cache", which this module makes available on the regular user permissions page.
/**
* Implementation of hook_menu()
*/
function flush_cache_menu() {
$items = array();
$items['flush-cache'] = array(
'type' => MENU_NORMAL_ITEM,
'title' => t('Flush the cache'),
'description' => 'Flush all website caches to make sure it updates to relect '.
'your recent changes.',
'page callback' => 'flush_cache_custom_callback',
'access callback' => user_access('flush cache'),
);
return $items;
}
/**
* Implementation of hook_perm()
*/
function flush_cache_perm() {
return array('flush cache');
}
/**
* Function that flushes the cache
*/
function flush_cache_custom_callback() {
drupal_flush_all_caches();
return 'Caches were flushed.';
}
In Drupal 8, the admin menu module isn't quite ready for use yet. And it will probably get replaced with Drupal "Toolbar". So right now there's no easy way to clear cache, without actually going to:
admin/config/development/performance
The only alternative is to add a menu item in the existing toolbar. This can be done by using this module, but as you can see, it still needs a bit of work. I got it working, but had to make a few tweaks.
use drush and this command: drush cc all
If you're using Boost to cache you need to be more specific:
drush #alias_name cc all

Resources