Support

  1. vickilm
  2. Support
  3. Friday, June 24 2022, 10:22 PM
Default value for checkbox field not populating with the value placed in "default" field of field form.
Expected checkbox to have one check initialized when a new account is created.
admin Accepted Answer
Admin
Hi, you can do this by adding a code like this to the script
public function triggerProfileUpdate($user,&$data,$changed,$isNew){ 
if($isNew) { /* Only new users */
$data['alias_of_the_field'] = "value"; /* Assign the value */

require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
$usergroup = 26; /* Change 26 with the id of the usergroup */
JsnHelper::addUserToGroup($user,$usergroup);
// To remove from usergroup you can use a function like this: JsnHelper::removeUserFromGroup($user,$usergroup);

}
}
  1. more than a month ago
  2. Support
  3. # 1
admin Accepted Answer
Admin
Hi,
yes but we does not know the correct way, in the skeleton plugin you can also insert a code to add user to acymailing list by using acymailing apis (https://docs.acymailing.com/developers/acymailing-developer-documentation#insert-a-user-in-acymailing).
  1. more than a month ago
  2. Support
  3. # 2
admin Accepted Answer
Admin
It is a default value in the registration form, but if the field is not available then it will not be filled with any value.

You can fill the value by creating a simple plugin, follow these steps:
- 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){ 
if($isNew) { /* Only new users */
$data['alias_of_the_field'] = "value"; /* Assign the value */
}
}


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. Support
  3. # 3
vickilm Accepted Answer
Thank you ... I will try this... Now can I also include assignment to a Joomla User Group at the same time?
  1. more than a month ago
  2. Support
  3. # 4
vickilm Accepted Answer
Here is what I am inserting with the Skeleton Plugin...

defined('_JEXEC') or die;

class PlgJsnSkeleton extends JPlugin


public function triggerProfileUpdate($user, &$data, $changed, $isNew)
{
if ($isNew) { /* Only new users */
$data['preferred_contact_method'] = "E-mail"; /* Assign the value */
$data['newsletter_type'] = "General"; /* Assign the value */

require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
$usergroup = 17; /* Change 26 with the id of the usergroup */
JsnHelper::addUserToGroup($user,$usergroup);
// To remove from usergroup you can use a function like this: JsnHelper::removeUserFromGroup($user,$usergroup);

}
}
?>


Can I add a check for what newsletter selection they made on the checkbox element and then add the user to their selected choice to the corresponding User Group... I could put the User Group ID in the Check box value... Possible?
  1. more than a month ago
  2. Support
  3. # 5
vickilm Accepted Answer
Can I add a check for what newsletter selection they made on the checkbox element and then add the user to their selected choice to the corresponding User Group... I could put the User Group ID in the Check box value... Possible? or even an existing acymailing list? I have some code for acymailing list insertion. Wondering if I could include it in the check routine for checking what selections were made in the checkbox options.
  1. more than a month ago
  2. Support
  3. # 6
vickilm Accepted Answer
So can we do a check for the values selected in the checkbox at the time of editing a profile or at registration?
  1. more than a month ago
  2. Support
  3. # 7
vickilm Accepted Answer
Bump
  1. more than a month ago
  2. Support
  3. # 8
admin Accepted Answer
Admin
Sorry for late reply,
So can we do a check for the values selected in the checkbox at the time of editing a profile or at registration?
Yes, the function "triggerProfileUpdate" will be triggered every time an user register or update own profile.
  1. more than a month ago
  2. Support
  3. # 9
vickilm Accepted Answer
Thank you I will check that out
  1. more than a month ago
  2. Support
  3. # 10
  • 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 Online

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.