public function triggerProfileUpdate($user,&$data,$changed,$isNew){
$db = JFactory::getDbo();
/* remove user from all groups if he is not a new member */
if(!$isNew) {
$query = 'DELETE FROM #__jsnsocial_group_users WHERE user_id = '. $user->id . 'AND group_id IN (1,2,3)'; /* Replace 1,2,3 with ids of groups, you can find it from Admin Panel->Groups Manager */
$db->setQuery($query);
$db->execute();
}
if( $data[team] == 'Rabbits'){
$group_to_add = 1; /* replace 1 with Rabbits group ID */
}
if( $data[team] == 'Sabres'){
$group_to_add = 2; /* replace 2 with Sabres group ID */
}
if( $data[team] == 'Foxes'){
$group_to_add = 3; /* replace 3 with Foxes group ID */
}
if( isset( $group_to_add ) ) {
$query = 'INSERT INTO #__jsnsocial_group_users(group_id,user_id,status,created) VALUES ('.$group_to_add.','.$user->id.',1,NOW() )';
$db->setQuery($query);
$db->execute();
}
}
At what point does this code get executed and what event triggers the execution... is when users login, change their profile?This code will be trigger every time user register or update own profile.
Is there a possibility to trigger this plugin manually to set up the users groups in Social Connect from the existing field settings in their EasyProfile settings?mmmh...maybe, unfortunately we have not tested it but you can try to export* and import** all users. Import feature will launch JUser::save function, so it should trigger also this plugin.
public function triggerProfileUpdate($user,&$data,$changed,$isNew){
$admins = array(151,162,542); /* replace with IDs of administrators */
if ( ! in_array( $user->id, $admins ) ) { /* if user is not an admin */
// HERE THE PREVIOUS CODE
}
}
INSERT INTO #__jsnsocial_group_users(group_id,user_id,status,created) SELECT 11,id,1,NOW() FROM #__jsn_users WHERE team LIKE '%"1"%';
INSERT INTO #__jsnsocial_group_users(group_id,user_id,status,created) SELECT 10,id,1,NOW() FROM #__jsn_users WHERE team LIKE '%"2"%';
INSERT INTO #__jsnsocial_group_users(group_id,user_id,status,created) SELECT 8,id,1,NOW() FROM #__jsn_users WHERE team LIKE '%"4"%';
INSERT INTO #__jsnsocial_group_users(group_id,user_id,status,created) SELECT 4,id,1,NOW() FROM #__jsn_users WHERE team LIKE '%"5"%';
INSERT INTO #__jsnsocial_group_users(group_id,user_id,status,created) SELECT 3,id,1,NOW() FROM #__jsn_users WHERE team LIKE '%"6"%';
INSERT INTO #__jsnsocial_group_users(group_id,user_id,status,created) SELECT 7,id,1,NOW() FROM #__jsn_users WHERE team LIKE '%"7"%';
INSERT INTO #__jsnsocial_group_users(group_id,user_id,status,created) SELECT 9,id,1,NOW() FROM #__jsn_users WHERE team LIKE '%"8"%';
INSERT INTO #__jsnsocial_group_users(group_id,user_id,status,created) SELECT 5,id,1,NOW() FROM #__jsn_users WHERE team LIKE '%"9"%';
INSERT INTO #__jsnsocial_group_users(group_id,user_id,status,created) SELECT 2,id,1,NOW() FROM #__jsn_users WHERE section LIKE '1';
INSERT INTO #__jsnsocial_group_users(group_id,user_id,status,created) SELECT 1,id,1,NOW() FROM #__jsn_users WHERE section LIKE '2';
Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given inA result like this may be correct, insert query return a boolean and not a result.
needed a real person's name?Ops, this is my fault, I have used "Easy Profile Support Team" as name, anyway this is not important, we have fixed it via FTP.
- Update count of members: skeleton plugin will update the total of member of each of the groups, so you need only to update a user and the script will be triggered. NOTE: users must not be a admin and you need to change some field otherwise skeleton plugin will be not triggered
INSERT IGNORE INTO #__jsnsocial_users(id) SELECT id FROM #__jsn_users
Working days: Monday to Friday. The support staff is not available on weekends; in the most of cases tickets will not be answered during that time.
Reply time: Depending on the complexity of your support issue it's usually between a few minutes and 24 hours for paid members and about one week for free members. When we expect longer delays we will notify you.
Before you post: read the documentation and search the forums for an answer to your question.
When you post: include Site Details if you request a support (you can use the form below the reply in Site Details tab).
Auto Solved Question: If after a week the author of the post does not reply to a request by moderator, the question will be marked as resolved.
Language: only English
Easy Profile® is not affiliated with or endorsed by Open Source Matters or the Joomla Project. Joomla is Free Software released under the GNU/GPL License.
Our site uses non fat, delicious cookies which help us improve your user experience. You can read more about it in our Legal page.