Support

  1. davidunwin
  2. Bug Report
  3. Wednesday, August 01 2018, 04:43 PM
This is not a bug, but a question.

In Easy Profile we have user field ‘Team’ When our users sign in or change their profile they edit this field. They can select one or more options. This field contains the team names they can join eg Rabbits, Sabres, Foxes etc. They can also search this field in the directory ie to find all users who are in a particular team.

We have now set up the Social Network plugin.
The Administrator (Super Admin) has set up Groups with the same names as in the EasyProfile ‘Team’ field.
So now we have groups Rabbits, Sabres, Foxes etc.
The idea is that Team members can have discussions and share things like photos and news within their own group(s)

What we would like to do add each user into the Social Network Group as they EasyProfile Team names
So where Team=Rabbits they would be also be in Group=Rabbits, Team=Sabres they would be also on Group=Sabres etc.

Is there any way we can do this to avoid having to ask each User now to add themselves to each Social Network Group?
davidunwin Accepted Answer
Hi,
Running the query fixed the problem of missing names.
I also logged in as a normal user and changed profile, Now, number of users in each group looks correct.
Phew!! I think it all works fine now
Again I have to say a BIG THANK YOU for all your support in getting this plugin to work as we wanted it.
Great Support......
Kind regards
David
  1. more than a month ago
  2. Bug Report
  3. # 1
admin Accepted Answer
Admin
Hi,
About the total of member please follow this step:
- 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



About other problems try to launch also this query:
INSERT IGNORE INTO #__jsnsocial_users(id) SELECT id FROM #__jsn_users
  1. more than a month ago
  2. Bug Report
  3. # 2
davidunwin Accepted Answer
Forgot to include screen shot of users in group
  1. more than a month ago
  2. Bug Report
  3. # 3
davidunwin Accepted Answer
Ok I ran the SQL queries
They seemed to have worked ok! See screenshots Delete and Insert.
But now when you list members some look ok with with names but others do not have name against them.
See screenshot
  1. more than a month ago
  2. Bug Report
  3. # 4
davidunwin Accepted Answer
Ok,
I think I understand.
I need to schedule this work on our production site.
I will back up the site first, then put the site offline so that I can make the changes with any users being logged in.
This may take a couple of days to organise.
I will come back with the results.
Thanks again
  1. more than a month ago
  2. Bug Report
  3. # 5
admin Accepted Answer
Admin
Hi,
no problem, follow these steps:
- Go to Joomla Administration->Components->Easy Profile
- Click on the button "Sync Users" in the toolbar
- Launch following queries:
1) delete members (not admins) from groups (to avoid duplicate):
DELETE FROM #__jsnsocial_group_users WHERE group_id IN (1,2,3,4,5,7,8,9,10,11) AND status = 1;
2) add members with queries at my previous reply. NOTE: launch these queries only one time
- 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

QUERIES NOTES: of course if you use phpMyAdmin of something else different by Joomla then you need to replace the prefix of the tables.
  1. more than a month ago
  2. Bug Report
  3. # 6
davidunwin Accepted Answer
Content Protected
  1. more than a month ago
  2. Bug Report
  3. # 7
admin Accepted Answer
Admin
Hi,
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.

- I have made needed queries
- I have added some lines of code to update member count for each group in skeleton plugin

I hope now this works as expected :D
  1. more than a month ago
  2. Bug Report
  3. # 8
davidunwin Accepted Answer
Content Protected
  1. more than a month ago
  2. Bug Report
  3. # 9
davidunwin Accepted Answer
They have just come back to me and they have sent them again?

David
  1. more than a month ago
  2. Bug Report
  3. # 10
admin Accepted Answer
Admin
see screenshots:
- email
- form

I have filled and sent the form but no reply from the ISP.

Anyway this is not a problem, with FTP details I can upload something like "adminer" (of course I delete it after fixed your site)
Attachments (2)
  1. more than a month ago
  2. Bug Report
  3. # 11
davidunwin Accepted Answer
They say they have set you up.
Let me check.
Can you forward their email that they sent to you.
I have put and my email address and ftp details in site details
  1. more than a month ago
  2. Bug Report
  3. # 12
admin Accepted Answer
Admin
Hi,
I have inserted our contact informations requested from your ISP's email, but I does not get any informations about access :(
  1. more than a month ago
  2. Bug Report
  3. # 13
davidunwin Accepted Answer
You should receive an email activation from our ISP.
  1. more than a month ago
  2. Bug Report
  3. # 14
admin Accepted Answer
Admin
Hi,
you can use [email protected]
  1. more than a month ago
  2. Bug Report
  3. # 15
davidunwin Accepted Answer
I have attached a note in the site details please respond to the email address in the site details. Thanks for your help
  1. more than a month ago
  2. Bug Report
  3. # 16
admin Accepted Answer
Admin
Hi,
can you please post me phpMyAdmin access details? I think that something like this need to be something of more complex, queries works but I forgot that all users are not sync with the plugin, see screenshot
Attachments (1)
  1. more than a month ago
  2. Bug Report
  3. # 17
davidunwin Accepted Answer
Content Protected
  1. more than a month ago
  2. Bug Report
  3. # 18
admin Accepted Answer
Admin
Hi,
I don't know which tools do you use to launch query, but we recommend to use phpMyAdmin or something else provided by your hosting provider (not Joomla).

Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in
A result like this may be correct, insert query return a boolean and not a result.
  1. more than a month ago
  2. Bug Report
  3. # 19
davidunwin Accepted Answer
I get the following message when I execute the query
Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in /data/htdocs/h/hendon/dev/web/libraries/joomla/database/driver/mysqli.php on line 861

Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given in /data/htdocs/h/hendon/dev/web/libraries/joomla/database/driver/mysqli.php on line 890
Query result is empty
  1. more than a month ago
  2. Bug Report
  3. # 20
admin Accepted Answer
Admin
Hi,
mmmh, this is strange, anyway there is another solution, you can do this via SQL queries:
- Access to some panel like PhpMyAdmin to manage your DB
- Launch following queries:
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';


IMPORTANT you need to replace #__ with the prefix of your tables
  1. more than a month ago
  2. Bug Report
  3. # 21
davidunwin Accepted Answer
Hi I did try the import and Export to try and apply the code in the Skeleton.php. but it does not appear to get actioned.
Kind regards
David
  1. more than a month ago
  2. Bug Report
  3. # 22
davidunwin Accepted Answer
Hi, I have now tested this myself and Yes! It works fine.
One more small question. Earlier in the thread I asked about applying changing all current users based on their existing profile values.

You said this might work through import/export with the comment " Import feature will launch JUser::save function, so it should trigger also this plugin."
I will try this on our development site, but do you still think your comments is still valid given the changes to the code you have now developed for me?
Again, I have to say a big thank you to you for helping on this and your quick responses to my questions.

KInd regards
David
  1. more than a month ago
  2. Bug Report
  3. # 23
admin Accepted Answer
Admin
Hi,
there are several small issues but now are fixed, I have just tried and works ;)
  1. more than a month ago
  2. Bug Report
  3. # 24
davidunwin Accepted Answer
Content Protected
  1. more than a month ago
  2. Bug Report
  3. # 25
davidunwin Accepted Answer
I tried the new code. Now we have the problem that you cannot delete entries in the team field. See sequence ofscreen shots
1. Start with 4 entries (member-Profile1)
2. Delete 3 , leaving 1,(member-Profile2)
3 Submit to update profile.(member-Profile3)
4, When I go back to profile all 4 entries are still there (member-Profile4)

Also groups do not seem to be updared
  1. more than a month ago
  2. Bug Report
  3. # 26
davidunwin Accepted Answer
Content Protected
  1. more than a month ago
  2. Bug Report
  3. # 27
admin Accepted Answer
Admin
Hi,
please, try with this.

Modifications:
- Quoted $data array keys
- Team allow you to add multiple values, so $data['team'] should contain a values in JSON format
- I assumed that you add user to only one usergroup, so I have changed the code to allow multiple values in $groups_to_add variable
Attachments (1)
  1. more than a month ago
  2. Bug Report
  3. # 28
davidunwin Accepted Answer
Ok I have created the code (see zip file), I checked it through PHP checker.
Now when I go into the profile field team I add a team from the selection (see screen shot Members-add Team)
But after I hit submit and go back into the Profile, the team I selected has disappeared (see screen shot Members After add Team)
If I disable the skeleton.php, Adding a new team works fine see (screen shot Members After add Team No Skeleton)
So it appears the Skeleton code is affecting EasyProfile also not adding the groups.
Can you see anything wrong in the code?
  1. more than a month ago
  2. Bug Report
  3. # 29
admin Accepted Answer
Admin
Hi,
you should use the value, so
if( $data[team] == '6')
  1. more than a month ago
  2. Bug Report
  3. # 30
davidunwin Accepted Answer
One more question in your code you select the field like this
if( $data[team] == 'Rabbits'){

This is Text ('Rabbits')
The field we will checking has the following options

1|Ladies Pearson Team
2|Ladies Scratch Team
3|Mens Ancient Brits
4|Mens Eagles
5|Mens Foxes
6|Mens Rabbits
7|Mens Sabres
8|Mens Scratch Team
9|Junior Team

Where the number is the id and then the text
So should we check for the text or the id
ie
if( $data[team] == 'Mens Rabbits')
or
if( $data[team] == '6')
??

David
  1. more than a month ago
  2. Bug Report
  3. # 31
davidunwin Accepted Answer
Content Protected
  1. more than a month ago
  2. Bug Report
  3. # 32
admin Accepted Answer
Admin
Hi,
only one thing, I forgot to add something to manage Administrators in the code.
so the code could be:
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
}
}
  1. more than a month ago
  2. Bug Report
  3. # 33
davidunwin Accepted Answer
Ok Thanks for that.
We are going to copy our existing site to our development site so I can test the plugin there.
I will come back to you with the results.

Kind regards
David
  1. more than a month ago
  2. Bug Report
  3. # 34
admin Accepted Answer
Admin
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.

* in Joomla Administration->Users->Manage there is a button to export users
** you can import exported file from Joomla Administration->Components->Easy Profile, in the left menu you should see Import Users menu item
  1. more than a month ago
  2. Bug Report
  3. # 35
davidunwin Accepted Answer
Content Protected
  1. more than a month ago
  2. Bug Report
  3. # 36
admin Accepted Answer
Admin
Hi,
- Download, Install and Enable Skeleton Plugin (you will find it at http://docs.easy-profile.com/index.php/article/triggers)
- Open file /plugins/jsn/skeleton/skeleton.php
- remove samples functions: triggerFieldAvatarUpdate, triggerProfileUpdate
- add function like this:
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();
}
}


NOTE: This code is not tested and not supported, this is only for example purpose. You need to have a minimum of PHP knowledges
  1. more than a month ago
  2. Bug Report
  3. # 37
davidunwin Accepted Answer
That is very kind of you to do this. Thank you
  1. more than a month ago
  2. Bug Report
  3. # 38
admin Accepted Answer
Admin
Hi,
this is possible by doing a simple plugin, please wait some hours, we will send you the step by step procedure to make it.
  1. more than a month ago
  2. Bug Report
  3. # 39
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Request Support

Support is currently Offline

Support Availability

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.

Guidelines

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

Search Users

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.