1. QuickScriptz
  2. Support
  3. Saturday, September 23 2017, 05:46 PM
Hi there,

We use Membership Pro with a plugin that “maps” fields to EasyProfile. If the field is updated in Membership Pro, then the data is also updated in the corresponding field in EasyProfile. The only issue we’ve encountered is that EasyProfile field conditions are not being run (because the update happens via SQL and not through a regular “update profile” action).

That said, we’re wondering if there is some kind of hook, event, or trigger that we can use to notify EasyProfile that a field was updated, and that conditions should be applied?

Thanks!
admin Accepted Answer
Admin
Hi,
sorry for late reply, it's a weekend for us :D

There are no way to manage this when you update profile data via SQL query. This is not a limit of Easy Profile, with a SQL query this is an impossible thing.

If you need to add/remove user from usergroup with conditions then I recommend you to add/remove from usergroup directly via Membership Pro.
  1. more than a month ago
  2. Support
  3. # 1
QuickScriptz Accepted Answer
Thanks for the reply! I definitely understand that this can't be done with SQL, but what I'm wondering is if it can be done in PHP? Something along the lines of...


// Custom SQL query to update the Easy Profile field
$query = 'UPDATE easyprofile_fields SET phone = ' . $db->quote($value) . ' WHERE user_id = ' . $user->id ;
$db->setQuery($query);
$result = $db->execute();

// Some other code to let Easy Profile know the field changed, and that it should run field conditions
easyProfile.applyFieldConditions();


Thanks!
  1. more than a month ago
  2. Support
  3. # 2
admin Accepted Answer
Admin
Hi,
you should use something like this:

require_once( JPATH_SITE.'/components/com_jsn/helpers/helper.php' ) ;
$epUser=JsnHelper::getUser( $user->id ) ;
$epUser->phone = $value ;
$epUser->save( ) ;


docs about this at http://docs.easy-profile.com/index.php/article/jsnuser-object

Note about your code: table is #__jsn_users (not easyprofile_fields)

Note about conditions: condition to hide/show fields is dynamics, so you does not need to add any other code, you can simply use a SQL query. Instead if you need to add/remove from usergroups then you can do this directly via Membership Pro (so you can still update Easy Profile values with a SQL query). Of course this is possible with PHP but it is much simpler via SQL query.
  1. more than a month ago
  2. Support
  3. # 3
  • Page :
  • 1


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