How to add users
-
Just downloaded this plugin.
Cannot find where I can register a new user.
Something missed?
-
Sorry, for my mistake!
I found the “Staff” check box in the regular users menu.
Great plugin!
Also looking for a function to enter the schedule which means the pre-defined working date/start-time/end-time for each staff.
Is it possible for me to add such functions without DB modification?
Hope this does not bother you too much.
Is it possible for me to add such functions without DB modification?
“without DB modification”…?
I am not good at English.
Does it mean that “without inserting schedule data into DB” ?Or, “without changing the structure of DB”, the way to insert the pre-defined schedule in a lump into DB?
Dear tnomi,
Poor English too in myself. Also I am new to database in WP Plugins. Let me say again,
What I mean is questions if
1. Your plugin already has a function/database for scheduling service?
2. You have a plan to add that service in this plugin near future?
3. You have any advice about the service I am looking for?Actually my staff schedules are pre-defined per person. For example, staff A to work Monday, Wednesday, staff B for Tuesday, Thursday and Friday, while staff C Monday through Saturday.
But it can be changed from time to time. So I’d like to enter the personal weekly schedule as a predefined one for a given period (ex. 3 months).
Plus, if a staff asks me to change next week’s schedule, I should be allowed to change it, without changing the predefined one.
Any advice will be welcomed.
1. Your plugin already has a function/database for scheduling service?
Nothing.
2. You have a plan to add that service in this plugin near future?
I haven’t thought about that yet.
3. You have any advice about the service I am looking for?
May the following cord be useful for anything?
This code is the way to insert the schedule in a lump into DB.Insert this cord in “functions.php” of the theme you use.
Maybe this function does not always have to be used.
If you don’t update the schedule, do comment out this “add_action()”.add_action( 'init', 'set_pre_defined_schedule' ); function set_pre_defined_schedule() { global $wpdb; $pre_defined_schedule = array( // staff_id => array( // 'date starttime endtime', // 'date', <- If 'starttime' and 'endtime' were omitted, it will be deleted. // ... // ), 2 => array( '2015-12-19 08:30 17:30', '2015-12-20', // It will be deleted. ), 3 => array( '2015-12-19 09:00 14:00', '2015-12-20 14:00 20:00', ) ); $table = apply_filters( 'attmgr_schedule_table_name', $table ); $query = "INSERT INTO $table " ."( <code>staff_id</code>, <code>date</code>, <code>starttime</code>, <code>endtime</code> ) " ."VALUES " ."%VALUES% " ."ON DUPLICATE KEY UPDATE " ."starttime = VALUES( starttime ), endtime = VALUES( endtime ) "; foreach ( $pre_defined_schedule as $staff_id => $schedule ) { $values = array(); foreach ( $schedule as $string ) { list( $date, $starttime, $endtime ) = explode( ' ', $string ); if ( empty( $starttime ) || empty( $endtime ) ) { $ret = $wpdb->query( $wpdb->prepare( "DELETE FROM $table WHERE staff_id=%d AND date=%s", array( $staff_id, $date ) ) ); } else { $values[] = $wpdb->prepare( "( %d, %s, %s, %s )", array( $staff_id, $date, $starttime, $endtime ) ); } } $sql = str_replace( '%VALUES%', implode( ',', $values ), $query ); $ret = $wpdb->query( $sql ); } }
I’m sorry.
“backticks” was included in the cord.
It was corrected.... $query = "INSERT INTO $table " ."( staff_id, date, starttime, endtime ) " ...
Thank you for your prompt response!
From your codes, I understand “$pre_defined_schedule defined” is an array to schedule for all members for 3 months. The array size may grow bigger than expected.
Anyway, it looks good to start here. I will try the above code. And get back to you!
- The topic ‘How to add users’ is closed to new replies.