We need to do an alias for tags since person, staff and student tables all have a field called
tags
.Open up the file app/functions/auth-function.php. Locate the function get_person_by and replace it with the code below:
function get_person_by($field, $value) { $app = \Liten\Liten::getInstance(); try { $person = $app->db->person() ->select('person.*, address.*, staff.*, student.*') ->select('person.tags as naeTags, student.tags as stuTags, staff.tags as staffTags') ->_join('address', 'person.personID = address.personID') ->_join('staff', 'person.personID = staff.staffID') ->_join('student', 'person.personID = student.stuID') ->where("person.$field = ?", $value) ->findOne(); return $person; } catch (NotFoundException $e) { Cascade::getLogger('error')->error($e->getMessage()); _etsis_flash()->error(_etsis_flash()->notice(409)); } catch (ORMException $e) { Cascade::getLogger('error')->error($e->getMessage()); _etsis_flash()->error(_etsis_flash()->notice(409)); } catch (Exception $e) { Cascade::getLogger('error')->error($e->getMessage()); _etsis_flash()->error(_etsis_flash()->notice(409)); } }
Now, you will need to change your plugin to reflect the changes made above. The code in the plugin should now look like this:
$app = \Liten\Liten::getInstance(); function add_appl_stud_tags($spro) { $app = \Liten\Liten::getInstance(); $person = get_person_by('personID', $spro->stuID); $student = $app->db->student(); $student->tags = $person->naeTags; $student->where('stuID = ?', $spro->stuID); $student->update(); } $app->hook->add_action('post_save_stu', 'add_appl_stud_tags');
Joshua Parker
Twitter | Facebook | DigitalOcean | tinyCampaignYou need to login in order to like this post: click here
Thank you…
Just thinking myself could we change something on the application or student router? to pick up a person tag to student’s profile.
You need to login in order to like this post: click here
I will do some testing.
Joshua Parker
Twitter | Facebook | DigitalOcean | tinyCampaignYou need to login in order to like this post: click here
I tried to do this as a plugin, but still isn’t working. The tags are not catching up
Is there something that I am missing here?
Please find the attachment.
Attachments:
You must be logged in to view attached files.You need to login in order to like this post: click here
Then it may be too late, so you should turn it into a plugin and see if that works.
Joshua Parker
Twitter | Facebook | DigitalOcean | tinyCampaignYou need to login in order to like this post: click here
It’s not working, I think there is something missing.
I copied the code to a new file in the dropins folder and tried to create a person, followed by application and student, the “tag” field is still empty even after student record has been created. I can see the tag on “person” record but not on the “student”.
During the process of creating student record (“Stu/add/id”) on student add screen the “tag” column is empty, the field didn’t pick up any tags from person record.
<?php if (!defined('BASE_PATH')) exit('No direct script access allowed'); $app = \Liten\Liten::getInstance(); function add_appl_stud_tags($spro) { $app = \Liten\Liten::getInstance(); $person = get_person_by('personID', $spro->stuID); $student = $app->db->student(); $student->tags = $person->tags; $student->where('stuID = ?', $spro->stuID); $student->update(); } $app->hook->add_action('post_save_stu', 'add_appl_stud_tags');
The above code is the exact copy of the “tags.php” file in “dropins” folder
You need to login in order to like this post: click here
That is correct, this function only fires after a successful creation of a student record. Yes, it should work by placing it into dropins.
Joshua Parker
Twitter | Facebook | DigitalOcean | tinyCampaignYou need to login in order to like this post: click here
Yeah, it’s really good, so this function fires after a new student record have been created right?
Can I add this in “dropins” folder to work? I will give it a try with my dev version of edutrac.
You need to login in order to like this post: click here
You could probably grab the tags from person, and add it to the student table after the applicant has been stu’d. Please note that the code below has not been tested.
$app = Liten\Liten::getInstance(); function add_appl_stud_tags($spro) { $app = Liten\Liten::getInstance(); $person = get_person_by('personID', $spro->stuID); $student = $app->db->student(); $student->tags = $person->tags; $student->where('stuID = ?', $spro->stuID); $student->update(); } $app->hook->add_action('post_save_stu', 'add_appl_stud_tags');
Joshua Parker
Twitter | Facebook | DigitalOcean | tinyCampaignYou need to login in order to like this post: click here
When applicant became a student, along with other details the tags should also be forwarded to the student “tags”
You need to login in order to like this post: click here
Where in the process should the tag be forwarded? When person record is updated? When applicant is stu’d?
Joshua Parker
Twitter | Facebook | DigitalOcean | tinyCampaignYou need to login in order to like this post: click here
Hi,
I am trying to forward a “Tag” from a Person or Application to student profile.
Not exactly person record but from an application is there any way to forward a tag from staff_comments to a student profile tag.
Just like “acadProgCode” from Application to sacp(Student academic program)
If that’s not possible is there any way to take it from “Person” record?
Thanks,
Teja
You need to login in order to like this post: click here
The topic ‘Forward the "Tag" from person or application to student profile’ is closed to new replies.