Support

  1. sergio0187
  2. Support
  3. Sunday, April 07 2019, 09:34 PM
Hi,

There are some fields that are required for new registrants but not for existing. New registrants need to upload files.
If existing registrants login and want to edit their profile they need to upload that file to before they can save their profile.
I don't want to have that field as mandatory for existing users, is that possible?

Looking forward to your reply.

Kind regards
admin Accepted Answer
Admin
Hi,
sorry but my code is not tested, probably missing ";" char at the end of line 19.

Also, I recommend you to remove "?>" at the end because after it you have 3 new lines that are rendered as output and can cause some issue.

Another question, will it automatically run this copy script or do I need to enter all these fields in skeleton.php?
You need to add a row for each field that need to be required in registration and not required in edit profile page:
<?php

defined('_JEXEC') or die;

class PlgJsnSkeleton extends JPlugin
{
public function triggerProfileUpdate($user, $data, $changed, $isNew)
{
if($isNew)
{
$data['alias_of_not_required_fields1'] = $data['alias_of_required_fields1'];
$data['alias_of_not_required_fields2'] = $data['alias_of_required_fields2'];
$data['alias_of_not_required_fields3'] = $data['alias_of_required_fields3'];
}
}
}
  1. more than a month ago
  2. Support
  3. # 1
sergio0187 Accepted Answer
Pro
Hi,
Thanks for this.
However I think there's a error in the syntax, I get unexpected '}' for the line, please see attached screenshot.

Another question, will it automatically run this copy script or do I need to enter all these fields in skeleton.php?

Thanks again.
  1. more than a month ago
  2. Support
  3. # 2
admin Accepted Answer
Admin
I'm sorry but I didn't understand the problem well :(
I mean you have a problem with parameter called "Force the compilation of required fields", this feature redirect all pages to edit profile page until user have filled all required fields.
So, replace original code in file /plugins/system/jsn_system/jsn_system.php

Unfortunately you cannot have 2 different values for "Required" parameter in registration and edit profile page, but there is a workaround, please follow these steps:
- Set the required field to be available only in registration page (not in edit profile and profile pages)
- Create another field, not required, with the same name of the required field and available in profile and edit profile pages (not in registration page)
- Download (at the end of docs page at http://docs.easy-profile.com/index.php/article/triggers ), install and enable (Extensions->Plugins) skeleton plugin
- Open to edit the file at /plugins/jsn/skeleton/skeleton.php
- Replace entire code with this:
<?php

defined('_JEXEC') or die;

class PlgJsnSkeleton extends JPlugin
{
public function triggerProfileUpdate($user, $data, $changed, $isNew)
{
if($isNew)
{
$data['alias_of_not_required_fields'] = $data['alias_of_required_fields']
}
}
}


Basically you will use the required field only in registration page, after the registration the value will be copied in the not required field that you will use for profile and edit profile page.
  1. more than a month ago
  2. Support
  3. # 3
sergio0187 Accepted Answer
Pro
Just to clarify further I want all fields which are mandatory at primary registration to be non-mandatory when editing profile later.
  1. more than a month ago
  2. Support
  3. # 4
sergio0187 Accepted Answer
Pro
Content Protected
  1. more than a month ago
  2. Support
  3. # 5
admin Accepted Answer
Admin
mmmh..this is strange, I have asked this because some sql server uses != instead <> as "not equal" operator.

Anyway please try with something like this:
$query->where('a.alias NOT IN ("your_field_alias")');
$db->setQuery( $query );
  1. more than a month ago
  2. Support
  3. # 6
sergio0187 Accepted Answer
Pro
MySQL or do yo mean something else?
  1. more than a month ago
  2. Support
  3. # 7
admin Accepted Answer
Admin
Hi,
which DB server do you use?
  1. more than a month ago
  2. Support
  3. # 8
sergio0187 Accepted Answer
Pro
Content Protected
  1. more than a month ago
  2. Support
  3. # 9
admin Accepted Answer
Admin
Hi,
this is possible only with some code changes, for example in file /plugins/system/jsn_system/jsn_system.php at line 224 replace this code
$db->setQuery( $query );
with this
$query->where('a.alias <> "your_field_alias"');
$db->setQuery( $query );


Basically before make query of required fields you will exclude the field with alias "your_field_alias".

NOTE: this code is not tested and not supported, it is only for example purpose. This modification will be overwritten every Easy Profile update.
  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.