jambo90210
Forum Replies Created
-
Forum: Plugins
In reply to: [Dynamic Time] Category – better functionalityHi Rhett, For reference this is the plugin I used with Joomla, it’s feature rich and might give you some good ideas on future possible enhancements, it covers a fews of the requests you have already had, around projects, clients, reporting etc.
https://timeworked4joomla.com/
You can experience the plugin by logging in also, the passwords for an employee and admin are in the top right.
Forum: Plugins
In reply to: [Dynamic Time] Category – better functionalitynailed it.. did not realise the preg_split built an array.. That’s the trouble with not doing this stuff often.. Also found zero returns for the first one which was drama also as that’s “false” so had to deal with that with the &&
function dyt_user_cat($c,$userid){ $cat=sanitize_text_field($c); $valid_categories=dyt_get_valid_cats($userid); if( ( array_search($cat, $valid_categories) !== FALSE && ($valid_categories) ) ) return 0; // Keep Category return 1; // Default hide category } function dyt_get_valid_cats($userid){ $cats=get_user_meta($userid,'description',true); if(!empty($cats)) return preg_split('/\R/',$cats); }
Forum: Plugins
In reply to: [Dynamic Time] Category – better functionalitysaw one silly mistake.. fixed it, but still no go :-/ variable shoudl of been $cats
function dyt_user_cat($c,$userid){ $c=sanitize_text_field($c); $valid_categories=dyt_get_valid_cats($userid); //return 0; if(stripos($valid_categories, $c, 0) == false) return 1; // Hide Category return 0; // Default show category } function dyt_get_valid_cats($userid){ $cats=get_user_meta($userid,'description',true); if(!empty($cats)) return preg_split('/\R/',$cats); }
Forum: Plugins
In reply to: [Dynamic Time] Category – better functionalityHi not sure where I went wrong.. it’s working in the sense there are no categories so it’s calling the function, but I have maintain 2 of the codes in the BIO… Guessing something silly? Thanks
function dyt_user_cat($c,$userid){ $c=sanitize_text_field($c); $valid_categories=dyt_get_valid_cats($userid); //return 0; if(stripos($valid_categories, $c, 0) == false) return 1; // Hide Category return 0; // Default show category } function dyt_get_valid_cats($userid){ $valid_categories=get_user_meta($userid,'description',true); if(!empty($cats)) return preg_split('/\R/',$cats); }
Forum: Plugins
In reply to: [Dynamic Time] Category – better functionalityThanks Rhett, yes it’s tedious but that’s the requirement, there are too many people and differences to use the roles.
I will give it a bash over the weekend.
For reference this is the plugin I used with Joomla, it’s feature rich and might give you some good ideas on future possible enhancements.
https://timeworked4joomla.com/
You can experience the plugin by logging in also, the passwords for an employee and admin are in the top right.
Forum: Plugins
In reply to: [Dynamic Time] Category – better functionalityHi Rhett,
the logic is not really role based it’s person by person, so not sure they will really work, however it did get me thinking..
Looking at the userdata the description field (bio?), and perhaps that’s an easy way to do it person by person.
ie
populate the bio with each of the valid categories for that person.
then in the function something like this?
function dyt_user_cat($c,$userid){
$c=sanitize_text_field($c);
$user=get_userdata($userid);
$valid_categories=$user->description);if(stripos($valid_categories, $c) == false return 1; // Hide Category
return 0; // Default show category
}`In the Bio field you would have each valid category as below, not sure if there is a better way of using the stripos as there would be a “new line” as a delimiter or perhaps, I use the pipes “|” as you have in the description .. not sure how the newlines are represented within PHP/wordpress field
What’s your thoughts?
CPM-SAP MII Breakfix Support
CPM-SAP MII Support 2021
JAFS-RB
IW-MII-BAor
CPM-SAP MII Breakfix Support|CPM-SAP MII Support 2021|JAFS-RB|IW-MII-BA
Forum: Plugins
In reply to: [Dynamic Time] Category – better functionalityHi Rhett, that sounds like a plan, we have a custom theme which allows custom CSS and Javascripts to be added.
Great idea. ThanksForum: Plugins
In reply to: [Dynamic Time] Category – better functionalityok, thanks, understand the Admin part.
The filtering like I said was a nice feature of the Joomla timesheet, made it easier for the employee’s to pick and also avoids mistakes by picking something they should not.
Thanks for the reply.