Skip to content

Commit

Permalink
Enhanced plugin_config_get() function
Browse files Browse the repository at this point in the history
The function now works similar to config_get(), and allows the usage
of user_id and project_id parameters. With this change it is now
possible to fetch plugins config values for a specific user and/or
project.

Fixes #13346

Signed-off-by: Damien Regad <damien.regad@merckgroup.com>
  • Loading branch information
dominik authored and dregad committed Sep 24, 2011
1 parent f8a11be commit 16ceae1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/plugin_api.php
Expand Up @@ -165,15 +165,18 @@ function plugin_table( $p_name, $p_basename = null ) {
* Get a plugin configuration option.
* @param string Configuration option name
* @param multi Default option value
* @param boolean Global value
* @param int User ID
* @param int Project ID
*/
function plugin_config_get( $p_option, $p_default = null, $p_global = false ) {
function plugin_config_get( $p_option, $p_default = null, $p_global = false, $p_user = null, $p_project = null ) {
$t_basename = plugin_get_current();
$t_full_option = 'plugin_' . $t_basename . '_' . $p_option;

if( $p_global ) {
return config_get_global( $t_full_option, $p_default );
} else {
return config_get( $t_full_option, $p_default );
return config_get( $t_full_option, $p_default, $p_user, $p_project );
}
}

Expand Down

0 comments on commit 16ceae1

Please sign in to comment.