Page 1 of 1

How do the project cookies work?

Posted: 27 Sep 2024, 13:35
by Joselyne
Hello,

I've use the following to rename $s_submit_report_button for one of the projects.

$t_cookie_name = config_get_global( 'project_cookie' );
if ( $_COOKIE[$t_cookie_name] ){
$t_project_id = $_COOKIE[$t_cookie_name];
//if ($t_project_id === '11'){
if ($t_project_id === '7'){
$s_submit_report_button = 'Submit new ticket';
}else{
$s_submit_report_button = 'Create draft';
}
}

But sometimes, the string is not translated and shows "Submit new issue " as described in /lang/english.txt.

I would like to understand how project 's cookies work.

Thanks.

Re: How do the project cookies work?

Posted: 27 Sep 2024, 15:46
by atrol
You can use function helper_get_current_project for that.
See core/helper_api.php

Code: Select all

/**
 * Return the current project id as stored in a cookie
 * If no cookie exists, the user's default project is returned
 * @return integer
 */